fix includes

This commit is contained in:
Fischlurch 2012-12-03 00:18:18 +01:00
parent 6c8bf1f9e4
commit d306bb3cdf
18 changed files with 44 additions and 318 deletions

View file

@ -78,7 +78,7 @@
#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "lib/hash-value.h"
#include "common/query.hpp"
#include "lib/query-util.hpp"
#include <iostream>
#include <string>
@ -231,7 +231,7 @@ namespace advice {
inline Binding const&
Binding::addTypeGuard()
{
atoms_.insert (Atom ("advice.type."+lumiera::query::buildTypeID<TY>()));
atoms_.insert (Atom ("advice.type."+lib::query::buildTypeID<TY>()));
return *this;
}

View file

@ -21,8 +21,8 @@
*/
#ifndef LIB_QUERY_H
#define LIB_QUERY_H
#ifndef LUMIERA_QUERY_H
#define LUMIERA_QUERY_H
#include "lib/bool-checkable.hpp"
@ -288,37 +288,5 @@ namespace lumiera {
namespace query {
/** ensure standard format for a given id string.
* Trim, sanitise and ensure the first letter is lower case.
* @note modifies the given string ref in place
*/
void normaliseID (string& id);
/** count the top-level predicates in the query string.
* usable for ordering queries, as more predicates usually
* mean more conditions, i.e. more constriction
*/
uint countPred (const string&);
const string extractID (Symbol, const string& termString);
const string removeTerm (Symbol, string& termString);
template<typename TY>
const string
buildTypeID()
{
string typeID (typeid(TY).name());
normaliseID (typeID);
return typeID;
}
}} // namespace lumiera::query
} // namespace lumiera
#endif

View file

