clean up lib/meta namespaces

This commit is contained in:
Fischlurch 2011-12-03 02:56:50 +01:00
parent b2d6074097
commit d9f84a9bfd
69 changed files with 594 additions and 614 deletions

View file

@ -185,7 +185,7 @@ namespace lumiera { ///////TODO: shouldn't that be namespace lib? or proc?
*/
template<typename TYPES>
class ConfigRules
: public typelist::InstantiateForEach<TYPES, QueryHandler>
: public lib::meta::InstantiateForEach<TYPES, QueryHandler>
{
protected:
ConfigRules () {}
@ -212,13 +212,13 @@ namespace lumiera { ///////TODO: shouldn't that be namespace lib? or proc?
* the list of all concrete types participating in the
* rule based config query system
*/
typedef typelist::Types < proc::mobject::session::Track
, proc::asset::Pipe
, const proc::asset::ProcPatt
, proc::asset::Timeline
, proc::asset::Sequence
> ::List
InterfaceTypes;
typedef lib::meta::Types < proc::mobject::session::Track
, proc::asset::Pipe
, const proc::asset::ProcPatt
, proc::asset::Timeline
, proc::asset::Sequence
> ::List
InterfaceTypes;
/**
* user-visible Interface to the ConfigRules subsystem.

View file

@ -60,6 +60,7 @@ namespace lumiera {
using asset::ProcPatt;
using asset::PProcPatt;
using proc::mobject::Session;
using lib::meta::InstantiateChained;
using util::isnil;
@ -248,10 +249,10 @@ namespace lumiera {
* values for some types of interest for testing and debugging.
*/
class MockConfigRules
: public typelist::InstantiateChained < InterfaceTypes
, LookupPreconfigured // building block used for each of the types
, MockTable // for implementing the base class (interface)
>
: public InstantiateChained < InterfaceTypes
, LookupPreconfigured // building block used for each of the types
, MockTable // for implementing the base class (interface)
>
{
protected:
MockConfigRules (); ///< to be used only by the singleton factory

View file

@ -491,7 +491,7 @@ namespace lib {
namespace { // Helper to pick up the produced value type automatically
using lumiera::typelist::FunctionSignature;
using lib::meta::FunctionSignature;
template<typename SIG>
struct _ProducedOutput

View file

@ -45,15 +45,15 @@
*/
#ifndef LUMIERA_META_CONFIGFLAGS_H
#define LUMIERA_META_CONFIGFLAGS_H
#ifndef LIB_META_CONFIGFLAGS_H
#define LIB_META_CONFIGFLAGS_H
#include "lib/meta/typelist.hpp"
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta{
const size_t CONFIG_FLAGS_MAX = 5;
@ -107,13 +107,13 @@ namespace typelist{
>
struct ConfigSetFlag<Fl, Config<f1,f2,f3,f4,IGN> >
{
typedef typelist::Config<Fl,f1,f2,f3,f4> Config;
typedef lib::meta::Config<Fl,f1,f2,f3,f4> Config;
};
/** build a configuration type from a list-of-flags */
template<class FLAGS, class CONF=typelist::Config<> >
template<class FLAGS, class CONF=Config<> >
struct BuildConfigFromFlags
{
typedef CONF Config;
@ -199,5 +199,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -92,16 +92,6 @@
#include "lib/meta/util.hpp"
namespace lib {
namespace meta{
///////////////TICKET #175 sort out meta namespace
using lumiera::Yes_t;
using lumiera::No_t;
}} // namespace lib::meta

View file

@ -44,8 +44,8 @@
*/
#ifndef LUMIERA_META_FUNCTION_CLOSURE_H
#define LUMIERA_META_FUNCTION_CLOSURE_H
#ifndef LIB_META_FUNCTION_CLOSURE_H
#define LIB_META_FUNCTION_CLOSURE_H
#include "lib/meta/function.hpp"
#include "lib/meta/tuple.hpp"
@ -54,9 +54,9 @@
namespace lumiera {
namespace typelist{
namespace func {
namespace lib {
namespace meta{
namespace func{
using std::tr1::function;
@ -884,5 +884,5 @@ namespace func {
}}} // namespace lumiera::typelist::func
}}} // namespace lib::meta::func
#endif

View file

@ -52,8 +52,8 @@
*/
#ifndef LUMIERA_META_FUNCTION_ERASURE_H
#define LUMIERA_META_FUNCTION_ERASURE_H
#ifndef LIB_META_FUNCTION_ERASURE_H
#define LIB_META_FUNCTION_ERASURE_H
#include "lib/util.hpp"
#include "lib/error.hpp"
@ -64,8 +64,8 @@
#include <tr1/functional>
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta{
using std::tr1::function;
using util::unConst;
@ -240,5 +240,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -44,8 +44,8 @@
*/
#ifndef LUMIERA_META_FUNCTION_H
#define LUMIERA_META_FUNCTION_H
#ifndef LIB_META_FUNCTION_H
#define LIB_META_FUNCTION_H
#include "lib/meta/typelist.hpp"
@ -53,8 +53,8 @@
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta{
using std::tr1::function;
@ -357,5 +357,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -33,8 +33,8 @@
*/
#ifndef LUMIERA_META_GENERATOR_COMBINATIONS_H
#define LUMIERA_META_GENERATOR_COMBINATIONS_H
#ifndef LIB_META_GENERATOR_COMBINATIONS_H
#define LIB_META_GENERATOR_COMBINATIONS_H
#include "lib/meta/typelist.hpp"
#include "lib/meta/typelist-manip.hpp"
@ -42,8 +42,8 @@
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta{
template<class TYPES_1, class TYPES_2>
@ -97,5 +97,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -39,7 +39,7 @@ This code is heavily inspired by
/** @file generator.hpp
** Helpers for working with lumiera::typelist::Types (i.e. lists-of-types).
** Helpers for working with lib::meta::Types (i.e. lists-of-types).
** The main purpose is to build interfaces and polymorphic implementations
** (using virtual functions) based on templated Types or Collections of types,
** which is not possible without Template Metaprogramming.
@ -56,15 +56,15 @@ This code is heavily inspired by
*/
#ifndef LUMIERA_META_GENERATOR_H
#define LUMIERA_META_GENERATOR_H
#ifndef LIB_META_GENERATOR_H
#define LIB_META_GENERATOR_H
#include "lib/meta/typelist.hpp"
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta{
/**
* Apply a template to a collection of types.
@ -207,5 +207,5 @@ namespace typelist{
};
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -21,8 +21,8 @@
*/
#ifndef LUMIERA_META_MAYBE_COMPARE_H
#define LUMIERA_META_MAYBE_COMPARE_H
#ifndef LIB_META_MAYBE_COMPARE_H
#define LIB_META_MAYBE_COMPARE_H
#include "lib/functor-util.hpp"
@ -30,8 +30,8 @@
#include <tr1/functional>
namespace lumiera {
namespace typelist {
namespace lib {
namespace meta{
using std::tr1::function;
@ -72,5 +72,5 @@ namespace typelist {
}
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -44,8 +44,8 @@
*/
#ifndef LUMIERA_META_TUPLE_H
#define LUMIERA_META_TUPLE_H
#ifndef LIB_META_TUPLE_H
#define LIB_META_TUPLE_H
#include "lib/meta/typelist.hpp"
#include "lib/meta/typelist-util.hpp"
@ -54,8 +54,8 @@
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
@ -743,5 +743,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -49,15 +49,15 @@
*/
#ifndef LUMIERA_META_TYPELIST_MANIP_H
#define LUMIERA_META_TYPELIST_MANIP_H
#ifndef LIB_META_TYPELIST_MANIP_H
#define LIB_META_TYPELIST_MANIP_H
#include "lib/meta/typelist.hpp"
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
/** pick the n-th element from a typelist */
@ -325,5 +325,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -42,15 +42,15 @@
*/
#ifndef LUMIERA_META_TYPELIST_UTIL_H
#define LUMIERA_META_TYPELIST_UTIL_H
#ifndef LIB_META_TYPELIST_UTIL_H
#define LIB_META_TYPELIST_UTIL_H
#include "lib/meta/typelist.hpp"
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
/**
@ -123,5 +123,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -55,7 +55,7 @@ This code is heavily inspired by
** effectively this is a flavour of functional programming. Just the
** "execution environment" is the compiler, during compilation.
**
** @see lumiera::visitor::Applicable usage example
** @see lib::visitor::Applicable usage example
** @see control::CommandSignature more elaborate usage example (dissecting a functor signature)
** @see TypeList_test
** @see TypeListManip_test
@ -63,14 +63,14 @@ This code is heavily inspired by
*/
#ifndef LUMIERA_META_TYPELIST_H
#define LUMIERA_META_TYPELIST_H
#ifndef LIB_META_TYPELIST_H
#define LIB_META_TYPELIST_H
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
struct NullType
{
@ -129,5 +129,5 @@ namespace typelist{
typedef Node<NullType,NullType> NodeNull;
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -41,8 +41,8 @@
*/
#ifndef LUMIERA_META_TYPESEQ_UTIL_H
#define LUMIERA_META_TYPESEQ_UTIL_H
#ifndef LIB_META_TYPESEQ_UTIL_H
#define LIB_META_TYPESEQ_UTIL_H
#include "lib/meta/typelist.hpp"
#include "lib/meta/typelist-manip.hpp"
@ -50,8 +50,8 @@
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
@ -203,5 +203,5 @@ namespace typelist{
}} // namespace lumiera::typelist
}} // namespace lib::meta
#endif

View file

@ -21,12 +21,13 @@
*/
#ifndef LUMIERA_META_UTIL_H
#define LUMIERA_META_UTIL_H
#ifndef LIB_META_UTIL_H
#define LIB_META_UTIL_H
namespace lumiera {
namespace lib {
namespace meta {
/* types for figuring out the overload resolution chosen by the compiler */
@ -36,77 +37,74 @@ namespace lumiera {
namespace typelist {
/** Compile-time Type equality:
* Simple Trait template to pick up types considered
* \em identical by the compiler.
* @warning identical, not sub-type!
*/
template<typename T1, typename T2>
struct is_sameType
{
static const bool value = false;
};
template<typename T>
struct is_sameType<T,T>
{
static const bool value = true;
};
/** semi-automatic detection if an instantiation is possible.
* Requires help by the template to be tested, which needs to define
* a typedef member \c is_defined. The embedded metafunction Test can be used
* as a predicate for filtering types which may yield a valid instantiation
* of the candidate template in question.
* \par
* A fully automated solution for this problem is impossible by theoretic reasons.
* Any non trivial use of such a \c is_defined trait would break the "One Definition Rule",
* as the state of any type can change from "partially defined" to "fully defined" over
* the course of any translation unit. Thus, even if there may be a \em solution out there,
* we can expect it to break at some point by improvements/fixes to the C++ Language.
*/
template<template<class> class _CandidateTemplate_>
struct Instantiation
{
template<class X>
class Test
{
typedef _CandidateTemplate_<X> Instance;
template<class U>
static Yes_t check(typename U::is_defined *);
template<class U>
static No_t check(...);
public:
static const bool value = (sizeof(Yes_t)==sizeof(check<Instance>(0)));
};
};
/** Trait template for detecting a typelist type.
* For example, this allows to write specialisations with the help of
* boost::enable_if
*/
template<typename TY>
class is_Typelist
{
template<class X>
static Yes_t check(typename X::List *);
template<class>
static No_t check(...);
public:
static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0)));
};
} // namespace typelist
} // namespace lumiera
/** Compile-time Type equality:
* Simple Trait template to pick up types considered
* \em identical by the compiler.
* @warning identical, not sub-type!
*/
template<typename T1, typename T2>
struct is_sameType
{
static const bool value = false;
};
template<typename T>
struct is_sameType<T,T>
{
static const bool value = true;
};
/** semi-automatic detection if an instantiation is possible.
* Requires help by the template to be tested, which needs to define
* a typedef member \c is_defined. The embedded metafunction Test can be used
* as a predicate for filtering types which may yield a valid instantiation
* of the candidate template in question.
* \par
* A fully automated solution for this problem is impossible by theoretic reasons.
* Any non trivial use of such a \c is_defined trait would break the "One Definition Rule",
* as the state of any type can change from "partially defined" to "fully defined" over
* the course of any translation unit. Thus, even if there may be a \em solution out there,
* we can expect it to break at some point by improvements/fixes to the C++ Language.
*/
template<template<class> class _CandidateTemplate_>
struct Instantiation
{
template<class X>
class Test
{
typedef _CandidateTemplate_<X> Instance;
template<class U>
static Yes_t check(typename U::is_defined *);
template<class U>
static No_t check(...);
public:
static const bool value = (sizeof(Yes_t)==sizeof(check<Instance>(0)));
};
};
/** Trait template for detecting a typelist type.
* For example, this allows to write specialisations with the help of
* boost::enable_if
*/
template<typename TY>
class is_Typelist
{
template<class X>
static Yes_t check(typename X::List *);
template<class>
static No_t check(...);
public:
static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0)));
};
}} // namespace lib::meta
#endif

View file

@ -54,9 +54,9 @@ namespace lib {
namespace factory {
using lumiera::typelist::Types;
using lumiera::typelist::FunctionSignature;
using lumiera::typelist::FunctionTypedef;
using lib::meta::Types;
using lib::meta::FunctionSignature;
using lib::meta::FunctionTypedef;
using std::tr1::function;

View file

@ -155,8 +155,8 @@ namespace lib {
namespace error = lumiera::error;
using boost::enable_if;
using lumiera::Yes_t;
using lumiera::No_t;
using lib::meta::Yes_t;
using lib::meta::No_t;
struct EmptyBase{ };

View file

@ -60,9 +60,9 @@
namespace lib {
using lumiera::typelist::Types;
using lumiera::typelist::IsInList;
using lumiera::typelist::InstantiateForEach;
using lib::meta::Types;
using lib::meta::IsInList;
using lib::meta::InstantiateForEach;

View file

@ -130,8 +130,8 @@ namespace test{
namespace mock {
using boost::enable_if;
using lumiera::Yes_t;
using lumiera::No_t;
using lib::meta::Yes_t;
using lib::meta::No_t;
/**
* Metafunction: does the Type in question

View file

@ -115,7 +115,7 @@ namespace time {
namespace mutation {
using boost::disable_if;
using lumiera::typelist::is_sameType;
using lib::meta::is_sameType;
using std::tr1::placeholders::_1;
using std::tr1::function;
using std::tr1::bind;

View file

@ -162,9 +162,9 @@ namespace time {
/* == Descriptor to define Support for specific formats == */
using lumiera::typelist::Types;
using lumiera::typelist::Node;
using lumiera::typelist::NullType;
using lib::meta::Types;
using lib::meta::Node;
using lib::meta::NullType;
/**
* Descriptor to denote support for a specific (timecode) format.

View file

@ -56,9 +56,9 @@ namespace lib {
namespace variant {
using lumiera::typelist::count;
using lumiera::typelist::maxSize;
using lumiera::typelist::InstantiateWithIndex;
using lib::meta::count;
using lib::meta::maxSize;
using lib::meta::InstantiateWithIndex;
/**
* internal helper used to build a variant storage wrapper.

View file

@ -34,7 +34,7 @@
#include <vector>
namespace lumiera {
namespace lib {
namespace visitor {
using lib::ClassLock;
@ -213,5 +213,5 @@ namespace visitor {
}} // namespace lumiera::visitor
}} // namespace lib::visitor
#endif

View file

@ -22,7 +22,7 @@
/** @file visitor-policies.hpp
** Policies usable for configuring the lumiera::visitor::Tool for different kinds of error handling.
** Policies usable for configuring the lib::visitor::Tool for different kinds of error handling.
** @see buildertool.hpp for another flavour (calling an catch-all-function there)
**
*/
@ -35,7 +35,7 @@
#include "lib/error.hpp"
namespace lumiera {
namespace lib {
namespace visitor {
/**
@ -70,5 +70,5 @@ namespace visitor {
}} // namespace lumiera::visitor
}} // namespace lib::visitor
#endif

View file

@ -73,8 +73,8 @@ Credits for many further implementation ideas go to
#ifndef LUMIERA_VISITOR_H
#define LUMIERA_VISITOR_H
#ifndef LIB_VISITOR_H
#define LIB_VISITOR_H
#include "lib/visitor-policies.hpp"
#include "lib/visitor-dispatcher.hpp"
@ -82,9 +82,11 @@ Credits for many further implementation ideas go to
#include "lib/meta/typelist.hpp"
namespace lumiera {
namespace lib {
namespace visitor {
namespace typelist = lib::meta;
/**
* Marker interface / base class for all "visiting tools".
@ -225,5 +227,5 @@ namespace visitor {
}} // namespace lumiera::visitor
}} // namespace lib::visitor
#endif

View file

@ -56,7 +56,7 @@ namespace wrapper {
using util::unConst;
using util::isSameObject;
using lumiera::typelist::FunctionSignature;
using lib::meta::FunctionSignature;
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
using boost::remove_const;
@ -380,7 +380,7 @@ namespace wrapper {
{
using std::tr1::bind;
using std::tr1::placeholders::_1;
using lumiera::typelist::func::chained;
using lib::meta::func::chained;
// note: binding "this" mandates noncopyable
function<Res(Res)> doCaptureResult = bind (&FunctionResult::captureResult, this, _1 );
function<SIG> chainedWithResCapture = chained (targetFunction, doCaptureResult);

View file

@ -39,10 +39,10 @@ namespace proc {
namespace mobject { class MObject; }
typedef lumiera::typelist::Types < mobject::Placement<mobject::MObject>*
, lib::P<asset::Asset>*
> ::List
WrapperTypes;
typedef lib::meta::Types < mobject::Placement<mobject::MObject>*
, lib::P<asset::Asset>*
> ::List
WrapperTypes;
}
namespace lumiera {

View file

@ -69,7 +69,7 @@ namespace control {
namespace bind_arg { // internals....
using namespace lumiera::typelist;
using namespace lib::meta;
//

View file

@ -91,15 +91,15 @@
namespace proc {
namespace control {
using lumiera::typelist::FunctionSignature;
using lumiera::typelist::Tuple;
using lumiera::typelist::BuildTupleAccessor;
using lumiera::typelist::func::TupleApplicator;
using lumiera::typelist::FunErasure;
using lumiera::typelist::StoreFunction;
using lumiera::typelist::NullType;
using lib::meta::FunctionSignature;
using lib::meta::Tuple;
using lib::meta::BuildTupleAccessor;
using lib::meta::func::TupleApplicator;
using lib::meta::FunErasure;
using lib::meta::StoreFunction;
using lib::meta::NullType;
using lumiera::typelist::equals_safeInvoke;
using lib::meta::equals_safeInvoke;
using lib::TypedAllocationManager;
using util::unConst;
using std::tr1::function;

View file

@ -86,12 +86,12 @@ namespace control {
using lib::Symbol;
using util::cStr;
using lumiera::typelist::FunctionSignature;
using lumiera::typelist::FunctionTypedef;
using lumiera::typelist::Types;
using lumiera::typelist::NullType;
using lumiera::typelist::Tuple;
using lumiera::typelist::tuple::makeNullTuple;
using lib::meta::FunctionSignature;
using lib::meta::FunctionTypedef;
using lib::meta::Types;
using lib::meta::NullType;
using lib::meta::Tuple;
using lib::meta::tuple::makeNullTuple;

View file

@ -56,7 +56,7 @@
namespace proc {
namespace control {
using namespace lumiera::typelist;
using namespace lib::meta;

View file

@ -61,11 +61,11 @@ namespace control {
using std::tr1::function;
using lumiera::typelist::FunctionSignature;
using lumiera::typelist::FunctionTypedef;
using lumiera::typelist::Types;
using lumiera::typelist::Append;
using lumiera::typelist::SplitLast;
using lib::meta::FunctionSignature;
using lib::meta::FunctionTypedef;
using lib::meta::Types;
using lib::meta::Append;
using lib::meta::SplitLast;
/**

View file

@ -74,7 +74,7 @@ namespace control {
using std::string;
using lib::Symbol;
using std::tr1::shared_ptr;
using lumiera::typelist::Tuple;
using lib::meta::Tuple;
LUMIERA_ERROR_DECLARE (UNBOUND_ARGUMENTS); ///< Command functor not yet usable, because arguments aren't bound

View file

@ -57,9 +57,9 @@ namespace proc {
namespace control {
using boost::equality_comparable;
using lumiera::typelist::func::bindLast;
using lumiera::typelist::func::chained;
using lumiera::typelist::equals_safeInvoke;
using lib::meta::func::bindLast;
using lib::meta::func::chained;
using lib::meta::equals_safeInvoke;
LUMIERA_ERROR_DECLARE (MISSING_MEMENTO); ///< Undo functor not yet usable, because no undo state has been captured

View file

@ -83,7 +83,7 @@ namespace config {
*/
struct OperationBase
{
typedef lumiera::Yes_t is_defined;
typedef lib::meta::Yes_t is_defined;
BuffHandle
getSource (Invocation& ivo, uint chanNo)
@ -277,7 +277,7 @@ namespace config {
};
using lumiera::typelist::Config;
using lib::meta::Config;
///////////////////////TODO: selecting this way isn't especially readable,
///////////////////////////: but BufferProvider selection is going to be solved differently anyway, see Ticket #249
template<class CONF>

View file

@ -65,9 +65,9 @@ namespace engine {
namespace config {
using util::contains;
using lumiera::typelist::FlagInfo;
using lib::meta::FlagInfo;
using lumiera::typelist::CONFIG_FLAGS_MAX;
using lib::meta::CONFIG_FLAGS_MAX;
typedef size_t IxID; ///////////////////////////////TICKET #863

View file

@ -34,12 +34,12 @@ namespace engine {
namespace config {
using lumiera::typelist::Flags;
using lumiera::typelist::CombineFlags;
using lumiera::typelist::DefineConfigByFlags;
using lumiera::typelist::Instantiation;
using lumiera::typelist::Apply;
using lumiera::typelist::Filter;
using lib::meta::Flags;
using lib::meta::CombineFlags;
using lib::meta::DefineConfigByFlags;
using lib::meta::Instantiation;
using lib::meta::Apply;
using lib::meta::Filter;
using lib::AllocationCluster;

View file

@ -94,7 +94,7 @@ namespace mobject {
* an instantiation of the "Applicable" template parametrised with all
* concrete Buildable classes, for which it wants calls to be dispatched.
* \par
* In addition to lumiera::visitor::Tool, BuilderTool adds support for dealing
* In addition to lib::visitor::Tool, BuilderTool adds support for dealing
* with objects normally handled by means of smart-pointers or similar
* wrappers, most notably mobject::Placement. The visitation is initiated
* by calling the stand-alone function \c (BuilderTool& tool, WRA& wrappedTargetObj) ,
@ -106,7 +106,7 @@ namespace mobject {
* as we simply store a pointer within the BuilderTool instance.
*/
class BuilderTool
: public lumiera::visitor::Tool<void, InvokeCatchAllFunction>
: public lib::visitor::Tool<void, InvokeCatchAllFunction>
{ lumiera::WrapperPtr currentWrapper_;
public:
@ -166,11 +166,11 @@ namespace mobject {
class TYPELIST // list of all concrete Buildables to be treated
>
class Applicable
: public lumiera::visitor::Applicable<TOOLImpl, TYPELIST, BuilderTool>
: public lib::visitor::Applicable<TOOLImpl, TYPELIST, BuilderTool>
{ }
;
using lumiera::typelist::Types; // convenience for the users of "Applicable"
using lib::meta::Types; // convenience for the users of "Applicable"
}// namespace mobject::builder
@ -181,7 +181,7 @@ namespace mobject {
/**
* Marker Interface for classes visitable by Builder tools.
*/
class Buildable : public lumiera::visitor::Visitable<builder::BuilderTool>
class Buildable : public lib::visitor::Visitable<builder::BuilderTool>
{ };

View file

@ -35,7 +35,7 @@ extern "C" {
namespace proc {
namespace mobject {
namespace mp = lumiera::typelist;
namespace mp = lib::meta;
class MObject;

View file

@ -45,9 +45,9 @@ namespace proc {
namespace mobject {
namespace session {
// using lumiera::typelist::InstantiateChained;
// using lumiera::typelist::InheritFrom;
// using lumiera::typelist::NullType;
// using lib::meta::InstantiateChained;
// using lib::meta::InheritFrom;
// using lib::meta::NullType;
class SessionServiceDefaults

View file

@ -48,9 +48,9 @@ namespace proc {
namespace mobject {
namespace session {
// using lumiera::typelist::InstantiateChained;
// using lumiera::typelist::InheritFrom;
// using lumiera::typelist::NullType;
// using lib::meta::InstantiateChained;
// using lib::meta::InheritFrom;
// using lib::meta::NullType;
/**
* Implementation-level service for resolving an Placement-ID.

View file

@ -86,8 +86,8 @@ namespace proc {
namespace mobject {
namespace session {
using lumiera::typelist::InstantiateChained;
using lumiera::typelist::Types;
using lib::meta::InstantiateChained;
using lib::meta::Types;
/**

View file

@ -44,8 +44,8 @@ namespace test {
using lib::time::TimeVar;
using std::tr1::function;
using lumiera::typelist::FunctionSignature;
using lumiera::typelist::Tuple;
using lib::meta::FunctionSignature;
using lib::meta::Tuple;

View file

@ -57,7 +57,7 @@ namespace test {
using lib::test::showSizeof;
using lib::test::randTime;
using namespace lumiera::typelist;
using namespace lib::meta;

View file

@ -38,7 +38,7 @@ namespace proc {
namespace control {
namespace test {
using namespace lumiera::typelist;
using namespace lib::meta;
typedef lib::P<CommandImpl> PCmdImpl;

View file

@ -42,7 +42,7 @@ namespace test {
using namespace lumiera::typelist;
using namespace lib::meta;
using lib::Symbol;
using util::isnil;
using util::isSameObject;

View file

@ -45,7 +45,7 @@ namespace proc {
namespace control {
namespace test {
using namespace lumiera::typelist;
using namespace lib::meta;
using control::CmdClosure;

View file

@ -72,7 +72,7 @@ namespace test {
// using lumiera::P;
//using lumiera::typelist::BuildTupleAccessor;
//using lib::meta::BuildTupleAccessor;
// using lumiera::error::LUMIERA_ERROR_EXTERNAL;
namespace { // test data and helpers...

View file

@ -46,8 +46,8 @@ namespace test {
namespace { // what follows is a simulated (simplified) version
// of the complete Session + SessionManager setup.....
using lumiera::typelist::Types;
using lumiera::typelist::InstantiateChained;
using lib::meta::Types;
using lib::meta::InstantiateChained;

View file

@ -55,8 +55,8 @@ using std::cout;
using std::endl;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
@ -335,4 +335,4 @@ cout << "__________________________\n" \
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -32,8 +32,8 @@
//using boost::format;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
@ -56,5 +56,5 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test
#endif

View file

@ -52,9 +52,9 @@ using std::cout;
using std::endl;
namespace lumiera {
namespace typelist{
namespace test {
namespace lib {
namespace meta {
namespace test {
namespace { // test data
@ -352,4 +352,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -29,9 +29,9 @@
#include "meta/typelist-diagnostics.hpp"
namespace lumiera {
namespace typelist{
namespace test {
namespace lib {
namespace meta {
namespace test {
using ::test::Test;
using func::applyFirst;
@ -387,4 +387,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -34,8 +34,8 @@ using lumiera::error::LUMIERA_ERROR_ASSERTION;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
using std::tr1::function;
@ -273,4 +273,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -35,8 +35,8 @@ using std::cout;
using std::endl;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
@ -137,4 +137,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -47,8 +47,8 @@ using std::string;
using std::cout;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
/** template for generating lots of different test types */
@ -144,4 +144,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -41,9 +41,9 @@
#include <set>
namespace lib {
namespace meta{
namespace test{
namespace lib {
namespace meta {
namespace test {
using proc::mobject::session::Effect;
using proc::mobject::session::ScopeQuery;

View file

@ -52,9 +52,9 @@ using boost::lexical_cast;
using util::unConst;
namespace lumiera {
namespace typelist{
namespace test {
namespace lib {
namespace meta {
namespace test {
namespace { // Diagnostics
@ -189,5 +189,5 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test
#endif

View file

@ -25,7 +25,7 @@
** Interplay of typelists, type tuples and simple record
** data types build on top of them.
**
** @see lumiera::typelist::Tuple
** @see lib::meta::Tuple
** @see tuple.hpp
** @see function-closure.hpp
** @see control::CmdClosure real world usage example
@ -45,8 +45,8 @@ using std::cout;
using std::endl;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
@ -455,4 +455,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -52,8 +52,8 @@ using boost::format;
using boost::enable_if;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
/** dummy interface / baseclass for diagnostics */
struct Numz
@ -209,5 +209,5 @@ namespace typelist{
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test
#endif

View file

@ -50,8 +50,8 @@ using std::cout;
using std::endl;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
@ -377,4 +377,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -30,8 +30,8 @@ using std::string;
using std::cout;
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
template<int I>
@ -91,4 +91,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -26,8 +26,8 @@
namespace lumiera {
namespace typelist{
namespace lib {
namespace meta {
namespace test {
@ -80,4 +80,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -51,9 +51,9 @@ using std::cout;
using std::endl;
namespace lumiera {
namespace typelist{
namespace test {
namespace lib {
namespace meta {
namespace test {
namespace { // test data
@ -183,4 +183,4 @@ namespace test {
}}} // namespace lumiera::typelist::test
}}} // namespace lib::meta::test

View file

@ -54,8 +54,8 @@ namespace test{
using lib::ScopedHolder;
using proc::asset::meta::TimeGrid;
using lumiera::typelist::Types;
using lumiera::typelist::InstantiateChainedCombinations;
using lib::meta::Types;
using lib::meta::InstantiateChainedCombinations;
using error::LUMIERA_ERROR_UNCONNECTED;
@ -195,7 +195,7 @@ namespace test{
namespace { // Implementation: Matrix of individual test combinations
using lumiera::typelist::is_sameType;
using lib::meta::is_sameType;
template<class T>
inline bool

View file

@ -32,198 +32,192 @@ using std::string;
using std::cout;
namespace lumiera
{
namespace visitor
namespace lib {
namespace visitor{
namespace test2 {
typedef visitor::Tool<> Tool;
class HomoSapiens : public Visitable<>
{
namespace test2
{
typedef visitor::Tool<> Tool;
class HomoSapiens : public Visitable<>
{
public:
DEFINE_PROCESSABLE_BY (Tool);
};
class Boss : public HomoSapiens
{
public:
DEFINE_PROCESSABLE_BY (Tool);
};
class BigBoss : public Boss
{
public:
DEFINE_PROCESSABLE_BY (Tool);
};
public:
DEFINE_PROCESSABLE_BY (Tool);
};
class Boss : public HomoSapiens
{
public:
DEFINE_PROCESSABLE_BY (Tool);
};
class BigBoss : public Boss
{
public:
DEFINE_PROCESSABLE_BY (Tool);
};
template<class BASE>
class VerboseVisitor
: public BASE
template<class BASE>
class VerboseVisitor
: public BASE
{
protected:
void talk_to (string guy)
{
protected:
void talk_to (string guy)
{
cout << format ("Hello %s, nice to meet you...\n") % guy;
}
};
class Babbler
: public Applicable< Babbler,
Types<Boss,BigBoss>::List, // treat this types
VerboseVisitor<Tool> // intermediary base class
>
{
public:
void treat (Boss&) { talk_to("Boss"); }
void treat (BigBoss&) { talk_to("Big Boss"); }
};
cout << format ("Hello %s, nice to meet you...\n") % guy;
}
};
class Babbler
: public Applicable< Babbler,
Types<Boss,BigBoss>::List, // treat this types
VerboseVisitor<Tool> // intermediary base class
>
{
public:
void treat (Boss&) { talk_to("Boss"); }
void treat (BigBoss&) { talk_to("Big Boss"); }
};
// the classes above comprise the standard use case,
// what follows covers rather exotic corner cases
/** defines an catch-all-function instead of the silent default error handler */
template<class RET>
struct Catched
{
RET onUnknown (HomoSapiens&) { cout << "we-do-everything-for-YOU!\n"; }
};
/** defines another different visiting tool base */
typedef visitor::Tool<void, Catched> Hastalavista;
typedef Visitable<Hastalavista> Chief; ///< another special kind of visitables
// the classes above comprise the standard use case,
// what follows covers rather exotic corner cases
/** defines an catch-all-function instead of the silent default error handler */
template<class RET>
struct Catched
{
RET onUnknown (HomoSapiens&) { cout << "we-do-everything-for-YOU!\n"; return RET(); }
};
/** defines another different visiting tool base */
typedef visitor::Tool<void, Catched> Hastalavista;
typedef Visitable<Hastalavista> Chief; ///< another special kind of visitable
#define DEFINE_HASTALAVISTA_PROCESSABLE \
virtual void apply (Hastalavista& tool) \
{ return Chief::dispatchOp (*this, tool); }
/** now mixing the two hierarchies... */
class Leader : public Chief,
public Boss ///< can act as HomoSapiens or as Chief
{
public:
using HomoSapiens::apply;
DEFINE_HASTALAVISTA_PROCESSABLE;
};
class Visionary : public Leader
{
DEFINE_HASTALAVISTA_PROCESSABLE;
};
/** Hastalavista-Visiting-Tool
* tailored for the Chief hierarchy
*/
class Blatherer
: public Applicable< Blatherer,
Types<Visionary>::List, // get calls to Visionary dispatched
VerboseVisitor<Hastalavista> // note: different tool base class
>
{
public:
void treat (Leader&) { talk_to("Mr.Future"); }
};
virtual void apply (Hastalavista& tool) \
{ return Chief::dispatchOp (*this, tool); }
/** now mixing the two hierarchies... */
class Leader : public Chief,
public Boss ///< can act as HomoSapiens or as Chief
{
public:
using HomoSapiens::apply;
DEFINE_HASTALAVISTA_PROCESSABLE;
};
class Visionary : public Leader
{
DEFINE_HASTALAVISTA_PROCESSABLE;
};
/** Hastalavista-Visiting-Tool
* tailored for the Chief hierarchy
*/
class Blatherer
: public Applicable< Blatherer,
Types<Visionary>::List, // get calls to Visionary dispatched
VerboseVisitor<Hastalavista> // note: different tool base class
>
{
public:
void treat (Leader&) { talk_to("Mr.Future"); }
};
/*************************************************************************
* @test more esoteric corner cases of our visitor lib implementation.
* Defines a hierarchy of test classes, which mix two different
* kinds of "visitable" by two disjoint tool base classes. One
* of these base classes uses an explicit error handling
* catch-all-function.
*/
class VisitingToolExtended_test : public Test
/*************************************************************************
* @test more esoteric corner cases of our visitor lib implementation.
* Defines a hierarchy of test classes, which mix two different
* kinds of "visitable" by two disjoint tool base classes. One
* of these base classes uses an explicit error handling
* catch-all-function.
*/
class VisitingToolExtended_test : public Test
{
virtual void run(Arg)
{
virtual void run(Arg)
{
known_visitor_known_class();
visitor_not_visiting_some_class();
visiting_mixed_hierarchy();
}
known_visitor_known_class();
visitor_not_visiting_some_class();
visiting_mixed_hierarchy();
}
void known_visitor_known_class()
{
Boss x1;
BigBoss x2;
void known_visitor_known_class()
{
Boss x1;
BigBoss x2;
// masquerade as HomoSapiens...
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
cout << "=== Babbler meets Boss and BigBoss ===\n";
Babbler bab;
homo1.apply (bab);
homo2.apply (bab);
}
// masquerade as HomoSapiens...
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
void visitor_not_visiting_some_class()
{
HomoSapiens x1;
Leader x2;
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
cout << "=== Babbler meets HomoSapiens and Leader ===\n";
Babbler bab;
homo1.apply (bab); // doesn't visit HomoSapiens
homo2.apply (bab); // treats Leader as Boss
}
void visiting_mixed_hierarchy()
{
Leader x1;
Visionary x2;
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
Chief& chief1 (x1);
Chief& chief2 (x2);
Leader& lead1 (x1);
Leader& lead2 (x2);
Blatherer bla;
cout << "=== Blatherer meets Leader and Visionary masqueraded as Chief ===\n";
chief1.apply (bla); // catch-all, because Blatherer doesn't declare to be applicalbe to Leader
chief2.apply (bla); // treat(Visionary&) resolved to treat(Leader&) as expected
Babbler bab;
Tool& tool1 (bab);
cout << "=== Babbler masqueraded as Tool meets Leader and Visionary masqueraded as HomoSapiens ===\n";
homo1.apply (tool1); // because just going through the VTable, the dispatch works as expected
homo2.apply (tool1); // same here (in both cases, the call is resolved to treat(Boss&) as expected)
cout << "=== Babbler masqueraded as Tool meets Leader and Visionary masqueraded as Leader ===\n";
lead1.apply (tool1); // nothing happens, because Leader here is treated by his HomoSapiens base
lead2.apply (tool1); // surprisingly the VTable mechanism is choosen here, resulting in an correct dispatch
// note: the following doesn't compile (an this is a feature, not a bug):
// "Chief chief" : is abstract, because the Visitable-Template enforces implementing
// the "apply(TOOL&)" function, either directly or via the
// DEFINE_PROCESSABLE_BY macro
cout << "=== Babbler meets Boss and BigBoss ===\n";
Babbler bab;
homo1.apply (bab);
homo2.apply (bab);
}
void visitor_not_visiting_some_class()
{
HomoSapiens x1;
Leader x2;
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
cout << "=== Babbler meets HomoSapiens and Leader ===\n";
Babbler bab;
homo1.apply (bab); // doesn't visit HomoSapiens
homo2.apply (bab); // treats Leader as Boss
}
void visiting_mixed_hierarchy()
{
Leader x1;
Visionary x2;
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
Chief& chief1 (x1);
Chief& chief2 (x2);
Leader& lead1 (x1);
Leader& lead2 (x2);
Blatherer bla;
cout << "=== Blatherer meets Leader and Visionary masqueraded as Chief ===\n";
chief1.apply (bla); // catch-all, because Blatherer doesn't declare to be applicalbe to Leader
chief2.apply (bla); // treat(Visionary&) resolved to treat(Leader&) as expected
Babbler bab;
Tool& tool1 (bab);
cout << "=== Babbler masqueraded as Tool meets Leader and Visionary masqueraded as HomoSapiens ===\n";
homo1.apply (tool1); // because just going through the VTable, the dispatch works as expected
homo2.apply (tool1); // same here (in both cases, the call is resolved to treat(Boss&) as expected)
cout << "=== Babbler masqueraded as Tool meets Leader and Visionary masqueraded as Leader ===\n";
lead1.apply (tool1); // nothing happens, because Leader here is treated by his HomoSapiens base
lead2.apply (tool1); // surprisingly the VTable mechanism is choosen here, resulting in an correct dispatch
// note: the following doesn't compile (an this is a feature, not a bug):
// "Chief chief" : is abstract, because the Visitable-Template enforces implementing
// the "apply(TOOL&)" function, either directly or via the
// DEFINE_PROCESSABLE_BY macro
}
};
/** Register this test class... */
LAUNCHER (VisitingToolExtended_test, "unit common");
} // namespace test
} // namespace visitor
} // namespace lumiera
}
};
/** Register this test class... */
LAUNCHER (VisitingToolExtended_test, "unit common");
}}} // namespace lib::visitor::test2

View file

@ -32,132 +32,127 @@ using std::string;
using std::cout;
namespace lumiera {
namespace visitor {
namespace test1 {
namespace lib {
namespace visitor {
namespace test1 {
typedef visitor::Tool<> VisitingTool;
class HomoSapiens : public Visitable<>
{
public:
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class Boss : public HomoSapiens
{
public:
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class BigBoss : public Boss
{
public:
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class Visionary : public Boss
{
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class Leader : public Visionary
{
};
class VerboseVisitor
: public VisitingTool
{
protected:
void talk_to (string guy)
{
cout << format ("Hello %s, nice to meet you...\n") % guy;
}
};
class Babbler
: public Applicable< Babbler
, Types<Boss,BigBoss,Visionary>::List // dispatch calls to this types
, VerboseVisitor
>
{
public:
void treat (Boss&) { talk_to("Boss"); }
void treat (BigBoss&) { talk_to("Big Boss"); }
};
// note the following details:
// - Babbler "forgot" to declare being applicable to HomoSapiens
// - we have new derived class Leader without separate "apply()"-implementation
/*************************************************************************
* @test our lib implementation of the visitor pattern.
* Defines a hierarchy of test classes to check the following cases
* - calling the correct visiting tool specialised function
* for given concrete hierarchy classes
* - visiting tool not declaring to visit some class
* is silently ignored by default
* - newly added classes will be handled by existing
* functions according to inheritance relations
*/
class VisitingTool_test : public Test
{
virtual void
run (Arg)
{
known_visitor_known_class();
visiting_extended_hierarchy();
}
typedef visitor::Tool<> VisitingTool;
class HomoSapiens : public Visitable<>
void
known_visitor_known_class()
{
public:
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class Boss : public HomoSapiens
{
public:
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class BigBoss : public Boss
{
public:
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class Visionary : public Boss
{
DEFINE_PROCESSABLE_BY (VisitingTool);
};
class Leader : public Visionary
{
};
class VerboseVisitor
: public VisitingTool
{
protected:
void talk_to (string guy)
{
cout << format ("Hello %s, nice to meet you...\n") % guy;
}
};
class Babbler
: public Applicable< Babbler
, Types<Boss,BigBoss,Visionary>::List // dispatch calls to this types
, VerboseVisitor
>
{
public:
void treat (Boss&) { talk_to("Boss"); }
void treat (BigBoss&) { talk_to("Big Boss"); }
};
// note the following details:
// - Babbler "forgot" to declare being applicable to HomoSapiens
// - we have new derived class Leader without separate "apply()"-implementation
/*************************************************************************
* @test our lib implementation of the visitor pattern.
* Defines a hierarchy of test classes to check the following cases
* <ul><li>calling the correct visiting tool specialised function
* for given concrete hierarchy classes</li>
* <li>visiting tool not declaring to visit some class
* is silently ignored by default</li>
* <li>newly added classes will be handled by existing
* functions according to inheritance relations</li>
* </ul>
*/
class VisitingTool_test : public Test
{
virtual void
run (Arg)
{
known_visitor_known_class();
visiting_extended_hierarchy();
}
Boss x1;
BigBoss x2;
void
known_visitor_known_class()
{
Boss x1;
BigBoss x2;
// masquerade as HomoSapiens...
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
cout << "=== Babbler meets Boss and BigBoss ===\n";
Babbler bab;
VisitingTool& vista (bab);
homo1.apply (vista);
homo2.apply (vista);
}
// masquerade as HomoSapiens...
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
void
visiting_extended_hierarchy()
{
HomoSapiens x1;
Leader x2;
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
cout << "=== Babbler meets HomoSapiens and Leader ===\n";
Babbler bab;
VisitingTool& vista (bab);
homo1.apply (vista); // silent error handler (not Applicable to HomoSapiens)
homo2.apply (vista); // Leader handled as Visionary and treated as Boss
}
};
cout << "=== Babbler meets Boss and BigBoss ===\n";
Babbler bab;
VisitingTool& vista (bab);
homo1.apply (vista);
homo2.apply (vista);
}
/** Register this test class... */
LAUNCHER (VisitingTool_test, "unit common");
} // namespace test1
} // namespace visitor
} // namespace lumiera
void
visiting_extended_hierarchy()
{
HomoSapiens x1;
Leader x2;
HomoSapiens& homo1 (x1);
HomoSapiens& homo2 (x2);
cout << "=== Babbler meets HomoSapiens and Leader ===\n";
Babbler bab;
VisitingTool& vista (bab);
homo1.apply (vista); // silent error handler (not Applicable to HomoSapiens)
homo2.apply (vista); // Leader handled as Visionary and treated as Boss
}
};
/** Register this test class... */
LAUNCHER (VisitingTool_test, "unit common");
}}} // namespace lib::visitor::test1