Lumiera  0.pre.03
»edit your freedom«
defs-manager.hpp
Go to the documentation of this file.
1 /*
2  DEFS-MANAGER.hpp - access to preconfigured default objects and definitions
3 
4  Copyright (C)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
93 #ifndef LUMIERA_QUERY_DEFS_MANAGER_H
94 #define LUMIERA_QUERY_DEFS_MANAGER_H
95 
96 
97 #include "lib/p.hpp"
98 #include "lib/nocopy.hpp"
99 #include "common/query.hpp"
100 
101 #include <memory>
102 
103 
104 
105 namespace lumiera{
106 namespace query {
107 
108 
109  using lumiera::Query;
110  using std::unique_ptr;
111 
112  namespace impl { class DefsRegistry; }
113 
114 
131  {
132  unique_ptr<impl::DefsRegistry> defsRegistry_;
133 
134  public:
135 
136  DefsManager () noexcept;
137  ~DefsManager ();
138 
144  template<class TAR>
145  lib::P<TAR> operator() (Query<TAR> const&);
146 
147 
151  template<class TAR>
152  lib::P<TAR> search (Query<TAR> const&);
153 
159  template<class TAR>
160  lib::P<TAR> create (Query<TAR> const&);
161 
168  template<class TAR>
169  bool define (lib::P<TAR> const&, Query<TAR> const& =Query<TAR>());
170 
174  template<class TAR>
175  bool forget (lib::P<TAR> const&);
176 
177 
179  void clear();
180 
181 
182 // Q: can we have something along the line of...?
183 //
184 // template
185 // < class TAR, ///< the target to query for
186 // template <class> class SMP ///< smart pointer class to wrap the result
187 // >
188 // SMP<TAR> operator() (const lumiera::Query<TAR>&);
189 
190 // 12/09: according to my current knowledge of template metaprogramming, the answer is "no",
191 // but we could use a traits template to set up a fixed association of smart pointers
192 // and kinds of target object. This would allow to define a templated operator() returning
193 // the result wrapped into the right holder. But currently I don't see how to build a sensible
194 // implementation infrastructure backing such an interface.
196 
197  };
198 
199 
200 
201 }} // namespace lumiera::query
202 #endif
Basic and generic representation of an internal query.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
Customised refcounting smart pointer.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Organise a collection of preconfigured default objects.
Lumiera public interface.
Definition: advice.cpp:104
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition: query.hpp:270