cleanup: rectify Proc-Layer namespaces (II)

This commit is contained in:
Fischlurch 2011-12-02 17:50:44 +01:00
parent eb79a00cf4
commit b9d1899486
160 changed files with 1740 additions and 1669 deletions

View file

@ -119,13 +119,13 @@ namespace lumiera {
};
typedef lib::IterSource<mobject::ModelPort>::iterator ModelPorts;
typedef lib::IterSource<mobject::OutputDesignation>::iterator Pipes;
typedef lib::IterSource<proc::mobject::ModelPort>::iterator ModelPorts;
typedef lib::IterSource<proc::mobject::OutputDesignation>::iterator Pipes;
typedef proc::play::POutputManager Output;
typedef mobject::session::PClipMO Clip;
typedef mobject::PTrack Track;
typedef asset::PTimeline Timeline;
typedef asset::PViewer Viewer;
typedef proc::mobject::session::PClipMO Clip;
typedef proc::mobject::PTrack Track;
typedef proc::asset::PTimeline Timeline;
typedef proc::asset::PViewer Viewer;
/** core operation: create a new playback process
* outputting to the given viewer/display */

View file

@ -103,6 +103,8 @@
namespace lib {
namespace advice {
namespace error = lumiera::error;
using std::tr1::placeholders::_1;
using std::tr1::unordered_map;
using lib::iter_stl::eachVal;
@ -118,7 +120,6 @@ namespace advice {
using std::cout;
using std::endl;
using namespace lumiera;

View file

@ -187,7 +187,7 @@ namespace time {
std::bitset<MAXID> flags_;
template<class F>
size_t
IxID
typeID() const
{
return TypedContext<Supported>::ID<F>::get();

View file

@ -65,6 +65,8 @@
namespace lib {
typedef size_t IxID; //////////////////////TICKET #863
using std::vector;
@ -80,11 +82,11 @@ namespace lib {
template<class CX>
class TypedContext
{
static size_t lastGeneratedTypeID;
static IxID lastGeneratedTypeID;
public:
static size_t
newTypeID (size_t& typeID)
static IxID
newTypeID (IxID& typeID)
{
ClassLock<TypedContext> synchronised();
if (!typeID)
@ -96,10 +98,10 @@ namespace lib {
template<typename TY>
class ID
{
static size_t typeID;
static IxID typeID;
public:
static size_t
static IxID
get()
{
if (typeID)
@ -112,12 +114,12 @@ namespace lib {
/** storage for the type-ID generation mechanism */
template<class CX>
size_t TypedContext<CX>::lastGeneratedTypeID (0);
IxID TypedContext<CX>::lastGeneratedTypeID (0);
/** table holding all the generated type-IDs */
template<class CX>
template<typename TY>
size_t TypedContext<CX>::ID<TY>::typeID (0);
IxID TypedContext<CX>::ID<TY>::typeID (0);
@ -131,10 +133,10 @@ namespace lib {
mutable vector<long> counters_;
template<typename TY>
size_t
IxID
slot() const
{
size_t typeID = TypedContext<TypedCounter>::ID<TY>::get();
IxID typeID = TypedContext<TypedCounter>::ID<TY>::get();
if (size() < typeID)
counters_.resize (typeID);

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 lumiera::typelist::Types < mobject::Placement<mobject::MObject>*
, lib::P<asset::Asset>*
> ::List
WrapperTypes;
}
namespace lumiera {

View file

@ -41,7 +41,7 @@ namespace asset {
{};
typedef lumiera::P<Inventory> PInv;
typedef P<Inventory> PInv;
}} // namespace proc::asset

View file

@ -80,7 +80,7 @@ namespace asset {
} // namespace asset
}} // namespace proc::asset
@ -95,6 +95,7 @@ namespace asset {
//#include "proc/asset/sequence.hpp"
namespace proc {
namespace asset {
using meta::Descriptor;

View file

@ -45,6 +45,10 @@
using boost::format;
namespace lumiera {
class StreamType;
}
namespace proc {
namespace mobject {
namespace session {
@ -53,9 +57,6 @@ namespace session {
class Clip;
}}
namespace lumiera {
class StreamType;
}
namespace asset{

View file

@ -29,6 +29,7 @@
namespace proc {
namespace control {
@ -84,5 +85,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -63,6 +63,7 @@
namespace proc {
namespace control {
@ -670,5 +671,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -52,6 +52,7 @@
namespace proc {
namespace control {
using lib::InPlaceBuffer;
@ -278,5 +279,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -88,6 +88,7 @@
namespace proc {
namespace control {
using lumiera::typelist::FunctionSignature;
@ -302,5 +303,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -76,6 +76,7 @@
namespace proc {
namespace control {
using std::tr1::shared_ptr;
@ -325,5 +326,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -60,6 +60,7 @@
//#include <tr1/functional>
namespace proc {
namespace control {
using lib::TypedAllocationManager;
@ -187,5 +188,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -39,6 +39,7 @@
//#include <boost/format.hpp>
//using boost::str;
namespace proc {
namespace control {
@ -55,4 +56,4 @@ namespace control {
} // namespace control
}} // namespace proc::control

View file

@ -55,6 +55,7 @@
#include <tr1/functional>
namespace proc {
namespace control {
using std::tr1::function;
@ -237,5 +238,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -53,6 +53,7 @@
namespace proc {
namespace control {
using namespace lumiera::typelist;
@ -220,5 +221,5 @@ namespace control {
}
} // namespace control
}} // namespace proc::control
#endif

View file

@ -55,6 +55,7 @@
namespace proc {
namespace control {
using std::ostream;
@ -155,5 +156,5 @@ namespace control {
};
} // namespace control
}} // namespace proc::control
#endif

View file

@ -78,6 +78,7 @@
namespace proc {
namespace control {
using boost::hash;
@ -268,5 +269,5 @@ namespace control {
};
} // namespace control
}} // namespace proc::control
#endif

View file

@ -56,6 +56,7 @@
namespace proc {
namespace control {
using std::tr1::function;
@ -151,5 +152,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -54,7 +54,6 @@
#include <sstream>
#include <string>
using namespace lumiera;
using std::ostringstream;
using std::string;
using boost::format;
@ -62,7 +61,9 @@ using boost::str;
using util::cStr;
namespace proc {
namespace control {
namespace error = lumiera::error;
LUMIERA_ERROR_DEFINE (INVALID_COMMAND, "Unknown or insufficiently defined command");
LUMIERA_ERROR_DEFINE (DUPLICATE_COMMAND, "Attempt to redefine an already existing command definition");
@ -412,4 +413,4 @@ namespace control {
} // namespace control
}} // namespace proc::control

View file

@ -68,6 +68,7 @@
namespace proc {
namespace control {
using std::string;
@ -274,5 +275,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -33,12 +33,13 @@
using boost::str;
using boost::format;
using namespace lumiera;
using util::isnil;
using util::cStr;
namespace proc {
namespace control {
namespace error = lumiera::error;
/** retrieve pre-configured pattern */
HandlingPattern const&
@ -124,4 +125,4 @@ namespace control {
}
} // namespace control
}} // namespace proc::control

View file

@ -52,6 +52,7 @@
namespace proc {
namespace control {
using std::string;
@ -146,5 +147,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -49,6 +49,7 @@
namespace proc {
namespace control {
namespace { // concrete command handling patterns
@ -238,5 +239,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -29,6 +29,7 @@
namespace proc {
namespace control {
using lib::Symbol;
@ -39,9 +40,9 @@ namespace control {
protected:
virtual ~MediaImplLib() {};
typedef lumiera::StreamType::ImplFacade ImplFacade;
typedef lumiera::StreamType::ImplFacade::TypeTag TypeTag;
typedef lumiera::StreamType::ImplFacade::DataBuffer DataBuffer;
typedef StreamType::ImplFacade ImplFacade;
typedef StreamType::ImplFacade::TypeTag TypeTag;
typedef StreamType::ImplFacade::DataBuffer DataBuffer;
public:
virtual Symbol getLibID() const =0;
@ -50,5 +51,5 @@ namespace control {
};
} // namespace control
}} // namespace proc::control
#endif

View file

@ -53,6 +53,7 @@
#include <string>
namespace proc {
namespace control {
using boost::equality_comparable;
@ -213,5 +214,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -23,6 +23,7 @@
#include "proc/control/pathmanager.hpp"
namespace proc {
namespace control {
@ -30,4 +31,4 @@ namespace control {
/** */
} // namespace control
}} // namespace proc::control

View file

@ -27,6 +27,7 @@
namespace proc {
namespace control {
@ -44,5 +45,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -32,6 +32,7 @@
//#include <boost/format.hpp>
//using boost::str;
namespace proc {
namespace control {
@ -94,4 +95,4 @@ namespace control {
} // namespace control
}} // namespace proc::control

View file

@ -43,6 +43,7 @@
namespace proc {
namespace control {
// using lib::Symbol;
@ -74,5 +75,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -27,6 +27,7 @@
#include "include/lifecycle.h"
namespace proc {
namespace control {
using lib::Symbol;
@ -113,7 +114,7 @@ namespace control {
UNIMPLEMENTED ("STypeManager basic functionality: wire up implementation facade (impl type) from given raw type of the library");
}
} // namespace control
}} // namespace proc::control
// ==== C interface for registering setup of basic stream type configuration =======
@ -121,5 +122,5 @@ namespace control {
void
lumiera_StreamType_registerInitFunction (void setupFun(void))
{
lumiera::LifecycleHook (control::ON_STREAMTYPES_RESET, setupFun);
lumiera::LifecycleHook (proc::control::ON_STREAMTYPES_RESET, setupFun);
}

View file

@ -21,8 +21,8 @@
*/
#ifndef CONTROL_STYPEMANAGER_H
#define CONTROL_STYPEMANAGER_H
#ifndef PROC_CONTROL_STYPEMANAGER_H
#define PROC_CONTROL_STYPEMANAGER_H
#include "proc/streamtype.hpp"
@ -31,6 +31,7 @@
#include <boost/scoped_ptr.hpp>
namespace proc {
namespace control {
using lib::Symbol;
@ -102,12 +103,12 @@ namespace control {
}
} // namespace control
}} // namespace proc::control
namespace proc_interface {
using control::STypeManager;
using proc::control::STypeManager;
} // namespace proc_interface

View file

@ -37,6 +37,7 @@
#define CONTROL_STYPEREGISTRY_H
#include "proc/control/stypemanager.hpp"
//#include "lib/query.hpp"
//#include "lib/util.hpp"
//#include "lib/p.hpp"
@ -48,6 +49,7 @@
#include <boost/noncopyable.hpp>
namespace proc {
namespace control {
// using lib::P;
@ -63,7 +65,7 @@ namespace control {
/**
* @internal Helper for organising preconfigured default objects.
* Maintaines a collection of objects known or encountered as "default"
* Maintains a collection of objects known or encountered as "default"
* for a given type. This collection is ordered by "degree of constriction",
* which is implemented by counting the number of predicates in the query
* used to define or identify each object.
@ -73,7 +75,8 @@ namespace control {
* @todo as of 3/2008 the real query implementation is missing, and the
* exact behaviour has to be defined.
*/
class STypeManager::Registry : private boost::noncopyable
class STypeManager::Registry
: boost::noncopyable
{
public:
@ -81,6 +84,5 @@ namespace control {
} // namespace control
}} // namespace proc::control
#endif

View file

@ -59,7 +59,7 @@
namespace proc {
namespace engine {
namespace error = ::lumiera::error;
namespace error = lumiera::error;
using error::LUMIERA_ERROR_LIFECYCLE;
typedef size_t HashVal; ////////////TICKET #722

View file

@ -336,5 +336,5 @@ namespace config {
}} // namespace engine::config
}}} // namespace proc::engine::config
#endif

View file

@ -52,8 +52,8 @@
#define ENGINE_NODEWIRING_CONFIG_H
#include "lib/util.hpp"
#include "lib/meta/configflags.hpp"
#include "lib/util.hpp"
#include <tr1/functional>
#include <bitset>
@ -69,6 +69,8 @@ namespace config {
using lumiera::typelist::CONFIG_FLAGS_MAX;
typedef size_t IxID; ///////////////////////////////TICKET #863
/**
* Helper for fabricating ProcNode Wiring configurations.
@ -125,7 +127,7 @@ namespace config {
typedef std::tr1::shared_ptr<FacFunction> PFunc;
typedef std::map<size_t, PFunc> ConfigTable;
typedef std::map<IxID, PFunc> ConfigTable;
ConfigTable possibleConfig_; ///< Table of factories
@ -148,7 +150,7 @@ namespace config {
template<class CONF>
void
visit (size_t code)
visit (IxID code)
{
PFunc pFactory (new FactoryHolder<Factory<CONF> > (ctor_param_));
factories_[code] = pFactory;
@ -170,7 +172,7 @@ namespace config {
}
FacFunction&
operator[] (size_t configFlags) ///< retrieve the factory corresponding to the given config
operator[] (IxID configFlags) ///< retrieve the factory corresponding to the given config
{
if (contains (possibleConfig_, configFlags))
return *possibleConfig_[configFlags];
@ -182,5 +184,5 @@ namespace config {
}} // namespace engine::config
}}} // namespace proc::engine::config
#endif

View file

@ -150,4 +150,4 @@ namespace engine {
}
}} // namespace engine
}} // namespace proc::engine

View file

@ -57,7 +57,7 @@ namespace engine {
using std::tr1::function;
using std::tr1::placeholders::_1;
namespace error = ::lumiera::error;
namespace error = lumiera::error;
namespace { // (optional) helpers to build an object embedded into a buffer...

View file

@ -106,9 +106,8 @@ namespace mobject {
* as we simply store a pointer within the BuilderTool instance.
*/
class BuilderTool
: public ::lumiera::visitor::Tool<void, InvokeCatchAllFunction>
{
::lumiera::WrapperPtr currentWrapper_;
: public lumiera::visitor::Tool<void, InvokeCatchAllFunction>
{ lumiera::WrapperPtr currentWrapper_;
public:
@ -167,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 lumiera::visitor::Applicable<TOOLImpl, TYPELIST, BuilderTool>
{ }
;
using ::lumiera::typelist::Types; // convenience for the users of "Applicable"
using lumiera::typelist::Types; // convenience for the users of "Applicable"
}// namespace mobject::builder
@ -182,7 +181,7 @@ namespace mobject {
/**
* Marker Interface for classes visitable by Builder tools.
*/
class Buildable : public ::lumiera::visitor::Visitable<builder::BuilderTool>
class Buildable : public lumiera::visitor::Visitable<builder::BuilderTool>
{ };

View file

@ -24,19 +24,19 @@
#include "proc/mobject/builder/segmentation-tool.hpp"
using mobject::Buildable;
using mobject::session::Clip;
using mobject::session::Effect;
namespace proc {
namespace mobject {
namespace builder {
using mobject::Buildable;
using session::Clip;
using session::Effect;
using session::Fixture;
/////////////////////////////////TICKET #414
SegmentationTool::SegmentationTool(mobject::session::Fixture&)
SegmentationTool::SegmentationTool(Fixture&)
{
UNIMPLEMENTED ("create new SegmentationTool");
}

View file

@ -72,6 +72,8 @@
namespace proc {
namespace mobject {
namespace error = lumiera::error;
class MObject;

View file

@ -74,7 +74,7 @@
namespace proc {
namespace error = ::lumiera::error;
namespace error = lumiera::error;
namespace mobject {

View file

@ -33,7 +33,7 @@ namespace proc {
namespace mobject {
namespace session {
namespace error = ::lumiera::error;
namespace error = lumiera::error;
/**

View file

@ -32,7 +32,7 @@ namespace proc {
namespace asset {
class Pipe;
typedef lumiera::P<Pipe> PPipe;
typedef P<Pipe> PPipe;
}

View file

@ -39,7 +39,6 @@ namespace session {
using lib::P;
using ::lumiera::Query;
using boost::scoped_ptr;
namespace impl { class DefsRegistry; }
@ -74,14 +73,14 @@ namespace session {
* is considered \e misconfiguration.
*/
template<class TAR>
P<TAR> operator() (Query<TAR> const&);
P<TAR> operator() (lumiera::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 (Query<TAR> const&);
P<TAR> search (lumiera::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
@ -89,7 +88,7 @@ namespace session {
* @return object fulfilling the query, \c empty ptr if no solution.
*/
template<class TAR>
P<TAR> create (Query<TAR> const&);
P<TAR> create (lumiera::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,
@ -98,7 +97,7 @@ namespace session {
* @note only a weak ref to the object is stored
*/
template<class TAR>
bool define (P<TAR> const&, Query<TAR> const& =Query<TAR>());
bool define (P<TAR> const&, lumiera::Query<TAR> const& =lumiera::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

View file

@ -90,8 +90,6 @@ namespace session {
using util::for_each;
using util::has_any;
using namespace lumiera;
LUMIERA_ERROR_DEFINE (NOT_IN_SESSION, "referring to a Placement not known to the current session");
LUMIERA_ERROR_DEFINE (PLACEMENT_TYPE, "requested Placement (pointee) type not compatible with data or context");
LUMIERA_ERROR_DEFINE (NONEMPTY_SCOPE, "Placement scope (still) contains other elements");
@ -575,7 +573,7 @@ namespace session {
struct SelfCheckFailure
: error::Fatal
{
SelfCheckFailure (Literal currentTest, string failure)
SelfCheckFailure (lib::Literal currentTest, string failure)
: error::Fatal (string("Failed test: ")+currentTest+ " : "+failure
,LUMIERA_ERROR_INDEX_CORRUPTED)
{ }

View file

@ -107,6 +107,7 @@
#include "lib/util.hpp"
#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "lib/itertools.hpp"
#include "proc/mobject/placement.hpp"
#include "proc/mobject/placement-ref.hpp"
@ -170,8 +171,9 @@ namespace session {
typedef PlacementMO::ID _PID;
typedef std::tr1::unordered_multimap<_PID,_PID>::const_iterator ScopeIter;
typedef lib::RangeIter<ScopeIter> ScopeRangeIter;
typedef std::tr1::unordered_multimap<_PID,_PID>::const_iterator ScopeIter;
typedef lib::RangeIter<ScopeIter> ScopeRangeIter;
typedef lib::TransformIter<ScopeRangeIter, PlacementMO&> _ID_TableIterator;
@ -179,7 +181,7 @@ namespace session {
typedef PlacementRef<MObject> PRef;
typedef PlacementMO::ID const& ID;
typedef lib::TransformIter<ScopeRangeIter, PlacementMO&> iterator;
typedef _ID_TableIterator iterator;
/* == query operations == */

View file

@ -21,8 +21,8 @@
*/
#ifndef MOBJECT_SESSION_QUERY_RESOLVER_H
#define MOBJECT_SESSION_QUERY_RESOLVER_H
#ifndef PROC_MOBJECT_SESSION_QUERY_RESOLVER_H
#define PROC_MOBJECT_SESSION_QUERY_RESOLVER_H
//#include "proc/mobject/mobject.hpp"
//#include "proc/mobject/placement.hpp"
@ -45,6 +45,7 @@ namespace proc {
namespace mobject {
namespace session {
using lib::IxID;
using util::unConst;
using boost::noncopyable;
using boost::scoped_ptr;
@ -89,7 +90,7 @@ namespace session {
struct QueryID
{
Kind kind;
size_t type;
IxID type;
};
QueryID const&
@ -159,7 +160,7 @@ namespace session {
typedef lib::TypedContext<Goal::Result> ResultType;
template<typename RES>
inline size_t
inline IxID
getResultTypeID() ///< @return unique ID denoting result type RES
{
return ResultType::ID<RES>::get();

View file

@ -42,7 +42,6 @@ namespace session {
using util::isSameObject;
using util::isnil;
using namespace lumiera;
LUMIERA_ERROR_DEFINE (EMPTY_SCOPE_PATH, "Placement scope not locatable (empty model path)");

View file

@ -33,4 +33,4 @@ namespace session {
} // namespace proc::mobject::session
}}} // namespace proc::mobject::session

View file

@ -28,7 +28,6 @@
#include "proc/mobject/mobject.hpp"
#include "lib/error.hpp"
using namespace lumiera;
namespace proc {
namespace mobject {

View file

@ -40,15 +40,17 @@
#include "lib/singleton.hpp"
using lib::Symbol;
using lib::Singleton;
using mobject::session::SessManager;
using mobject::session::SessManagerImpl;
using mobject::session::SessionImplAPI;
namespace proc {
namespace mobject {
using lib::Symbol;
using lib::Singleton;
using session::SessManager;
using session::SessManagerImpl;
using session::SessionImplAPI;
/** temporary fix for init problems
* @todo really solve the basic init of session manager TICKET #518

View file

@ -73,7 +73,7 @@ namespace play {
: boost::noncopyable
, public lib::Sync<>
{
typedef ::lumiera::Subsys::SigTerm SigTerm;
typedef lumiera::Subsys::SigTerm SigTerm;
scoped_ptr<PlayService> player_;

View file

@ -35,8 +35,8 @@
namespace proc {
namespace engine {
using ::lumiera::FrameID;
using ::lumiera::NodeID;
using lumiera::FrameID;
using lumiera::NodeID;
class StateAdapter;
class BuffTableStorage;

View file

@ -31,8 +31,8 @@
*/
#ifndef PROC_STREAMTYPE_HPP
#define PROC_STREAMTYPE_HPP
#ifndef PROC_STREAMTYPE_H
#define PROC_STREAMTYPE_H
#include "lib/symbol.hpp"

View file

@ -511,7 +511,7 @@ return: 0
END
PLANNED "RefArray_test" RefArray_test <<END
TEST "RefArray_test" RefArray_test <<END
return: 0
END

View file

@ -34,14 +34,14 @@ END
TEST "plain entry-ID" EntryID_test <<END
out: ID<..asset.+Dummy.>-..asset.+Dummy.\.001
out: ID<..asset.+Dummy.>-strange
out: ID<..asset.+Dummy.>-..asset.+Dummy.\.002
out: ID<..proc.asset.+Dummy.>-..proc.asset.+Dummy.\.001
out: ID<..proc.asset.+Dummy.>-strange
out: ID<..proc.asset.+Dummy.>-..proc.asset.+Dummy.\.002
out: ID<track>-track\.001
out: ID<track>-track\.002
out: ID<track>-special
out: sizeof\( ..asset.+EntryID.+mobject.+session.+Track.+ \) =
out: sizeof\( ..asset.+BareEntryID. \) =
out: sizeof\( ..proc.asset.+EntryID.+mobject.+session.+Track.+ \) =
out: sizeof\( ..proc.asset.+BareEntryID. \) =
return: 0
END

View file

@ -44,40 +44,40 @@ END
TEST "external MObject references" MObjectRef_test <<END
out: MRef-NIL
out: sizeof\( .+MORef.+session.Clip.+ \) = (32|24)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: Asset\(VIDEO:lumi.test-1 v1\)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: MRef-NIL
out: sizeof\( .+MORef.+session.Clip.+ \) = (32|24)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: Asset\(VIDEO:lumi.test-2 v1\)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: MRef-NIL
out: sizeof\( .+MORef.+session.Clip.+ \) = (32|24)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: Asset\(VIDEO:lumi.test-1 v1\)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: MRef-NIL
out: sizeof\( .+MORef.+session.Clip.+ \) = (32|24)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: Asset\(VIDEO:lumi.test-2 v1\)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: MRef-NIL
out: sizeof\( .+MORef.+session.Clip.+ \) = (32|24)
out: Placement<.+Clip.>.+ use-cnt=4
out: Asset\(VIDEO:lumi.test-1 v1\)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: MRef-NIL
out: sizeof\( .+MORef.+session.Clip.+ \) = (32|24)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: Asset\(VIDEO:lumi.test-1 v1\)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: MRef-NIL
out: sizeof\( .+MORef.+session.Clip.+ \) = (32|24)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=4
out: Asset\(VIDEO:lumi.test-2 v1\)
out: Placement<.+Clip.> ............... use-cnt=4
out: Placement<.+Clip.> ............... use-cnt=5
out: Placement<.+Clip.> .......... use-cnt=4
out: Placement<.+Clip.> .......... use-cnt=5
out: \(VIDEO:lumi.test-1 v1\)
END
@ -105,7 +105,7 @@ END
TEST "PlacementRef_test" PlacementRef_test <<END
out: Placement<.+TestSubMO21.> .......... use-cnt=2
out: Placement<.+TestSubMO21.> ..... use-cnt=2
out: specialAPI()
END
@ -127,13 +127,13 @@ END
TEST "Querying the index" PlacementIndexQuery_test <<END
out: explore contents depth-first...
out: Placement<.+TestSubMO21.> .......... use-cnt=1
out: Placement<.+TestSubMO2.> ........... use-cnt=1
out: Placement<.+TestSubMO1.> ........... use-cnt=1
out: Placement<.+DummyMO.> ............... use-cnt=1
out: Placement<.+TestSubMO21.> ..... use-cnt=1
out: Placement<.+TestSubMO2.> ...... use-cnt=1
out: Placement<.+TestSubMO1.> ...... use-cnt=1
out: Placement<.+DummyMO.> .......... use-cnt=1
out: path to root starting at Placement<.+TestSubMO1
out: Placement<.+TestSubMO2.> ........... use-cnt=1
out: Placement<.+session.Label.> .............. use-cnt=1
out: Placement<.+TestSubMO2.> ...... use-cnt=1
out: Placement<.+session.Label.> ......... use-cnt=1
END

View file

@ -90,7 +90,7 @@ namespace test {
};
int Response::_i_(0);
const ChanDesc NULLResponse;
using mobject::session::test::LENGTH_TestClip;
using proc::mobject::session::test::LENGTH_TestClip;
struct TestCases : map<string,Response>

View file

@ -36,6 +36,7 @@ using std::string;
using std::cout;
namespace proc {
namespace asset{
namespace test {
@ -138,4 +139,4 @@ namespace test {
}} // namespace asset::test
}}} // namespace proc::asset::test

View file

@ -50,6 +50,7 @@ using std::string;
using std::cout;
namespace proc {
namespace asset {
inline void

View file

@ -42,174 +42,173 @@ using std::string;
using std::cout;
namespace proc {
namespace asset {
namespace test {
using mobject::Session;
using lumiera::Query;
using lumiera::query::normaliseID;
using mobject::Session;
using lumiera::Query;
using lumiera::query::normaliseID;
/***********************************************************************
* @test basic properties of Pipe (structural) Assets.
* <ul><li>created by referral</li>
* <li>access existing pipe by referral</li>
* <li>create with full properties</li>
* <li>access ProcPatt</li>
* <li>check dependency</li>
* </ul>
*/
class BasicPipe_test : public Test
{
virtual void run(Arg arg)
{
string pipeID = isnil(arg)? "Black Hole" : arg[1];
string streamID = 2>arg.size()? "teststream" : arg[2] ;
createExplicit (pipeID,streamID);
create_or_ref (pipeID);
create_using_default ();
dependProcPatt (pipeID);
}
/***********************************************************************
* @test basic properties of Pipe (structural) Assets.
* <ul><li>created by referral</li>
* <li>access existing pipe by referral</li>
* <li>create with full properties</li>
* <li>access ProcPatt</li>
* <li>check dependency</li>
* </ul>
*/
class BasicPipe_test : public Test
{
virtual void run(Arg arg)
{
string pipeID = isnil(arg)? "Black Hole" : arg[1];
string streamID = 2>arg.size()? "teststream" : arg[2] ;
createExplicit (pipeID,streamID);
create_or_ref (pipeID);
create_using_default ();
dependProcPatt (pipeID);
}
void createExplicit (string pID, string sID)
{
string pID_sane (pID);
normaliseID (pID_sane);
CHECK (pID_sane != pID);
PPipe thePipe = asset::Struct::retrieve.newPipe (pID,sID);
CHECK (thePipe);
CHECK (thePipe->getProcPatt());
CHECK (thePipe->getPipeID() == pID_sane);
CHECK (thePipe->getStreamID() == StreamType::ID(sID));
CHECK (thePipe->shortDesc == pID_sane);
Asset::Ident idi = thePipe->ident;
CHECK (idi.org == "lumi");
CHECK (contains (idi.name, thePipe->getPipeID()));
CHECK (contains (idi.name, thePipe->getStreamID()));
Category cat (idi.category);
Category refcat (STRUCT,"pipes");
CHECK ( cat.hasKind(STRUCT) );
CHECK ( cat.isWithin(refcat) );
}
void create_or_ref(string pID)
{
normaliseID (pID);
PPipe pipe1 = Pipe::query ("pipe("+pID+")");
CHECK (pipe1);
CHECK (pipe1->getPipeID() == pID);
string pID2 = "another-" + pID;
PPipe pipe2 = Pipe::query ("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+")");
void createExplicit (string pID, string sID)
{
string pID_sane (pID);
normaliseID (pID_sane);
CHECK (pID_sane != pID);
PPipe thePipe = asset::Struct::retrieve.newPipe (pID,sID);
CHECK (thePipe);
CHECK (thePipe->getProcPatt());
CHECK (thePipe->getPipeID() == pID_sane);
CHECK (thePipe->getStreamID() == StreamType::ID(sID));
CHECK (thePipe->shortDesc == pID_sane);
Asset::Ident idi = thePipe->ident;
CHECK (idi.org == "lumi");
CHECK (contains (idi.name, thePipe->getPipeID()));
CHECK (contains (idi.name, thePipe->getStreamID()));
Category cat (idi.category);
Category refcat (STRUCT,"pipes");
CHECK ( cat.hasKind(STRUCT) );
CHECK ( cat.isWithin(refcat) );
}
void create_or_ref(string pID)
{
normaliseID (pID);
PPipe pipe1 = Pipe::query ("pipe("+pID+")");
CHECK (pipe1);
CHECK (pipe1->getPipeID() == pID);
string pID2 = "another-" + pID;
PPipe pipe2 = Pipe::query ("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+")");
//////////////////////////////////////////////////////////////TODO: that's broken; creating a new one instead to find the existing one, as it should be
CHECK (pipe3 == pipe2);
}
void create_using_default()
{
PPipe pipe1 = Pipe::query (""); // "the default pipe"
PPipe pipe2;
CHECK (pipe1);
CHECK (pipe1 == Session::current->defaults (Query<Pipe>()));
CHECK (pipe1->ident.category.hasKind(VIDEO));
CHECK (pipe1->getProcPatt());
PProcPatt propa = Session::current->defaults (Query<const ProcPatt>("pipe(default)"));
CHECK (propa == pipe1->getProcPatt());
// several variants to query for "the default pipe"
pipe2 = Session::current->defaults(Query<Pipe> ());
CHECK (pipe2 == pipe1);
pipe2 = asset::Struct::retrieve (Query<Pipe> ());
CHECK (pipe2 == pipe1);
pipe2 = asset::Struct::retrieve (Query<Pipe> ("pipe(default)"));
CHECK (pipe2 == pipe1);
string sID = pipe1->getStreamID(); // sort of a "default stream type"
PPipe pipe3 = Pipe::query ("stream("+sID+")");
CHECK (pipe3);
CHECK (pipe3->getStreamID() == StreamType::ID(sID));
CHECK (pipe3->getProcPatt() == Session::current->defaults (Query<const ProcPatt>("stream("+sID+")")));
}
void dependProcPatt(string pID)
{
typedef P<Pipe> PPipe; /////TODO: transition to P<>
typedef P<const ProcPatt> PProcPatt;
PPipe thePipe = Pipe::query ("pipe("+pID+")");
CHECK (thePipe);
PProcPatt thePatt = thePipe->getProcPatt();
CHECK (thePatt);
CHECK (dependencyCheck (thePipe, thePatt));
PProcPatt pattern2 = thePatt->newCopy("another");
CHECK (thePatt != pattern2);
CHECK (!dependencyCheck (thePipe, pattern2));
TODO ("add something to the new pattern, e.g. an effect");
// 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)");
CHECK (pattern2 == pipe2x->getProcPatt());
CHECK (pipe2x == Session::current->defaults (Query<Pipe>("pattern(another)")));
thePipe->switchProcPatt(pattern2);
CHECK ( dependencyCheck (thePipe, pattern2));
CHECK (!dependencyCheck (thePipe, thePatt));
AssetManager& aMang = AssetManager::instance();
CHECK ( aMang.known (thePipe->getID()));
CHECK ( aMang.known (thePatt->getID()));
CHECK ( aMang.known (pattern2->getID()));
aMang.remove (pattern2->getID());
CHECK ( aMang.known (thePatt->getID()));
CHECK (!aMang.known (pattern2->getID()));
CHECK (!aMang.known (thePipe->getID())); // has been unlinked too, because dependant on pattern2
CHECK (thePipe);
PProcPatt pattern3 = thePipe->getProcPatt(); /////TODO: transition to P<>
CHECK (thePipe->getProcPatt());
CHECK ( pattern3 == pattern2); // but is still valid, as long as the ref is alive....
PPipe pipe3x = Pipe::query ("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)")));
CHECK (pipe3x != pipe2x); // ..we got a new default pipe for "pattern(another)" too!
TRACE (asset_mem, "leaving BasicPipe_test::dependProcPatt()");
// expect now pipe2x and pattern2 to be destroyed...
}
};
/** Register this test class... */
LAUNCHER (BasicPipe_test, "unit asset");
} // namespace test
} // namespace asset
CHECK (pipe3 == pipe2);
}
void create_using_default()
{
PPipe pipe1 = Pipe::query (""); // "the default pipe"
PPipe pipe2;
CHECK (pipe1);
CHECK (pipe1 == Session::current->defaults (Query<Pipe>()));
CHECK (pipe1->ident.category.hasKind(VIDEO));
CHECK (pipe1->getProcPatt());
PProcPatt propa = Session::current->defaults (Query<const ProcPatt>("pipe(default)"));
CHECK (propa == pipe1->getProcPatt());
// several variants to query for "the default pipe"
pipe2 = Session::current->defaults(Query<Pipe> ());
CHECK (pipe2 == pipe1);
pipe2 = asset::Struct::retrieve (Query<Pipe> ());
CHECK (pipe2 == pipe1);
pipe2 = asset::Struct::retrieve (Query<Pipe> ("pipe(default)"));
CHECK (pipe2 == pipe1);
string sID = pipe1->getStreamID(); // sort of a "default stream type"
PPipe pipe3 = Pipe::query ("stream("+sID+")");
CHECK (pipe3);
CHECK (pipe3->getStreamID() == StreamType::ID(sID));
CHECK (pipe3->getProcPatt() == Session::current->defaults (Query<const ProcPatt>("stream("+sID+")")));
}
void dependProcPatt(string pID)
{
typedef P<Pipe> PPipe; /////TODO: transition to P<>
typedef P<const ProcPatt> PProcPatt;
PPipe thePipe = Pipe::query ("pipe("+pID+")");
CHECK (thePipe);
PProcPatt thePatt = thePipe->getProcPatt();
CHECK (thePatt);
CHECK (dependencyCheck (thePipe, thePatt));
PProcPatt pattern2 = thePatt->newCopy("another");
CHECK (thePatt != pattern2);
CHECK (!dependencyCheck (thePipe, pattern2));
TODO ("add something to the new pattern, e.g. an effect");
// 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)");
CHECK (pattern2 == pipe2x->getProcPatt());
CHECK (pipe2x == Session::current->defaults (Query<Pipe>("pattern(another)")));
thePipe->switchProcPatt(pattern2);
CHECK ( dependencyCheck (thePipe, pattern2));
CHECK (!dependencyCheck (thePipe, thePatt));
AssetManager& aMang = AssetManager::instance();
CHECK ( aMang.known (thePipe->getID()));
CHECK ( aMang.known (thePatt->getID()));
CHECK ( aMang.known (pattern2->getID()));
aMang.remove (pattern2->getID());
CHECK ( aMang.known (thePatt->getID()));
CHECK (!aMang.known (pattern2->getID()));
CHECK (!aMang.known (thePipe->getID())); // has been unlinked too, because dependant on pattern2
CHECK (thePipe);
PProcPatt pattern3 = thePipe->getProcPatt(); /////TODO: transition to P<>
CHECK (thePipe->getProcPatt());
CHECK ( pattern3 == pattern2); // but is still valid, as long as the ref is alive....
PPipe pipe3x = Pipe::query ("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)")));
CHECK (pipe3x != pipe2x); // ..we got a new default pipe for "pattern(another)" too!
TRACE (asset_mem, "leaving BasicPipe_test::dependProcPatt()");
// expect now pipe2x and pattern2 to be destroyed...
}
};
/** Register this test class... */
LAUNCHER (BasicPipe_test, "unit asset");
}}} // namespace proc::asset::test

View file

@ -35,73 +35,70 @@ using util::isnil;
using std::string;
namespace asset
{
namespace test
namespace proc {
namespace asset{
namespace test {
/***********************************************************************
* Verifying the special operations available for compound media assets
* comprised of several elementary media assets.
*/
class CompoundMedia_test : public Test
{
/***********************************************************************
* Verifying the special operations available for compound media assets
* comprised of several elementary media assets.
*/
class CompoundMedia_test : public Test
{
virtual void run(Arg arg)
{
buildCompound();
modifyCompound();
verifyClipStructure();
if (!isnil (arg))
dumpAssetManager();
TRACE (asset_mem, "leaving CreateAsset_test::run()");
}
typedef shared_ptr<asset::Media> PM;
/** @test building a compound media asset by using a special
* factory, normally intended for loading existing sessions.
*/
void buildCompound()
{
UNIMPLEMENTED ("create new compound media");
}
/** @test adding and removing elementary media.
*/
void modifyCompound()
{
UNIMPLEMENTED ("add and remove elementary media to compound media asset");
}
/** @test create a (compound) clip from some compound media asset
* and verify the clip mirrors the media asset's structure
*/
void verifyClipStructure()
{
UNIMPLEMENTED ("create compound clip from compound media and verify structure");
}
bool checkProperties (PM object, Asset::Ident identity, string filename)
{
return identity == object->ident
&& filename == object->getFilename();
}
};
/** Register this test class... */
LAUNCHER (CompoundMedia_test, "unit asset");
} // namespace test
} // namespace asset
virtual void run(Arg arg)
{
buildCompound();
modifyCompound();
verifyClipStructure();
if (!isnil (arg))
dumpAssetManager();
TRACE (asset_mem, "leaving CreateAsset_test::run()");
}
typedef shared_ptr<asset::Media> PM;
/** @test building a compound media asset by using a special
* factory, normally intended for loading existing sessions.
*/
void buildCompound()
{
UNIMPLEMENTED ("create new compound media");
}
/** @test adding and removing elementary media.
*/
void modifyCompound()
{
UNIMPLEMENTED ("add and remove elementary media to compound media asset");
}
/** @test create a (compound) clip from some compound media asset
* and verify the clip mirrors the media asset's structure
*/
void verifyClipStructure()
{
UNIMPLEMENTED ("create compound clip from compound media and verify structure");
}
bool checkProperties (PM object, Asset::Ident identity, string filename)
{
return identity == object->ident
&& filename == object->getFilename();
}
};
/** Register this test class... */
LAUNCHER (CompoundMedia_test, "unit asset");
}}} // namespace proc::asset::test

View file

@ -37,7 +37,8 @@ using util::isnil;
using std::string;
namespace asset {
namespace proc {
namespace asset{
namespace test {
@ -205,4 +206,4 @@ namespace test {
}} // namespace asset::test
}}} // namespace proc::asset::test

View file

@ -32,36 +32,33 @@ using std::string;
using std::cout;
namespace asset
{
namespace test
namespace proc {
namespace asset{
namespace test {
/*******************************************************************
* @test deleting an Asset includes removing all dependent Assets
* and all MObjects relying on these. Especially this means
* breaking all links between the involved Objects, so the
* shared-ptrs can do the actual cleanup.
* @see asset::Asset#unlink
* @see mobject::MObject#unlink
*/
class DeleteAsset_test : public Test
{
/*******************************************************************
* @test deleting an Asset includes removing all dependent Assets
* and all MObjects relying on these. Especially this means
* breaking all links between the involved Objects, so the
* shared-ptrs can do the actual cleanup.
* @see asset::Asset#unlink
* @see mobject::MObject#unlink
*/
class DeleteAsset_test : public Test
{
virtual void run(Arg)
{
UNIMPLEMENTED ("delete asset and update all dependencies");
}
};
/** Register this test class... */
LAUNCHER (DeleteAsset_test, "function asset");
} // namespace test
} // namespace asset
virtual void run(Arg)
{
UNIMPLEMENTED ("delete asset and update all dependencies");
}
};
/** Register this test class... */
LAUNCHER (DeleteAsset_test, "function asset");
}}} // namespace proc::asset::test

View file

@ -35,181 +35,181 @@ using util::isnil;
namespace proc {
namespace asset{
namespace test {
/*******************************************************************
* @test the handling of Assets dependent on other Assets and the
* enabling/disabling of Assets.
* @see asset::Asset
* @see asset::Clip
*/
class DependentAssets_test : public Test
{
virtual void run (Arg)
{
checkDependencyMechanics ();
checkUnlinking ();
checkEnablementPropagation ();
checkRealAssetDependencyRegistration ();
}
typedef TestAsset<Asset> TA;
typedef TA::PA PTestA;
/** @test check operation of basic asset dependency support
*/
void checkDependencyMechanics ()
{
PAsset a1 = TA::create();
CHECK (isnil (a1->getParents()));
CHECK (isnil (a1->getDependant()));
PTestA a2 = TA::create(a1);
CHECK (a1 == a2->getParents()[0]); // TestAsset registered a1 as parent
CHECK (a2 == a1->getDependant()[0]);
PAsset a3 = TA::create();
a2->set_depend(a3);
CHECK (a3 == a2->getParents()[1]);
CHECK (a2 == a3->getDependant()[0]);
CHECK (!contains (a1->getDependant(), a3));
}
/** @test unlink operation removing inter asset links
*/
void checkUnlinking ()
{
PTestA a1_ = TA::create();
PAsset a1 (a1_);
PTestA a2_ = TA::create(a1);
PAsset a2 (a2_);
PAsset a3 = TA::create(a2);
CHECK (a1 == a2->getParents()[0]);
CHECK (a2 == a1->getDependant()[0]);
CHECK (a2 == a3->getParents()[0]);
CHECK (a3 == a2->getDependant()[0]);
a2_->call_unlink();
CHECK (isnil (a2->getDependant()));
CHECK (!contains (a1->getDependant(), a2)); // has been propagated up
CHECK (!isnil (a2->getParents()));
CHECK (contains (a3->getParents(), a2)); // but up-links remain intact
a2_->call_unlink(a1->getID());
a2_->set_depend(a1);
PAsset a4 = TA::create(a1);
CHECK (a1 == a2->getParents()[0]);
CHECK (a1 == a4->getParents()[0]);
CHECK (a2 == a1->getDependant()[0]);
CHECK (a4 == a1->getDependant()[1]);
a1_->call_unlink(a4->getID());
CHECK (!contains (a1->getDependant(), a4)); // selectively removed
CHECK ( contains (a1->getDependant(), a2));
CHECK (a1 == a4->getParents()[0]); // no propagation
}
/** @test enabling and disabling an asset should
* propagate to dependant assets
*/
void checkEnablementPropagation ()
{
PAsset a1 = TA::create();
PTestA a2_= TA::create(a1);
PAsset a2 (a2_);
PAsset a3 = TA::create(); // not dependant
CHECK (a1->isActive());
CHECK (a2->isActive());
CHECK (a3->isActive());
a1->enable(false);
CHECK (!a1->isActive());
CHECK (!a2->isActive());
CHECK (a3->isActive());
a2->enable(true);
CHECK (!a1->isActive());
CHECK (!a2->isActive()); // ignored because parent is disabled
a1->enable(true);
CHECK (a1->isActive());
CHECK (a2->isActive());
a2->enable(false);
CHECK (a1->isActive());
CHECK (!a2->isActive()); // disabling not propagated to parent
a2->enable(true);
CHECK (a1->isActive());
CHECK (a2->isActive());
a3->enable(false);
CHECK (a1->isActive());
CHECK (a2->isActive());
CHECK (!a3->isActive()); // no dependency...
a1->enable(false);
a3->enable();
CHECK (!a1->isActive());
CHECK (!a2->isActive());
CHECK (a3->isActive());
a1->enable();
a2_->set_depend(a3); // now add a new parent dependency
a3->enable(false);
CHECK (a1->isActive());
CHECK (!a2->isActive()); // has been propagated via the new dependency
CHECK (!a3->isActive());
a2->enable(true);
CHECK (a1->isActive()); // no change because one of the parents is disbled
CHECK (!a2->isActive());
CHECK (!a3->isActive());
a1->enable(false);
CHECK (!a1->isActive());
a3->enable(true);
CHECK (!a1->isActive()); // no propagation because the disabled other parent (a1)
CHECK (!a2->isActive());
CHECK (a3->isActive());
a1->enable(true);
CHECK (a1->isActive()); // but now propagation is possible
CHECK (a2->isActive());
CHECK (a3->isActive());
}
/** @test each real world asset subclass has to care
* for registering and deregistering any additional
* dependencies. Here we collect some more prominent
* examples (and hopefully don't fail to cover any
* important special cases...)
*/
void checkRealAssetDependencyRegistration ()
{
Use4Test<backend::test::MediaAccessMock> within_this_scope;
// -----Media and Clip--------------------------------
typedef P<Media> PM;
typedef P<Clip> PC;
PM mm = asset::Media::create("test-1", VIDEO);
PC cc = mm->createClip()->findClipAsset();
CHECK (dependencyCheck (cc,mm));
}
};
/** Register this test class... */
LAUNCHER (DependentAssets_test, "unit function asset");
}} // namespace asset::test
/*******************************************************************
* @test the handling of Assets dependent on other Assets and the
* enabling/disabling of Assets.
* @see asset::Asset
* @see asset::Clip
*/
class DependentAssets_test : public Test
{
virtual void run (Arg)
{
checkDependencyMechanics ();
checkUnlinking ();
checkEnablementPropagation ();
checkRealAssetDependencyRegistration ();
}
typedef TestAsset<Asset> TA;
typedef TA::PA PTestA;
/** @test check operation of basic asset dependency support
*/
void checkDependencyMechanics ()
{
PAsset a1 = TA::create();
CHECK (isnil (a1->getParents()));
CHECK (isnil (a1->getDependant()));
PTestA a2 = TA::create(a1);
CHECK (a1 == a2->getParents()[0]); // TestAsset registered a1 as parent
CHECK (a2 == a1->getDependant()[0]);
PAsset a3 = TA::create();
a2->set_depend(a3);
CHECK (a3 == a2->getParents()[1]);
CHECK (a2 == a3->getDependant()[0]);
CHECK (!contains (a1->getDependant(), a3));
}
/** @test unlink operation removing inter asset links
*/
void checkUnlinking ()
{
PTestA a1_ = TA::create();
PAsset a1 (a1_);
PTestA a2_ = TA::create(a1);
PAsset a2 (a2_);
PAsset a3 = TA::create(a2);
CHECK (a1 == a2->getParents()[0]);
CHECK (a2 == a1->getDependant()[0]);
CHECK (a2 == a3->getParents()[0]);
CHECK (a3 == a2->getDependant()[0]);
a2_->call_unlink();
CHECK (isnil (a2->getDependant()));
CHECK (!contains (a1->getDependant(), a2)); // has been propagated up
CHECK (!isnil (a2->getParents()));
CHECK (contains (a3->getParents(), a2)); // but up-links remain intact
a2_->call_unlink(a1->getID());
a2_->set_depend(a1);
PAsset a4 = TA::create(a1);
CHECK (a1 == a2->getParents()[0]);
CHECK (a1 == a4->getParents()[0]);
CHECK (a2 == a1->getDependant()[0]);
CHECK (a4 == a1->getDependant()[1]);
a1_->call_unlink(a4->getID());
CHECK (!contains (a1->getDependant(), a4)); // selectively removed
CHECK ( contains (a1->getDependant(), a2));
CHECK (a1 == a4->getParents()[0]); // no propagation
}
/** @test enabling and disabling an asset should
* propagate to dependant assets
*/
void checkEnablementPropagation ()
{
PAsset a1 = TA::create();
PTestA a2_= TA::create(a1);
PAsset a2 (a2_);
PAsset a3 = TA::create(); // not dependant
CHECK (a1->isActive());
CHECK (a2->isActive());
CHECK (a3->isActive());
a1->enable(false);
CHECK (!a1->isActive());
CHECK (!a2->isActive());
CHECK (a3->isActive());
a2->enable(true);
CHECK (!a1->isActive());
CHECK (!a2->isActive()); // ignored because parent is disabled
a1->enable(true);
CHECK (a1->isActive());
CHECK (a2->isActive());
a2->enable(false);
CHECK (a1->isActive());
CHECK (!a2->isActive()); // disabling not propagated to parent
a2->enable(true);
CHECK (a1->isActive());
CHECK (a2->isActive());
a3->enable(false);
CHECK (a1->isActive());
CHECK (a2->isActive());
CHECK (!a3->isActive()); // no dependency...
a1->enable(false);
a3->enable();
CHECK (!a1->isActive());
CHECK (!a2->isActive());
CHECK (a3->isActive());
a1->enable();
a2_->set_depend(a3); // now add a new parent dependency
a3->enable(false);
CHECK (a1->isActive());
CHECK (!a2->isActive()); // has been propagated via the new dependency
CHECK (!a3->isActive());
a2->enable(true);
CHECK (a1->isActive()); // no change because one of the parents is disbled
CHECK (!a2->isActive());
CHECK (!a3->isActive());
a1->enable(false);
CHECK (!a1->isActive());
a3->enable(true);
CHECK (!a1->isActive()); // no propagation because the disabled other parent (a1)
CHECK (!a2->isActive());
CHECK (a3->isActive());
a1->enable(true);
CHECK (a1->isActive()); // but now propagation is possible
CHECK (a2->isActive());
CHECK (a3->isActive());
}
/** @test each real world asset subclass has to care
* for registering and deregistering any additional
* dependencies. Here we collect some more prominent
* examples (and hopefully don't fail to cover any
* important special cases...)
*/
void checkRealAssetDependencyRegistration ()
{
Use4Test<backend::test::MediaAccessMock> within_this_scope;
// -----Media and Clip--------------------------------
typedef P<Media> PM;
typedef P<Clip> PC;
PM mm = asset::Media::create("test-1", VIDEO);
PC cc = mm->createClip()->findClipAsset();
CHECK (dependencyCheck (cc,mm));
}
};
/** Register this test class... */
LAUNCHER (DependentAssets_test, "unit function asset");
}}} // namespace proc::asset::test

View file

@ -46,9 +46,12 @@ using std::endl;
namespace proc {
namespace asset{
namespace test {
using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
namespace { // Test definitions...
struct Dummy { };
@ -280,4 +283,4 @@ namespace test {
LAUNCHER (EntryID_test, "unit asset");
}} // namespace asset::test
}}} // namespace proc::asset::test

View file

@ -37,7 +37,8 @@ using util::isnil;
using std::string;
namespace asset {
namespace proc {
namespace asset{
namespace test {
@ -105,4 +106,4 @@ namespace test {
}} // namespace asset::test
}}} // namespace proc::asset::test

View file

@ -39,54 +39,53 @@ using std::string;
using std::tr1::static_pointer_cast; //TODO only temporarily;
namespace asset {
namespace test {
//using mobject::NOBUG_FLAG(mobject_mem);
/***********************************************************************
* @test creating a Clip MObject and an associated Clip Asset from
* a given asset::Media.
* @see asset::Media#createClip
*/
class MakeClip_test : public Test
{
typedef P<asset::Media> PM;
typedef asset::Media::PClipMO PC;
virtual void run (Arg)
{
Use4Test<backend::test::MediaAccessMock> within_this_scope;
PM mm = asset::Media::create("test-1", VIDEO);
PC cc = mm->createClip();
PM cm = cc->getMedia();
CHECK (cm);
CHECK (!isnil (cc->getLength()));
CHECK (cm->ident.category.hasKind (VIDEO));
CHECK (cm->getFilename() == mm->getFilename());
namespace proc {
namespace asset{
namespace test {
//using mobject::NOBUG_FLAG(mobject_mem);
/***********************************************************************
* @test creating a Clip MObject and an associated Clip Asset from
* a given asset::Media.
* @see asset::Media#createClip
*/
class MakeClip_test : public Test
{
typedef P<asset::Media> PM;
typedef asset::Media::PClipMO PC;
virtual void run (Arg)
{
Use4Test<backend::test::MediaAccessMock> within_this_scope;
PM mm = asset::Media::create("test-1", VIDEO);
PC cc = mm->createClip();
PM cm = cc->getMedia();
CHECK (cm);
CHECK (!isnil (cc->getLength()));
CHECK (cm->ident.category.hasKind (VIDEO));
CHECK (cm->getFilename() == mm->getFilename());
TODO ("implement Processing Pattern!!!");
// CHECK (cm->howtoProc() == mm->howtoProc());
CHECK (cm->ident.org == mm->ident.org);
CHECK (dependencyCheck (cm,mm));
TRACE (asset_mem, "leaving MakeClip_test::run()");
TRACE (mobject_mem, "leaving MakeClip_test::run()");
}
};
/** Register this test class... */
LAUNCHER (MakeClip_test, "function asset");
} // namespace test
} // namespace asset
CHECK (cm->ident.org == mm->ident.org);
CHECK (dependencyCheck (cm,mm));
TRACE (asset_mem, "leaving MakeClip_test::run()");
TRACE (mobject_mem, "leaving MakeClip_test::run()");
}
};
/** Register this test class... */
LAUNCHER (MakeClip_test, "function asset");
}}} // namespace proc::asset::test

View file

@ -34,35 +34,32 @@ using util::isnil;
using std::string;
namespace asset
{
namespace test
namespace proc {
namespace asset{
namespace test {
/***********************************************************************
* This test documents the Interface used by MediaFactory when loading
* media files for querying Lumiera's backend layer for information
* on how the media file is structured.
*/
class MediaStructureQuery_test : public Test
{
/***********************************************************************
* This test documents the Interface used by MediaFactory when loading
* media files for querying Lumiera's backend layer for information
* on how the media file is structured.
*/
class MediaStructureQuery_test : public Test
{
virtual void run(Arg)
{
UNIMPLEMENTED ("querying media file structure from backend");
}
};
/** Register this test class... */
LAUNCHER (MediaStructureQuery_test, "unit asset");
} // namespace test
} // namespace asset
virtual void run(Arg)
{
UNIMPLEMENTED ("querying media file structure from backend");
}
};
/** Register this test class... */
LAUNCHER (MediaStructureQuery_test, "unit asset");
}}} // namespace proc::asset::test

View file

@ -40,6 +40,7 @@ using std::endl;
namespace proc {
namespace asset{
namespace meta {
namespace test {
@ -129,4 +130,4 @@ namespace test {
LAUNCHER (TimeGridBasics_test, "unit asset");
}}} // namespace asset::meta::test
}}}} // namespace proc::asset::meta::test

View file

@ -36,98 +36,97 @@ using util::isnil;
using std::string;
namespace asset {
namespace test {
/******************************************************
* @test validate the equality and order relations of
* Asset::Ident and Asset objects.
* @note a known problem is that only Asset smart ptrs
* are supported for comparison, not smartpointers
* of Asset subclasses. To solve this, we would
* either have to repeat the operator definitions,
* or resort to template metaprogramming tricks.
* Just providing templated comparison operators
* would generally override the behaviour of
* std::shared_ptr, which is not desirable.
* @see Asset::Ident#compare
*/
class OrderingOfAssets_test : public Test
{
virtual void run(Arg)
{
Use4Test<backend::test::MediaAccessMock> within_this_scope;
Asset::Ident key1("test-1", Category(AUDIO), "ichthyo", 5);
PAsset mm1 = asset::Media::create(key1, "Name-1");
Asset::Ident key2("test-1", Category(AUDIO), "ichthyo", 7);
PAsset mm2 = asset::Media::create(key2, "Name-2");
Asset::Ident key3("test-2", Category(AUDIO), "ichthyo", 5);
PAsset mm3 = asset::Media::create(key3, "Name-3");
Asset::Ident key4("test-2", Category(AUDIO), "stega", 5);
PAsset mm4 = asset::Media::create(key4, "Name-4");
Asset::Ident key5("test-1", Category(VIDEO), "ichthyo", 5);
PAsset mm5 = asset::Media::create(key5, "Name-5");
// ordering of keys
CHECK (key1 == key2);
CHECK (key2 != key3);
CHECK (key3 != key4);
CHECK (key4 != key5);
CHECK (key1 != key5);
CHECK ( 0 > key2.compare(key3));
CHECK ( 0 < key3.compare(key2));
CHECK ( 0 > key3.compare(key4));
CHECK ( 0 > key4.compare(key5));
CHECK ( 0 > key1.compare(key5));
CHECK ( 0 > key2.compare(key5));
CHECK ( 0 > key3.compare(key5));
CHECK ( 0 > key1.compare(key3));
CHECK ( 0 > key1.compare(key4));
CHECK ( 0 > key2.compare(key4));
// ordering of Asset smart ptrs
CHECK (mm1 == mm2);
CHECK (mm2 != mm3);
CHECK (mm3 != mm4);
CHECK (mm4 != mm5);
CHECK (mm1 != mm5);
CHECK (mm2 < mm3);
CHECK (mm2 <= mm3);
CHECK (mm3 > mm2);
CHECK (mm3 >= mm2);
CHECK (mm3 < mm4);
CHECK (mm4 < mm5);
CHECK (mm1 < mm5);
CHECK (mm2 < mm5);
CHECK (mm3 < mm5);
CHECK (mm1 < mm3);
CHECK (mm1 < mm4);
CHECK (mm2 < mm4);
}
};
/** Register this test class... */
LAUNCHER (OrderingOfAssets_test, "unit asset");
} // namespace test
} // namespace asset
namespace proc {
namespace asset{
namespace test {
/******************************************************
* @test validate the equality and order relations of
* Asset::Ident and Asset objects.
* @note a known problem is that only Asset smart ptrs
* are supported for comparison, not smartpointers
* of Asset subclasses. To solve this, we would
* either have to repeat the operator definitions,
* or resort to template metaprogramming tricks.
* Just providing templated comparison operators
* would generally override the behaviour of
* std::shared_ptr, which is not desirable.
* @see Asset::Ident#compare
*/
class OrderingOfAssets_test : public Test
{
virtual void run(Arg)
{
Use4Test<backend::test::MediaAccessMock> within_this_scope;
Asset::Ident key1("test-1", Category(AUDIO), "ichthyo", 5);
PAsset mm1 = asset::Media::create(key1, "Name-1");
Asset::Ident key2("test-1", Category(AUDIO), "ichthyo", 7);
PAsset mm2 = asset::Media::create(key2, "Name-2");
Asset::Ident key3("test-2", Category(AUDIO), "ichthyo", 5);
PAsset mm3 = asset::Media::create(key3, "Name-3");
Asset::Ident key4("test-2", Category(AUDIO), "stega", 5);
PAsset mm4 = asset::Media::create(key4, "Name-4");
Asset::Ident key5("test-1", Category(VIDEO), "ichthyo", 5);
PAsset mm5 = asset::Media::create(key5, "Name-5");
// ordering of keys
CHECK (key1 == key2);
CHECK (key2 != key3);
CHECK (key3 != key4);
CHECK (key4 != key5);
CHECK (key1 != key5);
CHECK ( 0 > key2.compare(key3));
CHECK ( 0 < key3.compare(key2));
CHECK ( 0 > key3.compare(key4));
CHECK ( 0 > key4.compare(key5));
CHECK ( 0 > key1.compare(key5));
CHECK ( 0 > key2.compare(key5));
CHECK ( 0 > key3.compare(key5));
CHECK ( 0 > key1.compare(key3));
CHECK ( 0 > key1.compare(key4));
CHECK ( 0 > key2.compare(key4));
// ordering of Asset smart ptrs
CHECK (mm1 == mm2);
CHECK (mm2 != mm3);
CHECK (mm3 != mm4);
CHECK (mm4 != mm5);
CHECK (mm1 != mm5);
CHECK (mm2 < mm3);
CHECK (mm2 <= mm3);
CHECK (mm3 > mm2);
CHECK (mm3 >= mm2);
CHECK (mm3 < mm4);
CHECK (mm4 < mm5);
CHECK (mm1 < mm5);
CHECK (mm2 < mm5);
CHECK (mm3 < mm5);
CHECK (mm1 < mm3);
CHECK (mm1 < mm4);
CHECK (mm2 < mm4);
}
};
/** Register this test class... */
LAUNCHER (OrderingOfAssets_test, "unit asset");
}}} // namespace proc::asset::test

View file

@ -26,71 +26,70 @@
using std::tr1::static_pointer_cast;
namespace asset
{
namespace test
namespace proc {
namespace asset{
namespace test {
namespace
{
uint counter (0);
namespace
{
uint counter (0);
/** @internal helper generating continuosely
* different new asset identities
*/
Asset::Ident
make_new_ident ()
{
return Asset::Ident ( str(format("TestAsset.%i") % counter)
, Category (META)
, "test"
, counter++
);
}
Asset::Ident
make_new_ident (PAsset& ref)
{
return Asset::Ident ( str(format("%s-TestAsset.%i") % ref->ident.name
% counter)
, ref->ident.category
, "test"
, counter++
);
}
}
template<class A>
TestAsset<A>::TestAsset ()
: A(make_new_ident ())
{ };
template<class A>
TestAsset<A>::TestAsset (PAsset& pRef)
: A(make_new_ident (pRef))
{
this->defineDependency(pRef);
};
/** @internal helper for the create()-Functions
* retrieving the smart ptr created automatically
* within AssetManager by the Asset base class ctor
/** @internal helper generating continuously
* different new asset identities
*/
template<class A>
P<TestAsset<A> >
TestAsset<A>::ptrFromThis ()
Asset::Ident
make_new_ident ()
{
return static_pointer_cast<TestAsset<A>,Asset>
(AssetManager::instance().getAsset (this->id));
};
return Asset::Ident ( str(format("TestAsset.%i") % counter)
, Category (META)
, "test"
, counter++
);
}
Asset::Ident
make_new_ident (PAsset& ref)
{
return Asset::Ident ( str(format("%s-TestAsset.%i") % ref->ident.name
% counter)
, ref->ident.category
, "test"
, counter++
);
}
}
template<class A>
TestAsset<A>::TestAsset ()
: A(make_new_ident ())
{ };
template<class A>
TestAsset<A>::TestAsset (PAsset& pRef)
: A(make_new_ident (pRef))
{
this->defineDependency(pRef);
};
/** @internal helper for the create()-Functions
* retrieving the smart ptr created automatically
* within AssetManager by the Asset base class ctor
*/
template<class A>
P<TestAsset<A> >
TestAsset<A>::ptrFromThis ()
{
return static_pointer_cast<TestAsset<A>,Asset>
(AssetManager::instance().getAsset (this->id));
};
} // namespace test
} // namespace asset
}}} // namespace proc::asset::test
@ -99,25 +98,22 @@ namespace asset
/* explicit template instantiations for some Asset Kinds */
/*********************************************************/
#include "proc/asset/unknown.hpp"
#include "proc/asset/unknown.hpp"
namespace asset
{
namespace test
{
namespace proc {
namespace asset{
namespace test {
template TestAsset<Asset>::TestAsset ();
template TestAsset<Unknown>::TestAsset ();
template TestAsset<Asset>::TestAsset (PAsset& pRef);
template TestAsset<Unknown>::TestAsset (PAsset& pRef);
template P<TestAsset<Asset> > TestAsset<Asset>::ptrFromThis ();
template P<TestAsset<Unknown> > TestAsset<Unknown>::ptrFromThis ();
template TestAsset<Asset>::TestAsset ();
template TestAsset<Unknown>::TestAsset ();
template TestAsset<Asset>::TestAsset (PAsset& pRef);
template TestAsset<Unknown>::TestAsset (PAsset& pRef);
template P<TestAsset<Asset> > TestAsset<Asset>::ptrFromThis ();
template P<TestAsset<Unknown> > TestAsset<Unknown>::ptrFromThis ();
} // namespace test
} // namespace asset
}}} // namespace proc::asset::test

View file

@ -34,45 +34,42 @@ using boost::format;
using std::string;
namespace asset
{
namespace test
namespace proc {
namespace asset{
namespace test {
/**
* Test(mock) asset subclass usable for hijacking a given
* asset class (template parameter) and subsequently accessing
* internal facillities for writing unit tests. Prerequisite
* for using this template is that the used asset base class
* has a (protected) ctor taking an Asset::Ident....
*/
template<class A>
class TestAsset : public A
{
/**
* Test(mock) asset subclass usable for hijacking a given
* asset class (template parameter) and subsequently accessing
* internal facillities for writing unit tests. Prerequisite
* for using this template is that the used asset base class
* has a (protected) ctor taking an Asset::Ident....
*/
template<class A>
class TestAsset : public A
{
TestAsset () ;
TestAsset (PAsset&); ///< declared dependant on the given Asset
static void deleter (TestAsset<A>* aa) { delete aa; }
public:
typedef P<TestAsset<A> > PA;
static PA create () { return (new TestAsset<A> )->ptrFromThis(); }
static PA create (PAsset& pRef) { return (new TestAsset<A> (pRef))->ptrFromThis(); }
/* === interesting asset features we want to access for tests === */
void call_unlink () { this->unlink (); }
void call_unlink (IDA target) { this->unlink (target); }
void set_depend (PAsset parent) { this->defineDependency (parent); }
private:
PA ptrFromThis ();
};
TestAsset () ;
TestAsset (PAsset&); ///< declared dependant on the given Asset
static void deleter (TestAsset<A>* aa) { delete aa; }
public:
typedef P<TestAsset<A> > PA;
static PA create () { return (new TestAsset<A> )->ptrFromThis(); }
static PA create (PAsset& pRef) { return (new TestAsset<A> (pRef))->ptrFromThis(); }
/* === interesting asset features we want to access for tests === */
void call_unlink () { this->unlink (); }
void call_unlink (IDA target) { this->unlink (target); }
void set_depend (PAsset parent) { this->defineDependency (parent); }
private:
PA ptrFromThis ();
};
} // namespace test
}} // namespace proc::asset
}}} // namespace proc::asset::test
#endif

View file

@ -36,8 +36,9 @@ using std::string;
using std::cout;
namespace asset
{
namespace proc {
namespace asset{
/**
* An asset::Media instance Test Clip for checking
* various Asset operations and for creating
@ -48,10 +49,9 @@ namespace asset
{
public:
};
}} // namespace proc::asset
#endif

View file

@ -54,15 +54,16 @@ using std::endl;
namespace proc {
namespace mobject {
namespace session {
namespace test {
struct DummyEntity { }; ////////////////////////TODO of course the key idea is to mix in TypedID::link, to get an automatic registration and deregistartion
typedef lumiera::P<DummyEntity> PDum;
typedef P<DummyEntity> PDum;
}}}
}}}}
namespace lumiera{ ///////TODO: shouldn't that be namespace lib? or proc?
namespace query {
@ -73,16 +74,17 @@ namespace query {
* Of course this is a test/dummy/demonstration.
*/
template<>
struct TypeHandlerXX<mobject::session::test::DummyEntity>
struct TypeHandlerXX<proc::mobject::session::test::DummyEntity>
{
static Symbol getID() { return "typed-id-test-dummy"; }
};
}}
}}
namespace proc {
namespace asset{
namespace test {
@ -242,4 +244,4 @@ namespace test {
LAUNCHER (TypedID_test, "unit asset");
}} // namespace asset::test
}}} // namespace proc::asset::test

View file

@ -35,6 +35,7 @@ using std::cout;
using std::endl;
namespace proc {
namespace control {
namespace test {
@ -123,4 +124,4 @@ namespace test {
LAUNCHER (ArgumentTupleAccept_test, "unit controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -51,22 +51,23 @@ using std::cout;
using std::endl;
namespace proc {
namespace control {
namespace test {
using lib::test::showSizeof;
using lib::test::randTime;
using namespace lumiera::typelist;
namespace { // test helpers
ostringstream protocol; ///< used to verify the test function calls
/**
* watching the instance creation
* of some parameter values
@ -76,54 +77,54 @@ namespace test {
{
TY element_;
static int instanceCnt;
Tracker (TY init = TY()) : element_(init) { ++instanceCnt; }
Tracker (Tracker const& otr) : element_(otr.element_) { ++instanceCnt; }
~Tracker() { --instanceCnt; }
TY&
operator* ()
{
return element_;
}
operator string() const { return element_; }
friend ostream&
operator<< (ostream& out, const Tracker& tra)
{
return out << tra.element_;
}
friend bool
operator== (Tracker const& tra1, Tracker const& tra2)
{
return tra1.element_ == tra2.element_;
}
};
template<typename TY>
int Tracker<TY>::instanceCnt (0);
/** Dummy custom memento datatype
* @note memento needs to be equality comparable
*/
struct Sint5
{
int i[5];
friend bool
operator== (Sint5 const& i1, Sint5 const& i2)
{
return i1.i == i2.i;
}
};
/* === functions to implement test-"operation" & UNDO === */
void
doIt (Tracker<TimeVar> time, Tracker<string> str, int rand)
{
@ -131,40 +132,40 @@ namespace test {
cout << "invoke operation..." << endl;
protocol << fmt % *time % *str % rand;
}
Tracker<string>
captureState (Tracker<TimeVar>, Tracker<string> xstr, int)
{
cout << "capture state..." << endl;
return protocol.str() + *xstr;
}
void
undoIt (Tracker<TimeVar> time, Tracker<string>, int, Tracker<string> memento)
{
cout << "undo... memento=" << memento << endl;
protocol << "undoIt(time="<<time<<")----memento-:"<< *memento;
}
/// another dummy-UNDO function
void dummyU (int,int,int) { }
int dummyC (int u,int o) { return u + rand() % (o-u+1); }
void
showIt (CmdClosure& clo)
{
cout << clo << endl;
}
void
checkSerialisation (CmdClosure& clo)
{
TODO ("implement serialisation/de-serialisation-Check");
cout << "would be serialised....." << clo << endl;
// serialise, then de-serialise into a new instance and compare both
}
@ -174,17 +175,17 @@ namespace test {
{
return 10 + rand() % 90;
}
} // test-helper implementation
typedef lib::ScopedPtrVect<CmdClosure> ArgTuples;
/***************************************************************************
* @test Check storage handling of the command parameters and state memento.
*
@ -193,33 +194,33 @@ namespace test {
*/
class CommandArgument_test : public Test
{
virtual void
run (Arg)
{
ArgTuples testTuples;
Tracker<TimeVar>::instanceCnt = 0;
Tracker<string>::instanceCnt = 0;
createTuples (testTuples);
checkArgumentComparison ();
serialiseArgTuples (testTuples);
testTuples.clear();
simulateCmdLifecycle();
// verify all dtors properly called...
CHECK (0 == Tracker<TimeVar>::instanceCnt);
CHECK (0 == Tracker<string>::instanceCnt);
}
typedef Tracker<TimeVar> TTime;
typedef Tracker<string> Tstr;
/** @test create various argument tuples and re-access their contents */
void
createTuples (ArgTuples& tup)
@ -228,47 +229,47 @@ namespace test {
typedef ArgumentHolder<void(int), void*> A2;
typedef ArgumentHolder<void(int,TimeVar), int> A3;
typedef ArgumentHolder<void(int,TimeVar), Sint5> A4;
typedef ArgumentHolder<void(TTime,Tstr,int), Tstr> A5;
A1* arg1 = new A1(); tup.manage (arg1);
A2* arg2 = new A2(); tup.manage (arg2);
A3* arg3 = new A3(); tup.manage (arg3);
A4* arg4 = new A4(); tup.manage (arg4);
A5* arg5 = new A5(); tup.manage (arg5);
CHECK (isnil (*arg1));
CHECK (isnil (*arg2));
CHECK (isnil (*arg3));
CHECK (isnil (*arg4));
CHECK (isnil (*arg5));
for_each (tup, showIt);
arg1->storeTuple (tuple::makeNullTuple());
arg2->storeTuple (tuple::make (rand() % 10));
arg3->storeTuple (tuple::make (rand() % 10, TimeVar(randTime())));
arg4->storeTuple (tuple::make (rand() % 10, TimeVar(randTime())));
arg5->storeTuple (tuple::make (TTime (randTime()), Tstr("glorious"), twoRandomDigits() ));
CHECK (!arg5->canUndo());
arg5->tie(undoIt, captureState)
.tieCaptureFunc() // bind capturing function to memento storage,
(TTime(), Tstr("destruction"), 11); // then invoke the bound capturing mechanism
CHECK (arg5->canUndo());
CHECK (*arg5->memento() == "destruction");
VERIFY_ERROR(MISSING_MEMENTO, arg4->memento().i[3] = 513 );
for_each (tup, showIt);
}
/** @test serialise and de-serialise each tuple and check validity
* @todo unimplemented, waiting on Serialiser
*/
@ -277,41 +278,41 @@ namespace test {
{
for_each (tup, checkSerialisation);
}
/** @test verify the comparison operators */
void
checkArgumentComparison ()
{
ArgumentHolder<void(int,int), int> one, two;
CHECK (one == two); // empty, identically typed argument holders -->equal
one.tie(dummyU,dummyC)
.tieCaptureFunc()(1,9);
CHECK (one != two); // now one contains captured UNDO state
two.tie(dummyU,dummyC)
.tieCaptureFunc()(1,9);
two.memento() = one.memento(); // put the same UNDO state in both
CHECK (one == two); // ...makes them equal again
one.storeTuple (tuple::make (1,2));
CHECK (one != two); // verify argument tuple comparison
CHECK (two != one);
CHECK (!isnil (one));
CHECK ( isnil (two));
two.storeTuple (tuple::make (3,4));
CHECK (!isnil (two));
CHECK (one != two);
CHECK (two != one);
one.storeTuple (tuple::make (1,4));
CHECK (!isnil (one));
CHECK (one != two);
CHECK (two != one);
one.storeTuple (tuple::make (3,4));
CHECK (!isnil (one));
CHECK (one == two);
@ -321,9 +322,9 @@ namespace test {
CHECK (one != two);
CHECK (two != one);
}
/** @test simulate a complete command lifecycle with regards to the
* storage handling of the command parameters and state memento.
*/
@ -333,71 +334,71 @@ namespace test {
typedef void SIG_do(Tracker<TimeVar>, Tracker<string>, int);
typedef ArgumentHolder<SIG_do, Tracker<string> > Args;
typedef MementoTie<SIG_do, Tracker<string> > MemHolder;
Args args;
CHECK (isnil (args));
cout << showSizeof(args) << endl;
// store a set of parameter values, later to be used on invocation
args.storeTuple (
tuple::make (TTime(randTime()), Tstr("Lumiera rocks"), twoRandomDigits() ));
CHECK (!isnil (args));
cout << args << endl;
CHECK (!args.canUndo());
VERIFY_ERROR(MISSING_MEMENTO, args.memento() );
MemHolder& memHolder = args.tie(undoIt,captureState);
CHECK (!memHolder); // no stored memento....
CHECK (!args.canUndo());
function<SIG_do> doItFun = doIt;
function<SIG_do> undoFun = memHolder.tieUndoFunc();
function<SIG_do> captFun = memHolder.tieCaptureFunc();
typedef function<void()> OpFun;
// now close all the functions with the stored parameter values...
OpFun bound_doItFun = std::tr1::bind (&CmdClosure::invoke, args, CmdFunctor(doItFun));
OpFun bound_undoFun = std::tr1::bind (&CmdClosure::invoke, args, CmdFunctor(undoFun));
OpFun bound_captFun = std::tr1::bind (&CmdClosure::invoke, args, CmdFunctor(captFun));
protocol.seekp(0);
protocol << "START...";
bound_captFun();
cout << "captured state: " << args.memento() << endl;
CHECK (memHolder);
CHECK (!isnil (*args.memento()));
CHECK (args.canUndo());
cout << args << endl;
bound_doItFun();
cout << protocol.str() << endl;
bound_undoFun();
cout << protocol.str() << endl;
// Commands can serve as prototype to be copied....
Args argsCopy (args);
bound_captFun();
protocol.seekp(0);
protocol << "RESET...";
args.storeTuple (
tuple::make (TTime(TimeValue(123456)), Tstr("unbelievable"), twoRandomDigits() ));
cout << "modified: " << args << endl;
cout << "copied : " << argsCopy << endl; // holds still the old params & memento
bound_undoFun();
cout << protocol.str() << endl;
}
};
/** Register this test class... */
LAUNCHER (CommandArgument_test, "unit controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -31,6 +31,7 @@
using std::rand;
namespace proc {
namespace control {
namespace test {
@ -120,4 +121,4 @@ namespace test {
LAUNCHER (CommandBasic_test, "unit controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -29,6 +29,7 @@
#include <iostream>
namespace proc {
namespace control {
namespace test {
@ -122,4 +123,4 @@ namespace test {
LAUNCHER (CommandBinding_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -34,12 +34,13 @@
#include "proc/control/test-dummy-commands.hpp"
namespace proc {
namespace control {
namespace test {
using namespace lumiera::typelist;
typedef lumiera::P<CommandImpl> PCmdImpl;
typedef lib::P<CommandImpl> PCmdImpl;
namespace { // test config...
@ -173,4 +174,4 @@ namespace test {
LAUNCHER (CommandCloneBuilder_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -36,6 +36,7 @@
#include <iostream>
#include <string>
namespace proc {
namespace control {
namespace test {
@ -317,4 +318,4 @@ namespace test {
LAUNCHER (CommandEquality_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -41,6 +41,7 @@ using std::cout;
using std::endl;
namespace proc {
namespace control {
namespace test {
@ -214,4 +215,4 @@ namespace test {
LAUNCHER (CommandMutation_test, "unit controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -33,6 +33,7 @@
#include <tr1/functional>
namespace proc {
namespace control {
namespace test {
@ -236,4 +237,4 @@ namespace test {
LAUNCHER (CommandRegistry_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -33,6 +33,7 @@
#include <iostream>
namespace proc {
namespace control {
namespace test {
@ -389,4 +390,4 @@ namespace test {
LAUNCHER (CommandUse1_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -37,6 +37,7 @@
#include <string>
namespace proc {
namespace control {
namespace test {
@ -204,4 +205,4 @@ namespace test {
LAUNCHER (CommandUse2_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -36,6 +36,7 @@
//#include <string>
namespace proc {
namespace control {
namespace test {
@ -102,4 +103,4 @@ namespace test {
LAUNCHER (CommandUse3_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -34,6 +34,7 @@
#include <cstdlib>
namespace proc {
namespace control {
namespace test {
@ -166,4 +167,4 @@ namespace test {
LAUNCHER (HandlingPatternBasics_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -49,6 +49,7 @@
//#include <string>
namespace proc {
namespace control {
namespace test {
@ -119,6 +120,6 @@ namespace test {
/** Register this test class... */
LAUNCHER (HandlingPatternStandardImpl_test, "function controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -33,6 +33,7 @@ using std::tr1::bind;
using std::rand;
namespace proc {
namespace control {
namespace test {
@ -180,4 +181,4 @@ namespace test {
LAUNCHER (MementoTie_test, "unit controller");
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -25,6 +25,7 @@
namespace proc {
namespace control {
namespace test {
@ -47,4 +48,4 @@ namespace test {
}
}} // namespace control::test
}}} // namespace proc::control::test

View file

@ -46,6 +46,7 @@
#include <string>
namespace proc {
namespace control {
namespace test {
@ -150,5 +151,5 @@ namespace test {
}
}} // namespace control::test
}}} // namespace proc::control::test
#endif

View file

@ -36,6 +36,7 @@ using std::cout;
using std::rand;
namespace proc {
namespace engine{
namespace test {
@ -180,4 +181,4 @@ namespace test {
}} // namespace engine::test
}}} // namespace proc::engine::test

View file

@ -36,6 +36,7 @@ using util::isnil;
using util::isSameObject;
namespace proc {
namespace engine{
namespace metadata{
namespace test {
@ -400,4 +401,4 @@ namespace test {
}}} // namespace engine::metadata::test
}}}} // namespace proc::engine::metadata::test

View file

@ -39,6 +39,7 @@ using util::isSameObject;
using util::isnil;
namespace proc {
namespace engine{
namespace test {
@ -400,4 +401,4 @@ namespace test {
}} // namespace engine::test
}}} // namespace proc::engine::test

View file

@ -35,12 +35,13 @@ using util::isSameObject;
using util::for_each;
namespace proc {
namespace engine{
namespace test {
using lib::test::Dummy;
using ::engine::BuffHandle;
using proc::engine::BuffHandle;
using error::LUMIERA_ERROR_LOGIC;
using error::LUMIERA_ERROR_LIFECYCLE;
@ -232,4 +233,4 @@ namespace test {
}} // namespace engine::test
}}} // namespace proc::engine::test

View file

@ -38,6 +38,7 @@
//using std::cout;
namespace proc {
namespace engine{
namespace test {
@ -105,4 +106,4 @@ namespace test {
}} // namespace engine::test
}}} // namespace proc::engine::test

View file

@ -32,6 +32,7 @@ using std::string;
using std::cout;
namespace proc {
namespace engine{
namespace test {
@ -55,4 +56,4 @@ namespace test {
}} // namespace engine::test
}}} // namespace proc::engine::test

View file

@ -32,6 +32,7 @@ using std::string;
using std::cout;
namespace proc {
namespace engine{
namespace test {
@ -55,4 +56,4 @@ namespace test {
}} // namespace engine::test
}}} // namespace proc::engine::test

Some files were not shown because too many files have changed in this diff Show more