Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
ScopeQuery< MO > Class Template Reference

#include "steam/mobject/session/scope-query.hpp"

Description

template<class MO>
class steam::mobject::session::ScopeQuery< MO >

Query a scope to discover it's contents or location.

This is a special kind of query, wired up such as to enumerate the contents or parents of a scope, filtered by a subtype-check. For the actual resolution of the elements to discover, this query relies on an index like facility (usually Session's PlacementIndex), which is abstracted as a QueryResolver, but actually is expected to cooperate especially with this Query subclass to retrieve the scope to be enumerated and the definition of the actual filter predicate. Currently (11/09), there is a special, hard-wired Query-kind-ID Goal::DISCOVERY to distinguish this special kind of a Query.

Contrary to the usual handling of a generic query, a ScopeQuery object holds it's own discovery iterator and thus is completely self contained. The query is issued automatically on construction, thus the embedded iterator immediately points at the first result. Moreover, since any Lumiera Forward Iterator is bool checkable, a ScopeQuery not yielding any results will evaluate to false immediately after construction, allowing convenient inline checks. The query can be re-issued by the function operator, and the embedded result iterator can of course be copied to a bare iterator instance, e.g. for passing it on (ScopeQuery itself is intended to be used polymorphically and thus defined to be not assignable)

Definition at line 134 of file scope-query.hpp.

Public Types

using iterator = _Parent::iterator
 
using ContentFilter = _Parent::ContentFilter
 
- Public Types inherited from DiscoveryQuery< MO >
using iterator = _Query::iterator
 
using ContentFilter = function< bool(PlacementMO const &)>
 
- Public Types inherited from Query< RES >
typedef lib::IterAdapter< Cursor, PResoiterator
 
- Public Types inherited from Goal
enum  Kind {
  EMPTY = 0 ,
  GENERIC = 1 ,
  DISCOVERY ,
  PLACEMENT
}
 

Public Member Functions

 ScopeQuery (PlacementMO const &scope, ScopeQueryKind direction)
 
PlacementMO::ID const & searchScope () const
 
ScopeQueryKind searchDirection () const
 
- Public Member Functions inherited from DiscoveryQuery< MO >
ContentFilter contentFilter () const
 
- Public Member Functions inherited from Query< RES >
 Query ()
 
 Query (string querySpec)
 
 operator QueryKey () const
 automatic conversion from Query to QueryKey for indexing and ordering.
 
Builder rebuild () const
 
string extractID (Symbol predicate) const
 convenience shortcut to extract a desired name-ID.
 
bool usesPredicate (Symbol predicate) const
 
iterator operator() (QueryResolver const &resolver) const
 notational convenience shortcut, synonymous to Query<RES>::resolveBy()
 
iterator resolveBy (QueryResolver const &resolver) const
 
- Public Member Functions inherited from Goal
virtual ~Goal ()
 this is a marker baseclass
 
QueryID const & getQID () const
 

Private Types

using _Parent = DiscoveryQuery< MO >
 
using _Query = Query< Placement< MO > >
 

Private Member Functions

ContentFilter buildContentFilter () const
 the default implementation of the content filtering builds on the downcast-function available on each Placement instance.
 
lib::QueryText buildSyntacticRepresentation () const
 supplement a syntactic representation (as generic query in predicate form).
 

Private Attributes

PlacementMO::ID startPoint_
 
ScopeQueryKind to_discover_
 

Additional Inherited Members

- Static Public Member Functions inherited from Query< RES >
static Builder build (Kind queryType=Goal::GENERIC)
 
- Protected Member Functions inherited from DiscoveryQuery< MO >
 DiscoveryQuery ()
 
- Protected Member Functions inherited from Query< RES >
lib::QueryText getQueryDefinition () const
 access the complete syntactical representation of this query.
 
 Query (QueryID typeID, lib::QueryText const &genericQuerySpec)
 
 Query (QueryID typeID, string querySpec)
 
- Protected Member Functions inherited from Goal
 Goal (QueryID qid)
 
- Static Protected Member Functions inherited from Query< RES >
static QueryID defineQueryTypeID (Kind queryType=Goal::GENERIC)
 
- Protected Attributes inherited from Goal
QueryID id_
 

Constructor & Destructor Documentation

◆ ScopeQuery()

template<class MO >
ScopeQuery ( PlacementMO const &  scope,
ScopeQueryKind  direction 
)
inline

Definition at line 149 of file scope-query.hpp.

Member Typedef Documentation

◆ _Parent

template<class MO >
using _Parent = DiscoveryQuery<MO>
private

Definition at line 137 of file scope-query.hpp.

◆ _Query

template<class MO >
using _Query = Query<Placement<MO> >
private

Definition at line 138 of file scope-query.hpp.

◆ iterator

template<class MO >
using iterator = _Parent::iterator

Definition at line 145 of file scope-query.hpp.

◆ ContentFilter

template<class MO >
using ContentFilter = _Parent::ContentFilter

Definition at line 146 of file scope-query.hpp.

Member Function Documentation

◆ searchScope()

template<class MO >
PlacementMO::ID const & searchScope ( ) const
inline

Definition at line 158 of file scope-query.hpp.

References ScopeQuery< MO >::startPoint_.

Referenced by ScopeQuery< MO >::buildSyntacticRepresentation(), and PlacementIndexQueryResolver::resolutionFunction().

+ Here is the caller graph for this function:

◆ searchDirection()

template<class MO >
ScopeQueryKind searchDirection ( ) const
inline

Definition at line 164 of file scope-query.hpp.

References ScopeQuery< MO >::to_discover_.

Referenced by ScopeQuery< MO >::buildSyntacticRepresentation(), and PlacementIndexQueryResolver::resolutionFunction().

+ Here is the caller graph for this function:

◆ buildContentFilter()

template<class MO >
ContentFilter buildContentFilter ( ) const
inlineprivatevirtual

the default implementation of the content filtering builds on the downcast-function available on each Placement instance.

By parametrising this function with our template parameter MO, we pick out only those elements of the scope being subclasses of MO

Implements DiscoveryQuery< MO >.

Reimplemented in SpecificContentsQuery< MO >.

Definition at line 179 of file scope-query.hpp.

◆ buildSyntacticRepresentation()

template<class MO >
lib::QueryText buildSyntacticRepresentation ( ) const
inlineprivatevirtual

supplement a syntactic representation (as generic query in predicate form).

Building this representation is done on demand for performance reasons; typically a ScopeQuery is issued immediately into a known sub scope of the Session/Model and resolved by the PlacementIndex

Todo:
we need a readable and sensible representation as generic query ///////////////////TICKET #901

Reimplemented from Query< RES >.

Definition at line 191 of file scope-query.hpp.

References Query< RES >::hash_value, ScopeQuery< MO >::searchDirection(), and ScopeQuery< MO >::searchScope().

+ Here is the call graph for this function:

Member Data Documentation

◆ startPoint_

template<class MO >
PlacementMO::ID startPoint_
private

Definition at line 141 of file scope-query.hpp.

Referenced by ScopeQuery< MO >::searchScope().

◆ to_discover_

template<class MO >
ScopeQueryKind to_discover_
private

Definition at line 142 of file scope-query.hpp.

Referenced by ScopeQuery< MO >::searchDirection().

+ Inheritance diagram for ScopeQuery< MO >:
+ Collaboration diagram for ScopeQuery< MO >:

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