Lumiera  0.pre.03
»edit your freedom«
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 144 of file scope-query.hpp.

Public Types

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

Private Types

typedef DiscoveryQuery< MO > _Parent
 
typedef Query< Placement< MO > > _Query
 

Private Member Functions

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

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 Query< RES >
 Query (QueryID typeID, lib::QueryText const &genericQuerySpec)
 
 Query (QueryID typeID, string querySpec)
 
lib::QueryText getQueryDefinition () const
 access the complete syntactical representation of this query. More...
 
- 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_
 

Member Function Documentation

◆ buildContentFilter()

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 189 of file scope-query.hpp.

◆ buildSyntacticRepresentation()

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 201 of file scope-query.hpp.

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

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