some further cleanup

This commit is contained in:
Fischlurch 2007-11-10 21:50:55 +01:00
parent 242640c4fd
commit 38236e607d
10 changed files with 50 additions and 20 deletions

View file

@ -112,7 +112,7 @@ namespace util
{
return std::for_each (c.begin(),c.end(), doIt);
}
/** produce an identifier based on the given string.
@ -153,8 +153,8 @@ namespace util
/* === some common macro definitions === */
/** supress "warning: unused variable" on vars, which
* are introduced into a scope because of some sideeffect, i.e. Locking
/** supress "warning: unused variable" on vars, which are
* introduced into a scope because of some sideeffect, i.e. Locking
*/
#define SIDEEFFECT __attribute__ ((unused));
@ -162,7 +162,9 @@ namespace util
#define STRINGIFY(TOKEN) __STRNGFY(TOKEN)
#define __STRNGFY(TOKEN) #TOKEN
/** shortcut for subclass test, intended for assertions */
/** shortcut for subclass test, intended for assertions only.
* @note it is considered bad style to use such in non-assertion code,
* and we probably will enforce this design rule in future. */
#define INSTANCEOF(CLASS, EXPR) (dynamic_cast<CLASS*> (EXPR))
#endif /*UTIL_HPP_*/

View file

@ -53,19 +53,25 @@ namespace mobject
/** no need to resolve any further, as this ExplicitPlacement
* already \i is the result of a resolve()-call.
*/
virtual const
virtual
ExplicitPlacement resolve () const
{
return *this;
}
private:
ExplicitPlacement (Placement<MObject>& base, Time ti, Track tra)
protected:
/* @todo ichthyo considers a much more elegant implementation utilizing a subclass
* of FixedLocation, which would serve as Placement::LocatingSolution, and
* would be used as LocatingPin::chain subobject as well, so that it could
* be initialized directly here in the ExplicitPlacement ctor.
* (ichthyo: siehe Trac #100)
*/
ExplicitPlacement (Placement<MObject>& base, const session::FixedLocation found)
: Placement(base),
time(ti), track(tra)
time(found.time_), track(found.track_)
{ };
friend class session::LocatingPin;
friend ExplicitPlacement::resolve () const;
};

View file

@ -110,10 +110,10 @@ namespace mobject
* by the various LocatingPin (\see #chain) and
* provide the resulting (explicit) placement.
*/
virtual const ExplicitPlacement
virtual ExplicitPlacement
resolve () const
{
return chain.resolve();
return ExplicitPlacement (*this, chain.resolve());
}

View file

@ -28,7 +28,14 @@ namespace mobject
namespace session
{
/** */
/** @todo probably a placeholder and to be pushed down....*/
void
Allocation::intersect (LocatingSolution& solution) const
{
LocatingPin::intersect (solution);
TODO ("work out how the Allocation types solve for the position...");
}

View file

@ -39,8 +39,8 @@ namespace mobject
/**
* Interface: any objective, constraint or wish of
* placeing a MObject in a specific way.
* Interface (abstract): any objective, constraint or wish
* of placing a MObject in a specific way.
*/
class Allocation : public LocatingPin
{
@ -49,9 +49,13 @@ namespace mobject
* characterizing this allocaton, e.g. "t >= 10"
*/
string repr;
virtual void intersect (LocatingSolution&) const;
public:
const string& getRepr () const { return repr; }
const string& getRepr () const { return repr; }
virtual LocatingPin* clone () const = 0;
};

View file

@ -39,7 +39,7 @@ namespace mobject
void
FixedLocation::intersect (LocatingSolution& solution) const
{
REQUIRE (!solution.is_definite() && !solution.is_overconstrained());
LocatingPin::intersect (solution);
TODO ("either set position or make overconstrained");
if (solution.minTime <= this.time_)

View file

@ -30,18 +30,25 @@
namespace mobject
{
class ExplicitPlacement; //TODO trac #100
namespace session
{
/**
* The most common case of positioning a MObject
* in the EDL: directly specifying a constant position.
* in the EDL: directly specifying a constant position.
* @todo use a subclass to represent the LocatingSolution?
* would solve the construction of a ExplicitPlacement
* much more natural. (ichthyo: siehe trac #100)
*/
class FixedLocation : public LocatingPin
{
Time time_;
Track track_;
friend class ExplicitPlacement; //TODO trac #100
protected:
FixedLocation (Time ti, Track tra) : time_(ti), track_(tra) {};

View file

@ -90,6 +90,8 @@ namespace mobject
* Placement object).
* @todo this could/should be replaced by a full-blown
* constraint solver at some point in the future
* @todo we are packing and unpacking the information (time,track)
* several times. Ichthyo considers a more elegant solution.
*/
const FixedLocation
LocatingPin::resolve () const

View file

@ -108,6 +108,8 @@ namespace mobject
* position resolve() implementation.
* @todo we can't sensibly reason about tracks,
* because at the moment (10/07) we lack a track implementation...
* @todo shouldn't we use a range-restriction LocatingPin (subclass)
* to represent the to-be-found solution? (ichthyo: siehe Trac #100)
*/
struct LocatingSolution
{

View file

@ -39,8 +39,8 @@ namespace mobject
void
RelativeLocation::intersect (LocatingSolution& solution) const
{
REQUIRE (!solution.is_definite() && !solution.is_overconstrained());
LocatingPin::intersect (solution);
TODO ("either set position or make overconstrained");
}