@ -44,6 +44,7 @@
#include "lib/util.hpp"
#include "lib/util-foreach.hpp"
#include "lib/sync-classlock.hpp"
#include "lib/query-util.hpp"
#include "common/query.hpp"
#include <set>
@ -95,7 +96,7 @@ namespace query {
weak_ptr<TAR> objRef;
Record (const Query<TAR>& q, const P<TAR>& obj)
: degree (lumiera::query::countPred ("TODO")),//q)),////////////////////////////////////////////////////////////////////////////////////////////TODO
: degree (lib::query::countPred ("TODO")),//q)),////////////////////////////////////////////////////////////////////////////////////////////TODO
query (q),
objRef (obj)
{

View file

@ -30,6 +30,8 @@ namespace lumiera {
/* generate vtables here... */
Goal::~Goal() { }
Resolution::~Resolution() { }
QueryResolver::~QueryResolver() { }

View file

@ -21,9 +21,9 @@
* *****************************************************/
#include "lib/util.hpp"
#include "lib/symbol.hpp"
#include "lib/error.hpp"
#include "lib/query-util.hpp"
#include "lib/util.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/regex.hpp>
@ -39,7 +39,7 @@ using util::contains;
using util::isnil;
namespace lumiera {
namespace lib {
namespace query {
namespace { // local definitions
@ -139,11 +139,5 @@ namespace lumiera {
}
} // namespace query
Goal::~Goal() { }
} // namespace lumiera
} // namespace lib

View file

@ -25,266 +25,19 @@
#define LIB_QUERY_UTIL_H
#include "lib/bool-checkable.hpp"
#include "lib/typed-counter.hpp"
#include "lib/iter-adapter.hpp"
#include "lib/nocopy.hpp"
#include "lib/symbol.hpp"
#include "lib/util.hpp"
#include <boost/lexical_cast.hpp>
#include <tr1/memory>
#include <typeinfo>
#include <cctype>
#include <string>
namespace lib {
using lib::IxID;
using lib::Symbol;
using lib::Literal;
using util::unConst;
using boost::lexical_cast;
using std::string;
#ifdef false /////////////////////////////////////////////////////////////////////WIP
/* ==== common definitions for rule based queries ==== */
class Goal;
class Resolution;
class QueryResolver;
/** Allow for taking ownership of a result set */
typedef std::tr1::shared_ptr<Resolution> PReso;
/**
* Query ABC: unspecific goal for resolution or retrieval.
* Goal elements are used within the backbone of a generic query system
* to access individual resolution mechanisms based on an internal classification
* of the type of query.
*/
class Goal
: util::no_copy_by_client
{
public:
virtual ~Goal() ;
enum Kind
{ GENERIC = 0
, DISCOVERY
};
struct QueryID
{
Kind kind;
IxID type;
};
QueryID const&
getQID() const
{
return id_;
}
/**
* Single Solution, possibly part of a result set.
* A pointer-like object, usually to be down-casted
* to a specifically typed Query::Cursor
* @see Resolution
*/
class Result
: public lib::BoolCheckable<Result>
{
void* cur_;
protected:
void point_at(void* p) { cur_ = p; }
template<typename RES>
RES&
access()
{
REQUIRE (cur_);
return *reinterpret_cast<RES*> (cur_);
}
public:
bool isValid() const { return bool(cur_); }
Result() : cur_(0) { } ///< create an NIL result
};
protected:
QueryID id_;
Goal (QueryID qid)
: id_(qid)
{ }
};
inline bool
operator== (Goal::QueryID const& id1, Goal::QueryID const& id2)
{
return id1.kind == id2.kind
&& id1.type == id2.type;
}
inline bool
operator!= (Goal::QueryID const& id1, Goal::QueryID const& id2)
{
return ! (id1 == id2);
}
/** Context used for generating type-IDs to denote
* the specific result types of issued queries */
typedef lib::TypedContext<Goal::Result> ResultType;
template<typename RES>
inline IxID
getResultTypeID() ///< @return unique ID denoting result type RES
{
return ResultType::ID<RES>::get();
}
/**
* Generic interface to express a query
* for specifically typed result elements
* providing some capabilities or fulfilling
* some properties. This is a generic umbrella
* for several kinds of queries and provides a
* mechanism for uniform usage of various
* resolution mechanisms.
*
* Any query bears an internal type classification and can be
* represented in a common syntactical form based on predicate logic.
* Query instances are created by some facilities allowing to query for objects.
* These query providers \em do know the specific kind (type) of query to expose.
* While client code uses these queries only by reference, there is the possibility
* to involve a generic QueryResolver, which -- behind the scenes -- manages a registry
* of specific resolution mechanisms. This way, clients may retrieve a set of results,
* each representing a possible solution to the posed query.
*
* @note until really integrating a rules based system
* this is largely dummy placeholder implementation.
* Some more specific query resolvers are available already,
* so, depending on the circumstances the actual resolution might be
* substantial or just a fake.
* @warning especially the classical resolution-type queries are just
* faked and use the given query-string as-is, without any normalisation.
* Moreover, as especially the fake-configrules match by string comparison,
* this may led to unexpected mis-matches.
*/
template<class RES>
class Query
: public Goal
{
protected:
static QueryID
defineQueryTypeID (Kind queryType = Goal::GENERIC)
{
QueryID id = {queryType, getResultTypeID<RES>() };
return id;
}
class Builder;
public:
Query()
: Goal (defineQueryTypeID())
{ }
explicit
Query (string querySpec)
: Goal (defineQueryTypeID(Goal::GENERIC))
{
UNIMPLEMENTED("how to issue generic queries");////////////////////////////////////////////////////////////////////////////////////////////TODO
}
static Builder
build (Kind queryType = Goal::GENERIC);
/* results retrieval */
class Cursor
: public Goal::Result
{
public:
typedef RES value_type;
typedef RES& reference;
typedef RES* pointer;
RES& operator* () { return access<RES>(); }
RES* operator->() { return & access<RES>(); }
void point_at(RES* r){ Goal::Result::point_at(r);}
void point_at(RES& r){ Goal::Result::point_at(&r);}
};
typedef lib::IterAdapter<Cursor,PReso> iterator;
iterator operator() (QueryResolver const& resolver) const;
iterator resolveBy (QueryResolver const& resolver) const;
friend size_t
hash_value (Query const& q)
{
UNIMPLEMENTED("generic standard representation");////////////////////////////////////////////////////////////////////////////////////////////TODO
}
friend bool
operator== (Query const& q1, Query const& q2)
{
UNIMPLEMENTED("how to define equality on queries");////////////////////////////////////////////////////////////////////////////////////////////TODO
}
protected:
Query (QueryID qID)
: Goal (qID)
{ }
friend class Builder;
};
/**
* Helper for establishing,
* reworking and remolding queries.
*/
template<class RES>
class Query<RES>::Builder
{
string predicateForm_;
public:
const string
asKey() const
{
return "type("
+ lexical_cast<string> (getResultTypeID<RES>())
+ "), "+predicateForm_;
}
};
#endif /////////////////////////////////////////TODO

View file

@ -51,6 +51,7 @@
#include "proc/asset/struct-scheme.hpp"
#include "lib/query-util.hpp"
#include "lib/symbol.hpp"
#include "lib/error.hpp"
#include "lib/util.hpp"
@ -70,7 +71,7 @@ namespace asset {
using util::contains;
using lumiera::Query;
using lumiera::query::LUMIERA_ERROR_CAPABILITY_QUERY;
using lumiera::query::extractID;
using lib::query::extractID;
using proc::mobject::Session;
using proc::mobject::MObject;

View file

@ -29,6 +29,7 @@
#include "lib/util.hpp"
#include "lib/symbol.hpp"
#include "lib/query-util.hpp"
#include "include/logging.h"
#include "common/query.hpp"
@ -37,7 +38,7 @@
using boost::format;
using lib::Symbol;
using lumiera::query::normaliseID;
using lib::query::normaliseID;
using lumiera::query::QueryHandler;
using proc::ConfigResolver;

View file

@ -39,6 +39,8 @@
#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "lib/query-util.hpp"
#include "common/query/query-resolver.hpp"
#include "proc/mobject/mobject.hpp"
#include "proc/mobject/placement-ref.hpp"
#include "proc/mobject/output-designation.hpp"
@ -50,8 +52,8 @@
using lumiera::Symbol;
using lumiera::query::QueryHandler;
using lumiera::query::removeTerm;
using lumiera::query::extractID;
using lib::query::removeTerm;
using lib::query::extractID;
using proc::ConfigResolver;
using lib::HashVal;

View file

@ -27,9 +27,9 @@
#include "proc/mobject/session/track.hpp"
#include "proc/asset/procpatt.hpp"
#include "proc/asset/pipe.hpp"
#include "lib/query-util.hpp"
#include "common/query.hpp"
#include "include/logging.h"
#include "lib/symbol.hpp"
#include "lib/util.hpp"
@ -52,8 +52,8 @@ namespace session {
using asset::ProcPatt;
using asset::PProcPatt;
// using lumiera::query::extractID;
using lumiera::query::removeTerm;
// using lib::query::extractID;
using lib::query::removeTerm;
namespace {

View file

@ -42,6 +42,7 @@
#include "proc/mobject/session.hpp"
#include "proc/config-resolver.hpp"
#include "lib/query-util.hpp"
#include "lib/util.hpp"
#include "lib/p.hpp"
@ -67,8 +68,8 @@ namespace session {
using lib::P;
using lumiera::Query;
using lumiera::query::removeTerm; //////////////TODO better use Query::Builder
using lumiera::query::extractID; ///////////////TODO dto
using lib::query::removeTerm; //////////////TODO better use Query::Builder
using lib::query::extractID; ///////////////TODO dto
using lumiera::query::isFakeBypass; /////////TODO placeholder until there is a real resolution engine
using util::contains;

View file

@ -30,6 +30,7 @@
#include "proc/assetmanager.hpp"
#include "proc/mobject/session.hpp"
#include "proc/asset/asset-diagnostics.hpp"
#include "lib/query-util.hpp"
#include "common/query.hpp"
#include <boost/format.hpp>
@ -48,7 +49,7 @@ namespace test {
using mobject::Session;
using lumiera::Query;
using lumiera::query::normaliseID;
using lib::query::normaliseID;

View file

@ -31,6 +31,7 @@
#include "proc/assetmanager.hpp"
#include "proc/mobject/session.hpp"
#include "proc/streamtype.hpp"
#include "lib/query-util.hpp"
#include "common/query.hpp"
#include <boost/format.hpp>
@ -54,7 +55,7 @@ namespace test {
using lumiera::Query;
using lumiera::query::QueryHandler;
using lumiera::query::normaliseID;
using lib::query::normaliseID;
using proc::ConfigResolver;

View file

@ -24,6 +24,7 @@
#include "lib/test/run.hpp"
#include "lib/symbol.hpp"
#include "lib/util.hpp"
#include "lib/query-util.hpp"
#include "common/query.hpp"
#include "proc/asset.hpp"
@ -55,7 +56,7 @@ namespace test {
using asset::PPipe;
using asset::Struct;
using lumiera::Query;
using lumiera::query::normaliseID;
using lib::query::normaliseID;
/** shortcut: run just a query

View file

@ -87,6 +87,8 @@ namespace test {
}
using lib::query::test::garbage_query;

View file

@ -24,15 +24,13 @@
#include "lib/test/run.hpp"
#include "lib/util.hpp"
#include "lib/util-foreach.hpp"
#include "lib/query-util.hpp"
#include "lib/cmdline.hpp"
#include "common/query.hpp"
#include "query/querydiagnostics.hpp"
#include <tr1/functional>
#include <iostream>
using lumiera::Query;
using lib::Cmdline;
using util::isnil;
using util::contains;
@ -46,7 +44,7 @@ using std::endl;
namespace lumiera {
namespace lib {
namespace query {
namespace test{

View file

@ -21,8 +21,8 @@
*/
#ifndef LUMIERA_QUERY_TEST_QUERYDIAGNOSTICS_H
#define LUMIERA_QUERY_TEST_QUERYDIAGNOSTICS_H
#ifndef LIB_QUERY_TEST_QUERYDIAGNOSTICS_H
#define LIB_QUERY_TEST_QUERYDIAGNOSTICS_H
#include "lib/format-string.hpp"
@ -33,7 +33,7 @@ using std::rand;
namespace lumiera {
namespace lib {
namespace query{
namespace test {
@ -72,5 +72,5 @@ namespace test {
}}} // namespace lumiera::query::test
}}} // namespace lib::query::test
#endif

View file

@ -26,10 +26,10 @@
#include "common/subsys.hpp"
#include "common/subsystem-runner.hpp"
#include "common/option.hpp"
#include "common/query.hpp"
#include "lib/symbol.hpp"
#include "backend/thread-wrapper.hpp"
#include "lib/query-util.hpp"
#include "lib/error.hpp"
#include "lib/util.hpp"
#include "lib/sync.hpp"
@ -43,7 +43,7 @@ using util::isnil;
using util::cStr;
using test::Test;
using lib::Literal;
using lumiera::query::extractID;
using lib::query::extractID;
using backend::Thread;
@ -52,7 +52,7 @@ namespace test {
namespace { // private test classes and data...
using lumiera::query::extractID;
using lib::query::extractID;
/** limit for the randomly selected duration of
* subsystem's running phase (milliseconds) */