Lumiera  0.pre.03
»edityourfreedom«
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) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
102 #ifndef LUMIERA_QUERY_DEFS_MANAGER_H
103 #define LUMIERA_QUERY_DEFS_MANAGER_H
104 
105 
106 #include "lib/p.hpp"
107 #include "lib/nocopy.hpp"
108 #include "common/query.hpp"
109 
110 #include <memory>
111 
112 
113 
114 namespace lumiera{
115 namespace query {
116 
117 
118  using lumiera::Query;
119  using std::unique_ptr;
120 
121  namespace impl { class DefsRegistry; }
122 
123 
140  {
141  unique_ptr<impl::DefsRegistry> defsRegistry_;
142 
143  public:
144 
145  DefsManager () noexcept;
146  ~DefsManager ();
147 
153  template<class TAR>
154  lib::P<TAR> operator() (Query<TAR> const&);
155 
156 
160  template<class TAR>
161  lib::P<TAR> search (Query<TAR> const&);
162 
168  template<class TAR>
169  lib::P<TAR> create (Query<TAR> const&);
170 
177  template<class TAR>
178  bool define (lib::P<TAR> const&, Query<TAR> const& =Query<TAR>());
179 
183  template<class TAR>
184  bool forget (lib::P<TAR> const&);
185 
186 
188  void clear();
189 
190 
191 // Q: can we have something along the line of...?
192 //
193 // template
194 // < class TAR, ///< the target to query for
195 // template <class> class SMP ///< smart pointer class to wrap the result
196 // >
197 // SMP<TAR> operator() (const lumiera::Query<TAR>&);
198 
199 // 12/09: according to my current knowledge of template metaprogramming, the answer is "no",
200 // but we could use a traits template to set up a fixed association of smart pointers
201 // and kinds of target object. This would allow to define a templated operator() returning
202 // the result wrapped into the right holder. But currently I don't see how to build a sensible
203 // implementation infrastructure backing such an interface.
205 
206  };
207 
208 
209 
210 }} // namespace lumiera::query
211 #endif
Basic and generic representation of an internal query.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Customised refcounting smart pointer.
unique_ptr< impl::DefsRegistry > defsRegistry_
Implementation namespace for support and library code.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Organise a collection of preconfigured default objects.
Lumiera public interface.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:76
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition: query.hpp:279