Lumiera  0.pre.03
»edit your freedom«
DefsRegistry Class Reference

#include "common/query/defs-registry.hpp"

Description

Helper for organising preconfigured default objects. Maintains a collection of objects known or encountered as "default" for a given type. This collection is ordered by "degree of constriction", which is implemented by counting the number of predicates in the query used to define or identify each object. Accessing an object identified by a query causes the query to be resolved (executed in prolog), which may result in some additional properties of the object being bound or specified.

Todo:
as of 3/2008 the real query implementation is missing, and the exact behaviour has to be defined.

Definition at line 186 of file defs-registry.hpp.

Public Member Functions

template<class TAR >
Iter< TAR > candidates (Query< TAR > const &query)
 find a sequence of "default" objects possibly matching the query. More...
 
template<class TAR >
string dump ()
 helper for diagnostics. More...
 
template<class TAR >
bool forget (P< TAR > const &obj)
 if this object is registered as "default" in some way, drop the registration. More...
 
template<class TAR >
bool put (P< TAR > const &obj, Query< TAR > const &query)
 register the object as being "default" when searching something similar as designated by the given query. More...
 

Classes

class  Iter
 used for enumerating solutions More...
 

Private Attributes

Table table_
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Function Documentation

◆ candidates()

Iter<TAR> candidates ( Query< TAR > const &  query)
inline

find a sequence of "default" objects possibly matching the query.

If there was a registration for some object of the given kind with the same query, this one will be first in the sequence. Besides, the sequence will yield all still existing registered "default" objects of this kind, ordered ascending by "degree of constriction", i.e. starting with the object registered together with the shortest query.

Returns
a forward input iterator yielding this sequence
Note
none of the queries will be evaluated (we're just counting predicates)

Definition at line 250 of file defs-registry.hpp.

References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry().

+ Here is the call graph for this function:

◆ put()

bool put ( P< TAR > const &  obj,
Query< TAR > const &  query 
)
inline

register the object as being "default" when searching something similar as designated by the given query.

Only a weak ref is stored.

Parameters
objto be recorded as "default". Only a weak pointer will be stored
Return values
trueif object has actually been stored
falseif another object is registered for exactly the same query Nothing is changed in this case

Definition at line 277 of file defs-registry.hpp.

References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry().

+ Here is the call graph for this function:

◆ forget()

bool forget ( P< TAR > const &  obj)
inline

if this object is registered as "default" in some way, drop the registration.

Returns
false if the object wasn't registered at all.

Definition at line 307 of file defs-registry.hpp.

◆ dump()

string dump ( )
inline

helper for diagnostics.

Note
to use it, your objects need an operator string()

Definition at line 322 of file defs-registry.hpp.

References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry().

+ Here is the call graph for this function:
+ Inheritance diagram for DefsRegistry:
+ Collaboration diagram for DefsRegistry:

The documentation for this class was generated from the following file: