adjustments and stubbing to get it past the compiler
This commit is contained in:
parent
b5a7055f29
commit
dd8a88d095
46 changed files with 483 additions and 427 deletions
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "lib/error.hpp"
|
||||
#include "common/configrules.hpp"
|
||||
#include "common/query/fake-configrules.hpp"
|
||||
#include "proc/mobject/session/query/fake-configrules.hpp"
|
||||
|
||||
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ namespace lumiera {
|
|||
namespace {
|
||||
|
||||
/** type of the actual ConfigRules implementation to use */
|
||||
lib::singleton::UseSubclass<query::MockConfigRules> typeinfo;
|
||||
lib::singleton::UseSubclass<proc::mobject::session::query::MockConfigRules> typeinfo;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
** @see mobject::session::DefsManager
|
||||
** @see asset::StructFactory
|
||||
** @see fake-configrules.hpp currently used dummy-implementation
|
||||
** @see
|
||||
**
|
||||
*/
|
||||
|
||||
|
|
@ -98,6 +99,7 @@ namespace lumiera { ///////TODO: shouldn't that be namespace lib? or proc?
|
|||
|
||||
using lib::Symbol;
|
||||
using lib::Literal;
|
||||
using lib::Query;
|
||||
|
||||
/** placeholder definition for later.
|
||||
* @todo intention is to integrate with lib::Symbol
|
||||
|
|
|
|||
|
|
@ -228,7 +228,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ namespace lib {
|
|||
|
||||
/* generate vtables here... */
|
||||
|
||||
Goal::~Goal() { }
|
||||
|
||||
Resolution::~Resolution() { }
|
||||
|
||||
QueryResolver::~QueryResolver() { }
|
||||
|
|
@ -57,12 +55,14 @@ namespace lib {
|
|||
|
||||
/* == dispatch to resolve typed queries == */
|
||||
|
||||
using factory::BuildRefcountPtr;
|
||||
|
||||
/** factory used as dispatcher table
|
||||
* for resolving typed queries */
|
||||
typedef MultiFact< Resolution(Goal const&) // nominal signature of fabrication
|
||||
, Goal::QueryID // select resolution function by kind-of-Query
|
||||
, BuildRefcountPtr // wrapper: manage result set by smart-ptr
|
||||
> DispatcherTable; //
|
||||
typedef factory::MultiFact< Resolution(Goal const&) // nominal signature of fabrication
|
||||
, Goal::QueryID // select resolution function by kind-of-Query
|
||||
, BuildRefcountPtr // wrapper: manage result set by smart-ptr
|
||||
> DispatcherTable; //
|
||||
|
||||
struct QueryDispatcher
|
||||
: DispatcherTable
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
QUERY-RESOLVER.hpp - interface for discovering contents of a scope
|
||||
QUERY-RESOLVER.hpp - framework for resolving generic queries
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2009, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
|
@ -21,235 +21,41 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef PROC_MOBJECT_SESSION_QUERY_RESOLVER_H
|
||||
#define PROC_MOBJECT_SESSION_QUERY_RESOLVER_H
|
||||
#ifndef LIB_QUERY_RESOLVER_H
|
||||
#define LIB_QUERY_RESOLVER_H
|
||||
|
||||
//#include "proc/mobject/mobject.hpp"
|
||||
//#include "proc/mobject/placement.hpp"
|
||||
#include "lib/bool-checkable.hpp"
|
||||
#include "lib/typed-counter.hpp"
|
||||
#include "lib/query.hpp"
|
||||
#include "lib/iter-adapter.hpp"
|
||||
#include "lib/nocopy.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <tr1/functional>
|
||||
#include <tr1/memory>
|
||||
//#include <vector>
|
||||
#include <string>
|
||||
|
||||
//using std::vector;
|
||||
//using std::string;
|
||||
using std::tr1::function;
|
||||
|
||||
namespace lib {
|
||||
|
||||
using lib::IxID;
|
||||
using util::unConst;
|
||||
using boost::noncopyable;
|
||||
using boost::lexical_cast;
|
||||
using boost::scoped_ptr;
|
||||
using std::tr1::function;
|
||||
using std::string;
|
||||
|
||||
|
||||
class Goal;
|
||||
class Resolution;
|
||||
class QueryResolver;
|
||||
class QueryDispatcher;
|
||||
|
||||
/** Allow for taking ownership of a result set */
|
||||
typedef std::tr1::shared_ptr<Resolution> PReso;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TODO type comment
|
||||
* Query ABC
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TODO type comment
|
||||
* Concrete query to yield specifically typed result elements
|
||||
*/
|
||||
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())
|
||||
{ }
|
||||
|
||||
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;
|
||||
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* ABC denoting the result set
|
||||
* ABC representing the result set
|
||||
* of an individual query resolution
|
||||
*/
|
||||
class Resolution
|
||||
: noncopyable
|
||||
: boost::noncopyable
|
||||
{
|
||||
public:
|
||||
typedef Goal::Result Result;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Query - interface for capability queries
|
||||
Query - interface for generic queries
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
|
@ -40,7 +40,7 @@ using util::contains;
|
|||
using util::isnil;
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace lib {
|
||||
namespace query {
|
||||
|
||||
namespace { // local definitions
|
||||
|
|
@ -142,7 +142,9 @@ namespace lumiera {
|
|||
} // namespace query
|
||||
|
||||
|
||||
/** */
|
||||
|
||||
Goal::~Goal() { }
|
||||
|
||||
|
||||
|
||||
} // namespace lumiera
|
||||
} // namespace lib
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
QUERY.hpp - interface for capability queries
|
||||
QUERY.hpp - interface for generic queries
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
|
@ -21,63 +21,271 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef LUMIERA_QUERY_H
|
||||
#define LUMIERA_QUERY_H
|
||||
#ifndef LIB_QUERY_H
|
||||
#define LIB_QUERY_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
#include <typeinfo>
|
||||
|
||||
#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 lumiera {
|
||||
namespace lib {
|
||||
|
||||
using lib::IxID;
|
||||
using lib::Symbol;
|
||||
using lib::Literal;
|
||||
using util::unConst;
|
||||
using boost::lexical_cast;
|
||||
using std::string;
|
||||
|
||||
|
||||
/* ==== 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 query interface for retrieving objects
|
||||
* matching the given capability query
|
||||
* 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 a dummy placeholder implementation
|
||||
* based on a dressed-up std::string
|
||||
* @warning in this preliminary implementation, the
|
||||
* given query-string is used as-is, without any
|
||||
* normalisation. Moreover, as espeically the
|
||||
* fake-configrules match by string comparision,
|
||||
* 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.
|
||||
* @todo the »real thing« should be based on a
|
||||
* normalised syntax tree representation
|
||||
* of the atoms in the query.
|
||||
*/
|
||||
template<class OBJ>
|
||||
template<class RES>
|
||||
class Query
|
||||
: public Goal
|
||||
{
|
||||
std::string predicateForm_;
|
||||
|
||||
public:
|
||||
explicit Query (string const& predicate="")
|
||||
: predicateForm_(predicate)
|
||||
{ }
|
||||
|
||||
|
||||
void
|
||||
clear()
|
||||
protected:
|
||||
static QueryID
|
||||
defineQueryTypeID (Kind queryType = Goal::GENERIC)
|
||||
{
|
||||
predicateForm_.clear();
|
||||
QueryID id = {queryType, getResultTypeID<RES>() };
|
||||
return id;
|
||||
}
|
||||
|
||||
operator string() const { return predicateForm_; }
|
||||
class Builder;
|
||||
|
||||
// operator string& () { return predicateForm_; } //TICKET #710 : needed temporarily by fake-configrules
|
||||
}; // for calling removeTerm on the string-ref....
|
||||
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_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace query {
|
||||
|
|
|
|||
|
|
@ -58,9 +58,10 @@ namespace asset {
|
|||
|
||||
|
||||
PPipe
|
||||
Pipe::query (string properties)
|
||||
Pipe::query (Query<Pipe> const& properties)
|
||||
{
|
||||
return Struct::retrieve (Query<Pipe> (properties));
|
||||
UNIMPLEMENTED ("maybe provide a direct way to query, based on a predicate string?");//////////////////////////////////TODO
|
||||
return Struct::retrieve (properties);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "proc/asset/struct.hpp"
|
||||
#include "proc/asset/procpatt.hpp"
|
||||
#include "proc/streamtype.hpp"
|
||||
#include "lib/query.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -35,6 +36,7 @@
|
|||
namespace proc {
|
||||
namespace asset {
|
||||
|
||||
using lib::Query;
|
||||
using std::string;
|
||||
|
||||
class Pipe;
|
||||
|
|
@ -96,7 +98,7 @@ namespace asset {
|
|||
void switchProcPatt (PProcPatt& another);
|
||||
|
||||
/** convenience shortcut for retrieving default configured pipes */
|
||||
static PPipe query (string properties);
|
||||
static PPipe query (Query<Pipe> const& properties);
|
||||
|
||||
/** convenience shortcut for lookup by id */
|
||||
static PPipe lookup (ID<Pipe> id);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace asset {
|
|||
using util::isnil;
|
||||
using util::contains;
|
||||
using lumiera::query::LUMIERA_ERROR_CAPABILITY_QUERY;
|
||||
using lumiera::query::extractID;
|
||||
using lib::query::extractID;
|
||||
|
||||
using proc::mobject::Session;
|
||||
using proc::mobject::MObject;
|
||||
|
|
@ -113,9 +113,11 @@ namespace asset {
|
|||
createIdent (Query<STRU> const& query)
|
||||
{
|
||||
// does the query somehow specify the desired name-ID?
|
||||
string nameID = extractID (genericIdSymbol, query);
|
||||
string nameID = "TODO";//extractID (genericIdSymbol, query);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED("Query rebuilding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (isnil (nameID))
|
||||
nameID = extractID (StructTraits<STRU>::idSymbol(), query);
|
||||
nameID = "TODO";//extractID (StructTraits<STRU>::idSymbol(), query);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED("Query rebuilding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (isnil (nameID))
|
||||
{
|
||||
// no name-ID contained in the query...
|
||||
|
|
@ -127,7 +129,8 @@ namespace asset {
|
|||
ENSURE (!isnil (nameID));
|
||||
|
||||
// does the query actually demand the Nth instance/element?
|
||||
string seqID = extractID (seqNrPredicate, query);
|
||||
string seqID = "TODO";//extractID (seqNrPredicate, query);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED("Query rebuilding");////////////////////////////////////////////////////////////////////////////////////////////TODO)
|
||||
if (!isnil (seqID) && 1 < asNumber(seqID))
|
||||
nameID += "."+seqID;
|
||||
|
||||
|
|
@ -200,7 +203,8 @@ namespace asset {
|
|||
StructFactoryImpl::fabricate (Query<Pipe> const& caps)
|
||||
{
|
||||
const Asset::Ident idi (createIdent (caps));
|
||||
string streamID = extractID ("stream", caps);
|
||||
string streamID = "TODO";//extractID ("stream", caps);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED("fabricate a Pipe by query");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (isnil (streamID)) streamID = "default";
|
||||
PProcPatt processingPattern = Session::current->defaults (Query<const ProcPatt>("stream("+streamID+")"));
|
||||
return new Pipe( idi
|
||||
|
|
@ -215,7 +219,8 @@ namespace asset {
|
|||
{
|
||||
TODO ("extract additional properties/capabilities from the query...");
|
||||
const Asset::Ident idi (createIdent (caps));
|
||||
string sequenceID = extractID ("sequence", caps);
|
||||
string sequenceID = "TODO";//extractID ("sequence", caps);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED("fabricate a Timeline by query");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
Query<Sequence> desiredSequence (isnil (sequenceID)? "" : "id("+sequenceID+")");
|
||||
PSequence sequence = recursive_create_(desiredSequence);
|
||||
ASSERT (sequence);
|
||||
|
|
@ -232,7 +237,8 @@ namespace asset {
|
|||
{
|
||||
// when we reach this point it is clear a suitable sequence doesn't yet exist in the model
|
||||
TODO ("actually extract properties/capabilities from the query...");
|
||||
string trackID = extractID ("track", caps);
|
||||
string trackID = "TODO";//extractID ("track", caps);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED("fabricate a Sequence by query");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
Query<Track> desiredTrack (isnil (trackID)? "" : "id("+trackID+")");
|
||||
// PTrack track = Session::current->query (desiredTrack); ///////////////////////////////////TICKET #639
|
||||
// TODO: handle the following cases
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
using boost::format;
|
||||
|
||||
using lib::Symbol;
|
||||
using lumiera::query::normaliseID;
|
||||
using lib::query::normaliseID;
|
||||
using lumiera::query::QueryHandler;
|
||||
using lumiera::ConfigRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace asset {
|
|||
|
||||
using std::string;
|
||||
using boost::scoped_ptr;
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
using lib::Symbol;
|
||||
|
||||
class Struct;
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@
|
|||
#include <cstdlib>
|
||||
|
||||
using lumiera::query::QueryHandler;
|
||||
using lumiera::query::removeTerm;
|
||||
using lumiera::query::extractID;
|
||||
using lumiera::ConfigRules;
|
||||
using lumiera::Symbol;
|
||||
using lib::query::removeTerm;
|
||||
using lib::query::extractID;
|
||||
|
||||
namespace proc {
|
||||
namespace mobject {
|
||||
|
|
@ -179,7 +179,8 @@ namespace mobject {
|
|||
uint
|
||||
is_defaults_query_with_channel (Query<asset::Pipe> const& query4pipe)
|
||||
{
|
||||
string seqNr = extractID (SEQNR_PREDICATE, query4pipe);
|
||||
string seqNr = "TODO";//extractID (SEQNR_PREDICATE, query4pipe);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED ("Query remolding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return abs(std::atoi (seqNr.c_str())); // also 0 in case of an invalid number
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +188,8 @@ namespace mobject {
|
|||
build_corresponding_sourceQuery (Query<asset::Pipe> const& query4pipe)
|
||||
{
|
||||
Query<asset::Pipe> srcQuery = query4pipe;
|
||||
removeTerm (SEQNR_PREDICATE, srcQuery);
|
||||
// removeTerm (SEQNR_PREDICATE, srcQuery);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED ("Query remolding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return srcQuery;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ namespace mobject {
|
|||
}//(End) type rebinding helper
|
||||
|
||||
namespace error = lumiera::error;
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
using asset::HashVal;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -118,10 +118,11 @@ namespace session {
|
|||
return res;
|
||||
else
|
||||
res = create (capabilities); // not yet known as default, create new
|
||||
|
||||
|
||||
UNIMPLEMENTED("String representation of queries, here just for diagnostics");
|
||||
if (!res)
|
||||
throw lumiera::error::Config (_Fmt("The following Query could not be resolved: %s.")
|
||||
% capabilities.asKey()
|
||||
% "TODO"//capabilities.asKey()////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
, LUMIERA_ERROR_CAPABILITY_QUERY );
|
||||
else
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace session {
|
|||
|
||||
|
||||
using lib::P;
|
||||
using lib::Query;
|
||||
using boost::scoped_ptr;
|
||||
|
||||
namespace impl { class DefsRegistry; }
|
||||
|
|
@ -73,14 +74,14 @@ namespace session {
|
|||
* is considered \e misconfiguration.
|
||||
*/
|
||||
template<class TAR>
|
||||
P<TAR> operator() (lumiera::Query<TAR> const&);
|
||||
P<TAR> operator() (Query<TAR> const&);
|
||||
|
||||
|
||||
/** search through the registered defaults, never create anything.
|
||||
* @return object fulfilling the query, \c empty ptr if not found.
|
||||
*/
|
||||
template<class TAR>
|
||||
P<TAR> search (lumiera::Query<TAR> const&);
|
||||
P<TAR> search (Query<TAR> const&);
|
||||
|
||||
/** retrieve an object fulfilling the query and register it as default.
|
||||
* The resolution is delegated to the ConfigQuery system (which may cause
|
||||
|
|
@ -88,7 +89,7 @@ namespace session {
|
|||
* @return object fulfilling the query, \c empty ptr if no solution.
|
||||
*/
|
||||
template<class TAR>
|
||||
P<TAR> create (lumiera::Query<TAR> const&);
|
||||
P<TAR> create (Query<TAR> const&);
|
||||
|
||||
/** register the given object as default, after ensuring it fulfils the
|
||||
* query. The latter may cause some properties of the object to be set,
|
||||
|
|
@ -97,7 +98,7 @@ namespace session {
|
|||
* @note only a weak ref to the object is stored
|
||||
*/
|
||||
template<class TAR>
|
||||
bool define (P<TAR> const&, lumiera::Query<TAR> const& =lumiera::Query<TAR>());
|
||||
bool define (P<TAR> const&, Query<TAR> const& =Query<TAR>());
|
||||
|
||||
/** remove the defaults registration of the given object, if there was such
|
||||
* @return false if nothing has been changed because the object wasn't registered
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace mobject {
|
|||
namespace session {
|
||||
|
||||
using lib::P;
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
using lib::ClassLock;
|
||||
using std::tr1::weak_ptr;
|
||||
|
||||
|
|
@ -97,10 +97,12 @@ namespace session {
|
|||
weak_ptr<TAR> objRef;
|
||||
|
||||
Record (const Query<TAR>& q, const P<TAR>& obj)
|
||||
: degree (lumiera::query::countPred (q)),
|
||||
: degree (lib::query::countPred ("TODO")),//q)),////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
query (q),
|
||||
objRef (obj)
|
||||
{ }
|
||||
{
|
||||
UNIMPLEMENTED("Query remolding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
}
|
||||
|
||||
|
||||
struct Search ///< Functor searching for a specific object
|
||||
|
|
@ -123,8 +125,9 @@ namespace session {
|
|||
inline bool
|
||||
operator() (Record one, Record two) ///< @note doesn't touch the objRef
|
||||
{
|
||||
UNIMPLEMENTED ("arbitrary total ordering of queries");
|
||||
return ( one.degree < two.degree
|
||||
||(one.degree == two.degree && one.query < two.query)
|
||||
||(one.degree == two.degree && false)//one.query < two.query)////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace session {
|
|||
LocatingPin::LocatingSolution::getPipe()
|
||||
{
|
||||
TODO ("implement Placement LocatingSolution");
|
||||
return asset::Pipe::query ("pipe(master)"); // yet another idiotic dummy
|
||||
return asset::Pipe::query (lib::Query<asset::Pipe>("pipe(master)")); // yet another idiotic dummy
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ namespace session {
|
|||
|
||||
using boost::scoped_ptr;
|
||||
|
||||
using lib::Goal;
|
||||
using lib::Query;
|
||||
using lib::Resolution;
|
||||
using lib::getResultTypeID;
|
||||
|
||||
|
||||
typedef PlacementIndex::ID PID;
|
||||
|
|
@ -190,7 +194,7 @@ namespace session {
|
|||
* there is a smart-ptr managing this ResultSet.
|
||||
*/
|
||||
class ResultSet
|
||||
: public Resolution
|
||||
: public lib::Resolution
|
||||
{
|
||||
ContentFilter acceptable_;
|
||||
ExplorerBuilder buildExploartion_;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace session {
|
|||
* * more generally, any ScopeQuery with these properties, in some variations
|
||||
*/
|
||||
class PlacementIndexQueryResolver
|
||||
: public session::QueryResolver
|
||||
: public lib::QueryResolver
|
||||
{
|
||||
|
||||
function<IndexLink> _getIndex;
|
||||
|
|
@ -106,7 +106,7 @@ namespace session {
|
|||
void defineHandling();
|
||||
|
||||
template<typename MO>
|
||||
Resolution* resolutionFunction (Goal const& goal);
|
||||
lib::Resolution* resolutionFunction (Goal const& goal);
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
* *****************************************************/
|
||||
|
||||
|
||||
#include "common/query/fake-configrules.hpp"
|
||||
#include "proc/mobject/session/query/fake-configrules.hpp"
|
||||
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/track.hpp"
|
||||
|
|
@ -31,13 +31,17 @@
|
|||
|
||||
|
||||
#include "include/logging.h"
|
||||
#include "lib/symbol.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
using lib::Literal;
|
||||
using util::isnil;
|
||||
|
||||
//////////////////////////////////////////////////////////////////TICKET #710 : to be removed entirely in Alpha
|
||||
|
||||
namespace lumiera {
|
||||
namespace proc {
|
||||
namespace mobject {
|
||||
namespace session {
|
||||
|
||||
namespace query {
|
||||
|
||||
|
|
@ -49,7 +53,7 @@ namespace lumiera {
|
|||
using asset::PProcPatt;
|
||||
|
||||
// using lumiera::query::extractID;
|
||||
using lumiera::query::removeTerm;
|
||||
using lib::query::removeTerm;
|
||||
|
||||
|
||||
namespace {
|
||||
|
|
@ -58,9 +62,10 @@ namespace lumiera {
|
|||
|
||||
/** helper to simplify creating mock table entries, wrapped correctly */
|
||||
template<class TY>
|
||||
AnyPair entry (const string& query, typename WrapReturn<TY>::Wrapper& obj)
|
||||
AnyPair entry (Query<TY> const& query, typename WrapReturn<TY>::Wrapper& obj)
|
||||
{
|
||||
return AnyPair ( Query<TY> (query).asKey()
|
||||
UNIMPLEMENTED ("generic query-key");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return AnyPair ( "TODO"//Query<TY> (query).asKey()////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
, any(obj));
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +78,8 @@ namespace lumiera {
|
|||
string capabilities (caps);
|
||||
Query<STRU> query (capabilities);
|
||||
Ptr obj = Struct::retrieve (query);
|
||||
return AnyPair(query.asKey(), obj);
|
||||
UNIMPLEMENTED("generic query-key");
|
||||
// return AnyPair(query.asKey(), obj);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
}
|
||||
|
||||
/** shortcut for simply accessing a table entry */
|
||||
|
|
@ -81,7 +87,8 @@ namespace lumiera {
|
|||
any&
|
||||
item (PTAB& table, const string& query)
|
||||
{
|
||||
return (*table)[Query<STRU>(query).asKey()];
|
||||
UNIMPLEMENTED ("generic Query-key");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
//return (*table)[Query<STRU>(query).asKey()];////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -162,13 +169,14 @@ namespace lumiera {
|
|||
{
|
||||
typedef asset::Timeline aTl;
|
||||
typedef WrapReturn<aTl>::Wrapper Ptr;
|
||||
|
||||
string nameID = removeTerm ("id", query);
|
||||
|
||||
UNIMPLEMENTED ("generic query remolding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
string nameID = "TODO";//removeTerm ("id", query);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (isnil (nameID))
|
||||
nameID = removeTerm ("timeline", query);
|
||||
nameID = "TODO";//removeTerm ("timeline", query);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (isnil (nameID))
|
||||
nameID = "prime";
|
||||
query.insert (0, "id("+nameID+"), ");
|
||||
// query.insert (0, "id("+nameID+"), ");
|
||||
|
||||
// try to find an existing one with the desired id
|
||||
Ptr newTimeline;
|
||||
|
|
@ -193,13 +201,14 @@ namespace lumiera {
|
|||
{
|
||||
typedef asset::Sequence aSq;
|
||||
typedef WrapReturn<aSq>::Wrapper Ptr;
|
||||
|
||||
string nameID = removeTerm ("id", query);
|
||||
|
||||
UNIMPLEMENTED ("generic Query remolding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
string nameID = "TODO";//removeTerm ("id", query);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (isnil (nameID))
|
||||
nameID = removeTerm ("sequence", query);
|
||||
nameID = "TODO";//removeTerm ("sequence", query);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (isnil (nameID))
|
||||
nameID = "first";
|
||||
query.insert (0, "id("+nameID+"), ");
|
||||
// query.insert (0, "id("+nameID+"), ");
|
||||
|
||||
// try to find an existing sequence with the desired id
|
||||
Ptr newSequence;
|
||||
|
|
@ -224,7 +233,8 @@ namespace lumiera {
|
|||
bool
|
||||
MockTable::set_new_mock_solution (Query<TY>& q, typename WrapReturn<TY>::Wrapper& obj)
|
||||
{
|
||||
answer_->erase (q.asKey());
|
||||
UNIMPLEMENTED ("generic query-key");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
// answer_->erase (q.asKey());////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
answer_->insert (entry<TY> (q, obj));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -275,5 +285,4 @@ namespace lumiera {
|
|||
|
||||
|
||||
} // namespace query
|
||||
|
||||
} // namespace lumiera
|
||||
}}} // namespace proc::mobject::session
|
||||
|
|
@ -37,8 +37,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef LUMIERA_FAKECONFIGRULES_H
|
||||
#define LUMIERA_FAKECONFIGRULES_H
|
||||
#ifndef MOBJECT_SESSION_QUERY_FAKECONFIGRULES_H
|
||||
#define MOBJECT_SESSION_QUERY_FAKECONFIGRULES_H
|
||||
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "common/configrules.hpp"
|
||||
|
|
@ -51,7 +51,9 @@
|
|||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace proc {
|
||||
namespace mobject {
|
||||
namespace session {
|
||||
namespace query {
|
||||
|
||||
namespace asset = proc::asset;
|
||||
|
|
@ -62,6 +64,11 @@ namespace lumiera {
|
|||
using proc::mobject::Session;
|
||||
using lib::meta::InstantiateChained;
|
||||
|
||||
using lib::Query;
|
||||
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;
|
||||
using util::isnil;
|
||||
|
||||
|
|
@ -144,7 +151,7 @@ namespace lumiera {
|
|||
virtual bool
|
||||
resolve (Ret& solution, Query<TY> const& q)
|
||||
{
|
||||
const any& entry = this->fetch_from_table_for (q.asKey());
|
||||
const any& entry = this->fetch_from_table_for ("TODO");//q.asKey());////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (!isnil (entry))
|
||||
{
|
||||
Ret const& candidate (any_cast<Ret const&> (entry));
|
||||
|
|
@ -160,10 +167,10 @@ namespace lumiera {
|
|||
bool
|
||||
try_special_case (Ret& solution, Query<TY> const& q)
|
||||
{
|
||||
if (solution && isFakeBypass(q)) // backdoor for tests
|
||||
if (true)//solution && isFakeBypass(q)) // backdoor for tests////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return solution;
|
||||
|
||||
string querySpec (q);
|
||||
string querySpec ;//(q);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
if (treat_as_defaults_query (querySpec))
|
||||
{
|
||||
Query<TY> defaultsQuery(querySpec);
|
||||
|
|
@ -184,19 +191,19 @@ namespace lumiera {
|
|||
inline bool
|
||||
MockTable::detect_case (typename WrapReturn<TY>::Wrapper&, Query<TY>& q)
|
||||
{
|
||||
q.clear(); // end recursion
|
||||
// q.clear(); // end recursion////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return false;
|
||||
}
|
||||
template<>
|
||||
inline bool
|
||||
MockTable::detect_case (WrapReturn<Pipe>::Wrapper& candidate, Query<Pipe>& q)
|
||||
{
|
||||
if (!isnil (extractID("make", q)))
|
||||
if (true)//!isnil (extractID("make", q)))////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
// used by tests to force fabrication of a new "solution"
|
||||
return fabricate_just_new_Pipe (q);
|
||||
|
||||
const string pipeID = extractID("pipe", q);
|
||||
const string streamID = extractID("stream", q);
|
||||
const string pipeID = "TODO";//extractID("pipe", q);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
const string streamID = "TODO";//extractID("stream", q);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
|
||||
if (candidate && pipeID == candidate->getPipeID())
|
||||
return set_new_mock_solution (q, candidate); // "learn" this solution to be "valid"
|
||||
|
|
@ -207,19 +214,19 @@ namespace lumiera {
|
|||
if (!candidate && (!isnil(streamID) || !isnil(pipeID)))
|
||||
return fabricate_just_new_Pipe (q);
|
||||
|
||||
q.clear();
|
||||
// q.clear();////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return false;
|
||||
}
|
||||
template<>
|
||||
inline bool
|
||||
MockTable::detect_case (WrapReturn<const ProcPatt>::Wrapper& candidate, Query<const ProcPatt>& q)
|
||||
{
|
||||
const string streamID = extractID("stream", q);
|
||||
const string streamID = "TODO";//extractID("stream", q);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
|
||||
if (!candidate && !isnil(streamID))
|
||||
return fabricate_ProcPatt_on_demand (q);
|
||||
|
||||
q.clear();
|
||||
// q.clear();////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return false;
|
||||
}
|
||||
template<>
|
||||
|
|
@ -229,7 +236,7 @@ namespace lumiera {
|
|||
if (!candidate)
|
||||
return fabricate_Timeline_on_demand (q);
|
||||
|
||||
q.clear();
|
||||
// q.clear();////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return bool(candidate);
|
||||
}
|
||||
template<>
|
||||
|
|
@ -239,7 +246,7 @@ namespace lumiera {
|
|||
if (!candidate)
|
||||
return fabricate_Sequence_on_demand (q);
|
||||
|
||||
q.clear();
|
||||
// q.clear();////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
return bool(candidate);
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +261,7 @@ namespace lumiera {
|
|||
* values for some types of interest for testing and debugging.
|
||||
*/
|
||||
class MockConfigRules
|
||||
: public InstantiateChained < InterfaceTypes
|
||||
: public InstantiateChained < lumiera::InterfaceTypes
|
||||
, LookupPreconfigured // building block used for each of the types
|
||||
, MockTable // for implementing the base class (interface)
|
||||
>
|
||||
|
|
@ -272,6 +279,6 @@ namespace lumiera {
|
|||
|
||||
|
||||
|
||||
|
||||
}} // namespace lumiera::query
|
||||
} // namespace query
|
||||
}}} // namespace proc::mobject::session
|
||||
#endif
|
||||
|
|
@ -97,7 +97,7 @@ namespace session {
|
|||
friend class lib::singleton::StaticCreate<ScopeLocator>;
|
||||
|
||||
private:
|
||||
QueryResolver const& theResolver();
|
||||
lib::QueryResolver const& theResolver();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ namespace session {
|
|||
using std::tr1::function;
|
||||
using std::tr1::placeholders::_1;
|
||||
|
||||
using lib::Goal;
|
||||
using lib::Query;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace session {
|
|||
* of contents discovery queries to the PlacementIndex
|
||||
* managed within the session
|
||||
*/
|
||||
QueryResolver const&
|
||||
lib::QueryResolver const&
|
||||
ScopeLocator::theResolver()
|
||||
{
|
||||
return SessionServiceExploreScope::getResolver();
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ namespace session {
|
|||
REQUIRE (0 == session_->timelines.size(), "injecting default timeline, but session isn't pristine");
|
||||
|
||||
// issue a default query to retrieve or create a Timeline and a default Sequence
|
||||
asset::PTimeline initialTimeline = session_->defaults (lumiera::Query<asset::Timeline> ());
|
||||
asset::PTimeline initialTimeline = session_->defaults (lib::Query<asset::Timeline> ());
|
||||
|
||||
// these got registered automatically
|
||||
ENSURE (1 == session_->timelines.size());
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace session {
|
|||
*/
|
||||
struct SessionServiceExploreScope
|
||||
{
|
||||
static QueryResolver const& getResolver();
|
||||
static lib::QueryResolver const& getResolver();
|
||||
|
||||
static PlacementMO& getScope (PlacementMO const&);
|
||||
static PlacementMO& getScope (PlacementMO::ID const&);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ namespace session {
|
|||
|
||||
using std::tr1::function;
|
||||
|
||||
using lib::QueryResolver;
|
||||
|
||||
|
||||
/**
|
||||
* Specialised version of the ContentsQuery to pick some objects
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ namespace play {
|
|||
using asset::PTimeline;
|
||||
using mobject::ModelPort;
|
||||
using mobject::builder::ModelPortRegistry;
|
||||
using lumiera::Query;
|
||||
using util::contains;
|
||||
using lib::Query;
|
||||
// using lib::ScopedCollection;
|
||||
// using lib::Literal;
|
||||
using lib::eachEntry;
|
||||
|
|
@ -139,7 +139,7 @@ namespace play {
|
|||
inline PID
|
||||
getPipe (string id)
|
||||
{
|
||||
return Pipe::query("id("+id+")");
|
||||
return Pipe::query (Query<Pipe> ("id("+id+")"));
|
||||
}
|
||||
|
||||
inline TID
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ namespace asset {
|
|||
namespace test {
|
||||
|
||||
using mobject::Session;
|
||||
using lumiera::Query;
|
||||
using lumiera::query::normaliseID;
|
||||
using lib::Query;
|
||||
using lib::query::normaliseID;
|
||||
|
||||
|
||||
|
||||
|
|
@ -107,19 +107,19 @@ namespace test {
|
|||
{
|
||||
normaliseID (pID);
|
||||
|
||||
PPipe pipe1 = Pipe::query ("pipe("+pID+")");
|
||||
PPipe pipe1 = Pipe::query (Query<Pipe> ("pipe("+pID+")"));
|
||||
CHECK (pipe1);
|
||||
CHECK (pipe1->getPipeID() == pID);
|
||||
|
||||
string pID2 = "another-" + pID;
|
||||
PPipe pipe2 = Pipe::query ("pipe("+pID2+")");
|
||||
PPipe pipe2 = Pipe::query (Query<Pipe> ("pipe("+pID2+")"));
|
||||
CHECK (pipe2);
|
||||
CHECK (pipe2 != pipe1);
|
||||
Category c1 = pipe1->ident.category;
|
||||
Category c2 = pipe2->ident.category;
|
||||
CHECK (c1 == c2);
|
||||
|
||||
PPipe pipe3 = Pipe::query ("pipe("+pID2+")");
|
||||
PPipe pipe3 = Pipe::query (Query<Pipe> ("pipe("+pID2+")"));
|
||||
//////////////////////////////////////////////////////////////TODO: that's broken; creating a new one instead to find the existing one, as it should be
|
||||
CHECK (pipe3 == pipe2);
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ namespace test {
|
|||
|
||||
void create_using_default()
|
||||
{
|
||||
PPipe pipe1 = Pipe::query (""); // "the default pipe"
|
||||
PPipe pipe1 = Pipe::query (Query<Pipe>("")); // "the default pipe"
|
||||
PPipe pipe2;
|
||||
CHECK (pipe1);
|
||||
CHECK (pipe1 == Session::current->defaults (Query<Pipe>()));
|
||||
|
|
@ -145,7 +145,7 @@ namespace test {
|
|||
CHECK (pipe2 == pipe1);
|
||||
|
||||
string sID = pipe1->getStreamID(); // sort of a "default stream type"
|
||||
PPipe pipe3 = Pipe::query ("stream("+sID+")");
|
||||
PPipe pipe3 = Pipe::query (Query<Pipe> ("stream("+sID+")"));
|
||||
CHECK (pipe3);
|
||||
CHECK (pipe3->getStreamID() == StreamType::ID(sID));
|
||||
CHECK (pipe3->getProcPatt() == Session::current->defaults (Query<const ProcPatt>("stream("+sID+")")));
|
||||
|
|
@ -157,7 +157,7 @@ namespace test {
|
|||
typedef P<Pipe> PPipe; /////TODO: transition to P<>
|
||||
typedef P<const ProcPatt> PProcPatt;
|
||||
|
||||
PPipe thePipe = Pipe::query ("pipe("+pID+")");
|
||||
PPipe thePipe = Pipe::query (Query<Pipe> ("pipe("+pID+")"));
|
||||
CHECK (thePipe);
|
||||
PProcPatt thePatt = thePipe->getProcPatt();
|
||||
CHECK (thePatt);
|
||||
|
|
@ -171,7 +171,7 @@ namespace test {
|
|||
// now querying for a pipe using this pattern (created on-the-fly)
|
||||
// note: because the pattern is new, this new pipe will be used as
|
||||
// default pipe for this pattern automatically
|
||||
PPipe pipe2x = Pipe::query ("pattern(another)");
|
||||
PPipe pipe2x = Pipe::query (Query<Pipe> ("pattern(another)"));
|
||||
CHECK (pattern2 == pipe2x->getProcPatt());
|
||||
CHECK (pipe2x == Session::current->defaults (Query<Pipe>("pattern(another)")));
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ namespace test {
|
|||
CHECK (thePipe->getProcPatt());
|
||||
CHECK ( pattern3 == pattern2); // but is still valid, as long as the ref is alive....
|
||||
|
||||
PPipe pipe3x = Pipe::query ("pattern(another)");
|
||||
PPipe pipe3x = Pipe::query (Query<Pipe> ("pattern(another)"));
|
||||
pattern3 = pipe3x->getProcPatt(); /////TODO: transition to P<>
|
||||
CHECK (pattern3 != pattern2); // because pattern2 is already unlinked...
|
||||
CHECK (pipe3x == Session::current->defaults (Query<Pipe>("pattern(another)")));
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace test {
|
|||
EngineService& engine = EngineService::instance();
|
||||
EngineDiagnostics monitor(engine);
|
||||
|
||||
PID pipe = Pipe::query("id(dummy)");
|
||||
PID pipe = Pipe::query(lib::Query<Pipe> ("id(dummy)"));
|
||||
ModelPort port(pipe);
|
||||
|
||||
OutputSlot& oSlot = DiagnosticOutputSlot::build();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace test {
|
|||
using asset::Struct;
|
||||
using asset::Timeline;
|
||||
using asset::PTimeline;
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
//
|
||||
typedef asset::ID<Pipe> PID;
|
||||
typedef asset::ID<Struct> TID;
|
||||
|
|
@ -56,7 +56,7 @@ namespace test {
|
|||
inline PID
|
||||
getPipe (string id)
|
||||
{
|
||||
return Pipe::query("id("+id+")");
|
||||
return Pipe::query (Query<Pipe> ("id("+id+")"));
|
||||
}
|
||||
|
||||
inline TID
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace test {
|
|||
using asset::Struct;
|
||||
using asset::Timeline;
|
||||
using asset::PTimeline;
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
|
||||
typedef asset::ID<Pipe> PID;
|
||||
typedef asset::ID<Struct> TID;
|
||||
|
|
@ -56,7 +56,7 @@ namespace test {
|
|||
inline PID
|
||||
getPipe (string id)
|
||||
{
|
||||
return Pipe::query("id("+id+")");
|
||||
return Pipe::query (Query<Pipe> ("id("+id+")"));
|
||||
}
|
||||
|
||||
inline TID
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace test {
|
|||
using asset::Struct;
|
||||
using asset::Timeline;
|
||||
using asset::PTimeline;
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
//
|
||||
typedef asset::ID<Pipe> PID;
|
||||
typedef asset::ID<Struct> TID;
|
||||
|
|
@ -56,7 +56,7 @@ namespace test {
|
|||
inline PID
|
||||
getPipe (string id)
|
||||
{
|
||||
return Pipe::query("id("+id+")");
|
||||
return Pipe::query (Query<Pipe> ("id("+id+")"));
|
||||
}
|
||||
|
||||
inline TID
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ namespace test {
|
|||
Mapping map;
|
||||
CHECK (isnil (map));
|
||||
|
||||
PPipe p1 = Pipe::query("id(hairy)");
|
||||
PPipe p2 = Pipe::query("id(furry)");
|
||||
PPipe pX = Pipe::query("id(curly)");
|
||||
PPipe p1 = Pipe::query(Query<Pipe> ("id(hairy)"));
|
||||
PPipe p2 = Pipe::query(Query<Pipe> ("id(furry)"));
|
||||
PPipe pX = Pipe::query(Query<Pipe> ("id(curly)"));
|
||||
|
||||
map[p1] = p2;
|
||||
CHECK (!isnil (map));
|
||||
|
|
@ -125,9 +125,9 @@ namespace test {
|
|||
{
|
||||
Mapping m1;
|
||||
|
||||
PPipe p1 = Pipe::query("id(hairy)");
|
||||
PPipe p2 = Pipe::query("id(furry)");
|
||||
PPipe pi = Pipe::query("id(nappy)");
|
||||
PPipe p1 = Pipe::query(Query<Pipe> ("id(hairy)"));
|
||||
PPipe p2 = Pipe::query(Query<Pipe> ("id(furry)"));
|
||||
PPipe pi = Pipe::query(Query<Pipe> ("id(nappy)"));
|
||||
|
||||
m1[pi] = p1;
|
||||
Mapping m2(m1);
|
||||
|
|
@ -158,8 +158,8 @@ namespace test {
|
|||
Mapping map;
|
||||
CHECK (isnil (map));
|
||||
|
||||
PPipe p1 = Pipe::query("stream(hairy)");
|
||||
PPipe p2 = Pipe::query("stream(furry)");
|
||||
PPipe p1 = Pipe::query(Query<Pipe> ("stream(hairy)"));
|
||||
PPipe p2 = Pipe::query(Query<Pipe> ("stream(furry)"));
|
||||
|
||||
CHECK (map[p1] == "master_hairy");
|
||||
CHECK (map[p2] == "master_furry");
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@ namespace session {
|
|||
namespace test {
|
||||
|
||||
using lib::Symbol;
|
||||
using lib::Query;
|
||||
using lib::query::normaliseID;
|
||||
using asset::Asset;
|
||||
using asset::AssetManager;
|
||||
using asset::Pipe;
|
||||
using asset::PPipe;
|
||||
using asset::Struct;
|
||||
using lumiera::Query;
|
||||
using lumiera::query::normaliseID;
|
||||
|
||||
using lumiera::ConfigRules;
|
||||
using lumiera::query::QueryHandler;
|
||||
|
|
@ -154,7 +154,7 @@ lumiera::query::setFakeBypass("stream("+sID+")"); //////////////////////////////
|
|||
void
|
||||
forget (string pID)
|
||||
{
|
||||
PPipe pipe = Pipe::query ("pipe("+pID+")");
|
||||
PPipe pipe = Pipe::query (Query<Pipe> ("pipe("+pID+")"));
|
||||
REQUIRE (find (pipe->getPipeID()), "test assumes pre-registered default pipe");
|
||||
long cnt = pipe.use_count();
|
||||
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ namespace test {
|
|||
using asset::Pipe;
|
||||
using asset::PPipe;
|
||||
using asset::Struct;
|
||||
using lumiera::Query;
|
||||
using lumiera::query::normaliseID;
|
||||
using lib::Query;
|
||||
using lib::query::normaliseID;
|
||||
|
||||
|
||||
/** shortcut: run just a query
|
||||
|
|
@ -103,13 +103,13 @@ namespace test {
|
|||
void
|
||||
retrieveSimpleDefault (string)
|
||||
{
|
||||
PPipe pipe1 = Pipe::query (""); // "the default pipe"
|
||||
PPipe pipe1 = Pipe::query (Query<Pipe> ("")); // "the default pipe"
|
||||
PPipe pipe2;
|
||||
|
||||
// several variants to query for "the default pipe"
|
||||
pipe2 = Pipe::query ("");
|
||||
pipe2 = Pipe::query (Query<Pipe> (""));
|
||||
CHECK (pipe2 == pipe1);
|
||||
pipe2 = Pipe::query ("default(X)");
|
||||
pipe2 = Pipe::query (Query<Pipe> ("default(X)"));
|
||||
CHECK (pipe2 == pipe1);
|
||||
pipe2 = Session::current->defaults(Query<Pipe> ());
|
||||
CHECK (pipe2 == pipe1);
|
||||
|
|
@ -123,7 +123,7 @@ namespace test {
|
|||
void
|
||||
retrieveConstrainedDefault (string pID, string sID)
|
||||
{
|
||||
PPipe pipe1 = Pipe::query (""); // "the default pipe"
|
||||
PPipe pipe1 = Pipe::query (Query<Pipe> ("")); // "the default pipe"
|
||||
CHECK ( pipe1->getStreamID() != StreamType::ID(sID),
|
||||
"stream-ID \"%s\" not suitable for test, because "
|
||||
"the default-pipe \"%s\" happens to have the same "
|
||||
|
|
@ -132,10 +132,10 @@ namespace test {
|
|||
);
|
||||
|
||||
string query_for_sID ("stream("+sID+")");
|
||||
PPipe pipe2 = Pipe::query (query_for_sID);
|
||||
PPipe pipe2 = Pipe::query (Query<Pipe> (query_for_sID));
|
||||
CHECK (pipe2->getStreamID() == StreamType::ID(sID));
|
||||
CHECK (pipe2 != pipe1);
|
||||
CHECK (pipe2 == Pipe::query (query_for_sID)); // reproducible
|
||||
CHECK (pipe2 == Pipe::query (Query<Pipe> (query_for_sID))); // reproducible
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
#include <boost/format.hpp>
|
||||
#include <map>
|
||||
|
||||
using lumiera::Query;
|
||||
using lumiera::query::test::garbage_query;
|
||||
using lib::Query;
|
||||
using lib::query::test::garbage_query;
|
||||
using util::isnil;
|
||||
using lib::P;
|
||||
|
||||
|
|
@ -165,9 +165,11 @@ namespace test {
|
|||
{
|
||||
Prd px (fabricate<23>());
|
||||
Q23 qx (garbage_query());
|
||||
ps[qx] = px;
|
||||
UNIMPLEMENTED ("generic query key and ordering for map access");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
// ps[qx] = px;
|
||||
reg_->put (px, qx);
|
||||
px->instanceID = qx;
|
||||
UNIMPLEMENTED ("Query building from predicate string");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
// px->instanceID = qx;////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,8 +215,10 @@ namespace test {
|
|||
{
|
||||
CHECK ( *j );
|
||||
Q23 qx ((*j)->instanceID);
|
||||
CHECK ( ps[qx] == (*j));
|
||||
d = lumiera::query::countPred (qx);
|
||||
UNIMPLEMENTED ("generic query key and ordering for map access");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
// CHECK ( ps[qx] == (*j));////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
UNIMPLEMENTED ("Query remolding");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
// d = lib::query::countPred (qx);////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
CHECK ( d_prev <= d );
|
||||
d_prev = d;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace mobject {
|
|||
namespace session {
|
||||
namespace test {
|
||||
|
||||
using lib::QueryResolver;
|
||||
using session::PathQuery;
|
||||
using session::ContentsQuery;
|
||||
using util::isSameObject;
|
||||
|
|
|
|||
|
|
@ -31,10 +31,8 @@
|
|||
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace mobject {
|
||||
namespace session {
|
||||
namespace test {
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
using lib::test::showSizeof;
|
||||
using std::string;
|
||||
|
|
@ -223,4 +221,4 @@ namespace test {
|
|||
LAUNCHER (QueryResolver_test, "unit session");
|
||||
|
||||
|
||||
}}}} // namespace proc::mobject::session::test
|
||||
}} // namespace lib::test
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace test {
|
|||
|
||||
|
||||
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
using asset::Timeline;
|
||||
using asset::PTimeline;
|
||||
using asset::AssetManager;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace test {
|
|||
using asset::PSequence;
|
||||
using asset::Sequence;
|
||||
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
|
||||
typedef MORef<session::Clip> RClip;
|
||||
typedef PlacementMO::ID PID;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace test {
|
|||
using asset::PSequence;
|
||||
using asset::Pipe;
|
||||
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include <tr1/functional>
|
||||
#include <iostream>
|
||||
|
||||
using lumiera::Query;
|
||||
using lib::Query;
|
||||
using lib::Cmdline;
|
||||
using util::isnil;
|
||||
using util::contains;
|
||||
|
|
@ -46,7 +46,7 @@ using std::endl;
|
|||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace lib {
|
||||
namespace query {
|
||||
namespace test{
|
||||
|
||||
|
|
@ -83,7 +83,8 @@ namespace test{
|
|||
void
|
||||
check_Query ()
|
||||
{
|
||||
cout << Query<Thing> ("I am writing a test sentence.").asKey() << endl;
|
||||
UNIMPLEMENTED ("generate a generic query key");////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
// cout << Query<Thing> ("I am writing a test sentence.").asKey() << endl;////////////////////////////////////////////////////////////////////////////////////////////TODO
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -166,4 +167,4 @@ namespace test{
|
|||
|
||||
|
||||
|
||||
}}} // namespace lumiera::query::test
|
||||
}}} // namespace lib::query::test
|
||||
|
|
|
|||
|
|
@ -21,65 +21,56 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef LUMIERA_TEST_QUERY_QUERYDIAGNOSTICS_H
|
||||
#define LUMIERA_TEST_QUERY_QUERYDIAGNOSTICS_H
|
||||
#ifndef LIB_QUERY_TEST_QUERYDIAGNOSTICS_H
|
||||
#define LIB_QUERY_TEST_QUERYDIAGNOSTICS_H
|
||||
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include "lib/format-string.hpp"
|
||||
|
||||
using boost::format;
|
||||
using util::_Fmt;
|
||||
using std::string;
|
||||
using std::rand;
|
||||
|
||||
|
||||
|
||||
namespace lumiera
|
||||
{
|
||||
namespace query
|
||||
{
|
||||
namespace test
|
||||
{
|
||||
|
||||
namespace // implementation constants
|
||||
{
|
||||
|
||||
format predicatePatt ("%s_%2i( %s )");
|
||||
const string garbage ("asdfghjklqwertzuiop");
|
||||
namespace lib {
|
||||
namespace query{
|
||||
namespace test {
|
||||
|
||||
const uint MAX_DEGREE_RAND = 9;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline string
|
||||
garbage_term () ///< yields a random string of 3 letters
|
||||
{
|
||||
return str (predicatePatt
|
||||
% char ('a'+ rand() % 26)
|
||||
% (rand() % 100)
|
||||
% garbage.substr(rand() % 17 , 3)
|
||||
);
|
||||
}
|
||||
|
||||
inline string
|
||||
garbage_query (int degree=0) ///< fabricating (random) query strings
|
||||
{
|
||||
string fake;
|
||||
if (!degree)
|
||||
degree = 1 + rand() % MAX_DEGREE_RAND;
|
||||
while (0 < --degree)
|
||||
fake += garbage_term() + ", ";
|
||||
fake += garbage_term() + ".";
|
||||
return fake;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace test
|
||||
namespace {// implementation constants
|
||||
|
||||
} // namespace query
|
||||
|
||||
} // namespace lumiera
|
||||
_Fmt predicatePattern ("%s_%2i( %s )");
|
||||
const string garbage ("asanisimasabibeddiboom");
|
||||
|
||||
const uint MAX_DEGREE_RAND = 9;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline string
|
||||
garbage_term () ///< yields a random string of 3 letters
|
||||
{
|
||||
return predicatePattern
|
||||
% char ('a'+ rand() % 26)
|
||||
% (rand() % 100)
|
||||
% garbage.substr(rand() % 19 , 3);
|
||||
}
|
||||
|
||||
inline string
|
||||
garbage_query (int degree=0) ///< fabricating (random) query strings
|
||||
{
|
||||
string fake;
|
||||
if (!degree)
|
||||
degree = 1 + rand() % MAX_DEGREE_RAND;
|
||||
while (0 < --degree)
|
||||
fake += garbage_term() + ", ";
|
||||
fake += garbage_term() + ".";
|
||||
return fake;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}}} // namespace lib::query::test
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ using std::tr1::bind;
|
|||
using util::isnil;
|
||||
using util::cStr;
|
||||
using test::Test;
|
||||
using lib::Literal;
|
||||
using lib::query::extractID;
|
||||
using backend::Thread;
|
||||
|
||||
|
||||
|
|
@ -50,7 +52,7 @@ namespace test {
|
|||
|
||||
namespace { // private test classes and data...
|
||||
|
||||
using query::extractID;
|
||||
using lib::query::extractID;
|
||||
|
||||
/** limit for the randomly selected duration of
|
||||
* subsystem's running phase (milliseconds) */
|
||||
|
|
|
|||
Loading…
Reference in a new issue