make Placement<MObject> implement the interface Buildable.

WIP: works, but isnt what I intended. Rather need a specialisation to be able to define functions
treat (Placement<TY>) based on the concrete TY....
This commit is contained in:
Fischlurch 2008-04-23 05:48:45 +02:00
parent aea5ed323a
commit d9e6adfe02
6 changed files with 49 additions and 14 deletions

View file

@ -105,7 +105,7 @@ namespace lumiera
typedef RET ReturnType; ///< Tool function invocation return type
typedef Tool ToolBase; ///< for templating the Tag and Dispatcher
virtual ~Tool () { }; ///< use RTTI for all visiting tools
virtual ~Tool () { }; ///< use RTTI for all visiting tools
/** allows discovery of the concrete Tool type when dispatching a
* visitor call. Can be implemented by inheriting from ToolTag */

View file

@ -23,7 +23,7 @@
/** @file visitorpolicies.hpp
** Policies usable for configuring the lumiera::visitor::Tool for different kinds of error handling.
** @see buildertool.hpp for another flavor (calling and catch-all-function)
** @see buildertool.hpp for another flavour (calling an catch-all-function there)
**
*/

View file

@ -60,6 +60,9 @@ namespace mobject
{
return *this;
}
/** */ /////////////////////////////////////////////////////////////TODO: wip-wip...
DEFINE_PROCESSABLE_BY (builder::BuilderTool);
protected:
/* @todo ichthyo considers a much more elegant implementation utilizing a subclass

View file

@ -82,7 +82,7 @@ namespace mobject
* be within the Session/EDL
*/
template<class MO>
class Placement : protected shared_ptr<MO>
class Placement : public Buildable, protected shared_ptr<MO>
{
protected:
typedef lumiera::Time Time;
@ -105,7 +105,7 @@ namespace mobject
virtual ~Placement() {};
/** */ /////////////////////////////////////////////////////////////TODO: totmachen?
// DEFINE_PROCESSABLE_BY (builder::BuilderTool);
DEFINE_PROCESSABLE_BY (builder::BuilderTool);
/** interface for defining the kind of placement

View file

@ -111,9 +111,12 @@ namespace mobject
virtual LocatingPin* clone () const;
virtual ~LocatingPin() {};
protected:
// protected:
LocatingPin () {};
//TODO (for working out the buildable interface; ctor should be protected)
protected:
friend class Placement<MObject>;
/**

View file

@ -1,5 +1,5 @@
/*
BuilderTool(Test) - specialized form of the acyclic visitor
BuilderTool(Test) - specialized visitor used within the builder for processing Placements
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
@ -27,6 +27,9 @@
#include "proc/asset/media.hpp"
#include "proc/mobject/session/clip.hpp"
#include "proc/mobject/explicitplacement.hpp" //////////TODO
#include <iostream>
using std::string;
using std::cout;
@ -48,15 +51,31 @@ namespace mobject
public:
DummyMO() { };
virtual bool isValid() const { return true;}
DEFINE_PROCESSABLE_BY (BuilderTool);
// DEFINE_PROCESSABLE_BY (BuilderTool);
static void killDummy (AbstractMO* dum) { delete (DummyMO*)dum; }
};
class TestTool
: public Applicable<TestTool, Types<Clip,AbstractMO>::List>
//////////////////////////////////////////////////////TODO: wip-wip
class DummyPlacement : public Placement<AbstractMO>
{
public:
void treat (Clip& c) { cout << "media is: "<< str(c.getMedia()) <<"\n"; }
void treat (AbstractMO&){ cout << "unspecific MO.\n"; }
DummyPlacement()
: Placement<AbstractMO>::Placement(*new DummyMO, &DummyMO::killDummy)
{ }
};
//////////////////////////////////////////////////////TODO: wip-wip
class TestTool
: public Applicable<TestTool, Types<Placement<Clip>, Placement<AbstractMO> >::List>
{
public:
void treat (Placement<Clip>& pC) { cout << "media is: "<< str(pC->getMedia()) <<"\n"; }
void treat (Placement<AbstractMO>&){ cout << "unspecific MO.\n"; }
void onUnknown (Buildable&){ cout << "catch-all-function called.\n"; }
};
@ -88,10 +107,10 @@ namespace mobject
TestTool t1;
BuilderTool& tool (t1);
DummyMO dumm;
DummyPlacement dumm;
PMO clip = asset::Media::create("test-1", asset::VIDEO)->createClip();
clip->apply (tool);
clip.apply (tool);
dumm.apply (tool);
}
};
@ -105,5 +124,15 @@ namespace mobject
} // namespace test
} // namespace builder
//////////////////////////////////////////////////////TODO: wip-wip
template<>
ExplicitPlacement
Placement<session::AbstractMO>::resolve () const
{
UNIMPLEMENTED ("just a test");
}
//////////////////////////////////////////////////////TODO: wip-wip
} // namespace mobject