Lumiera  0.pre.03
»edit your freedom«
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

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

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)
 

Private Attributes

unique_ptr< QueryDispatcherdispatcher_
 

Additional Inherited Members

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

Member Function Documentation

◆ 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.

+ Inheritance diagram for QueryResolver:
+ Collaboration diagram for QueryResolver:

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