Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
QueryResolver Class Referenceabstract

#include "common/query/query-resolver.hpp"

Description

Interface: a facility for resolving (some kind of) queries A concrete subclass has the ability to create Resolution instances in response to specific queries of some kind, if applicable.

Every resolution mechanism is expected to enrol by calling installResolutionCase. Such a registration is considered permanent; a factory function gets stored, assuming that the entity to implement this function remains available up to the end of Lumiera main(). The kind of query and a suitable resolver is determined by the QueryID, which includes a type-ID. Thus the implementation might downcast query and resultset.

Definition at line 98 of file query-resolver.hpp.

Public Member Functions

virtual ~QueryResolver ()
 
virtual operator string () const =0
 short characterisation of the actual facility
 
PReso issue (Goal const &query) const
 issue a query to retrieve contents The query is handed over internally to a suitable resolver implementation.
 
bool canHandle (Goal const &) const
 

Protected Types

using ResolutionMechanism = function< Resolution *(Goal const &)>
 

Protected Member Functions

virtual bool canHandleQuery (Goal::QueryID const &) const =0
 
void installResolutionCase (Goal::QueryID const &, ResolutionMechanism)
 
 QueryResolver ()
 

Private Attributes

unique_ptr< QueryDispatcherdispatcher_
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ ~QueryResolver()

~QueryResolver ( )
virtual

Definition at line 40 of file query-resolver.cpp.

◆ QueryResolver()

QueryResolver ( )
protected

Definition at line 82 of file query-resolver.cpp.

Member Typedef Documentation

◆ ResolutionMechanism

using ResolutionMechanism = function<Resolution*(Goal const&)>
protected

Definition at line 128 of file query-resolver.hpp.

Member Function Documentation

◆ operator string()

virtual operator string ( ) const
pure virtual

short characterisation of the actual facility

Implemented in DummyTypedSolutionProducer, and PlacementIndexQueryResolver.

◆ issue()

PReso issue ( Goal const &  query) const

issue a query to retrieve contents The query is handed over internally to a suitable resolver implementation.

Returns
concrete Resolution of the query (ResultSet), managed by smart-pointer.
Exceptions
lumiera::Errorsubclass if query evaluation flounders. This might be broken logic, invalid input, misconfiguration or failure of an external facility used for resolution.
Note
a query may yield no results, in which case the iterator is empty.
implementation
For actually building a result set, the QueryResolver base implementation uses an embedded dispatcher table. The concrete query resolving facilities, when implementing the QueryResolver interface, are expected to register individual resolution functions into this QueryDispatcher table. Whenever issuing a Goal, a suitable resolution function is picked based on the Goal::QueryID, which contains an embedded type code. Thus, the individual resolution function can (re)establish a typed context and downcast the Goal appropriately

Definition at line 98 of file query-resolver.cpp.

References QueryResolver::canHandle(), and QueryResolver::dispatcher_.

Referenced by Query< RES >::resolveBy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canHandle()

bool canHandle ( Goal const &  query) const
inline

Definition at line 161 of file query-resolver.hpp.

References QueryResolver::canHandleQuery(), and Goal::getQID().

Referenced by QueryResolver::issue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canHandleQuery()

virtual bool canHandleQuery ( Goal::QueryID const &  ) const
protectedpure virtual

Implemented in PlacementIndexQueryResolver.

Referenced by QueryResolver::canHandle().

+ Here is the caller graph for this function:

◆ installResolutionCase()

void installResolutionCase ( Goal::QueryID const &  ,
ResolutionMechanism   
)
protected

Definition at line 110 of file query-resolver.cpp.

References QueryResolver::dispatcher_.

Referenced by PlacementIndexQueryResolver::defineHandling().

+ Here is the caller graph for this function:

Member Data Documentation

◆ dispatcher_

unique_ptr<QueryDispatcher> dispatcher_
private
+ Inheritance diagram for QueryResolver:
+ Collaboration diagram for QueryResolver:

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