Lumiera  0.pre.03
»edit your freedom«
query.hpp File Reference

Go to the source code of this file.

Description

Basic and generic representation of an internal query.

This header provides the foundation for issuing queries instead of using hard wired logic and defaults. This is a fundamental architecture pattern within Lumiera, and serves to decouple the parts of the application and allows for a rules based configuration and orchestration of the internal workings.

A Query is a request for just someone to come up with a solution, a preconfigured setup, some existing data object or contextual information. In order to be usable, actually a QueryResolver needs to be available to compute the solution and retrieve the results. As a common denominator, queries can be generic queries given in predicate logic syntax; in this case a generic query resolver (Planned feature as of 1/2013) will be able at least to determine a suitable facility for delegating the resolution. Besides, specific subsystems are using more specific kinds of queries and provide a specialised resolution mechanism, kind of a shortcut, which in these cases can be addressed directly.

General usage pattern
Some parts of the application allow to issue queries – typically these parts do also expose a service point for clients to issue similar queries. In any case, a query remains in the ownership of the issuer, which is also responsible to keep the storage alive during results retrieval. Queries can't be copied and are passed by reference, since #Query is an interface baseclass. Each query instance bears at least a type tag to indicate the type of the returned result, plus a classification tag to indicate the kind of query. In addition, queries are usually required to provide a syntactical representation, allowing to transform each query into a generic query.

To resolve the query, a lumiera::QueryResolver instance is necessary, and this query resolver needs the ability to deal with this specific kind of query. Typically this is achieved by installing a resolution function into the resolver on application start. The QueryResolver returns a result set, actually a Query::Cursor, which can be used to enumerate multiple solutions, if any.

Queries are immutable, but it is possible to re-build and remould a query using a Query<TY>::Builder, accessible via Query::build() and Query::rebuild().

Note
as of 1/2013 this is rather a concept draft, but some parts of the code base are already actively using some more specific queries
See also
lumiera::QueryResolver
mobject::session::DefsManager
asset::StructFactory
config-resolver.hpp specialised setup for the Steam-Layer
fake-configrules.hpp currently used dummy-implementation
SessionServiceExploreScope
PlacementIndexQueryResolver

Definition in file query.hpp.

#include "lib/hash-combine.hpp"
#include "lib/typed-counter.hpp"
#include "lib/iter-adapter.hpp"
#include "lib/query-text.hpp"
#include "lib/query-util.hpp"
#include "lib/nocopy.hpp"
#include "lib/symbol.hpp"
#include "lib/util.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/operators.hpp>
#include <memory>
#include <typeinfo>
#include <cctype>
#include <string>

Classes

class  Query< RES >::Builder
 Helper for establishing, reworking and remolding queries. More...
 
class  Query< RES >::Cursor
 
class  Goal
 Query ABC: unspecific goal for resolution or retrieval. More...
 
class  Query< RES >
 Generic interface to express a query for specifically typed result elements exposing some capabilities or fulfilling some properties. More...
 
struct  Goal::QueryID
 
class  QueryKey
 Wrapper for indexing and ordering. More...
 
class  Goal::Result
 Single Solution, possibly part of a result set. More...
 

Typedefs

typedef lib::TypedContext< Goal::Result > ResultType
 Context used for generating type-IDs to denote the specific result types of issued queries.
 

Functions

template<typename RES >
IxID getResultTypeID ()
 
bool operator!= (Goal::QueryID const &id1, Goal::QueryID const &id2)
 
bool operator< (Goal::QueryID const &id1, Goal::QueryID const &id2)
 
bool operator== (Goal::QueryID const &id1, Goal::QueryID const &id2)
 
size_t taggedHash (size_t hash, Goal::QueryID typeID)
 includes the QueryID type distinction into the given hash value
 

Namespaces

 lumiera
 Lumiera public interface.