diff --git a/src/common/util.hpp b/src/common/util.hpp index 9780fe65e..2e9f3dac9 100644 --- a/src/common/util.hpp +++ b/src/common/util.hpp @@ -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 (EXPR)) #endif /*UTIL_HPP_*/ diff --git a/src/proc/mobject/explicitplacement.hpp b/src/proc/mobject/explicitplacement.hpp index 1e4f5beca..8896405a7 100644 --- a/src/proc/mobject/explicitplacement.hpp +++ b/src/proc/mobject/explicitplacement.hpp @@ -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& 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& 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; }; diff --git a/src/proc/mobject/placement.hpp b/src/proc/mobject/placement.hpp index 57722a6ad..36fc216f9 100644 --- a/src/proc/mobject/placement.hpp +++ b/src/proc/mobject/placement.hpp @@ -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()); } diff --git a/src/proc/mobject/session/allocation.cpp b/src/proc/mobject/session/allocation.cpp index a590756c3..a8082cdef 100644 --- a/src/proc/mobject/session/allocation.cpp +++ b/src/proc/mobject/session/allocation.cpp @@ -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..."); + } diff --git a/src/proc/mobject/session/allocation.hpp b/src/proc/mobject/session/allocation.hpp index 5bdd5b88c..209fc9406 100644 --- a/src/proc/mobject/session/allocation.hpp +++ b/src/proc/mobject/session/allocation.hpp @@ -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; }; diff --git a/src/proc/mobject/session/fixedlocation.cpp b/src/proc/mobject/session/fixedlocation.cpp index c1cbefa64..0a6753a71 100644 --- a/src/proc/mobject/session/fixedlocation.cpp +++ b/src/proc/mobject/session/fixedlocation.cpp @@ -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_) diff --git a/src/proc/mobject/session/fixedlocation.hpp b/src/proc/mobject/session/fixedlocation.hpp index 19a71e608..ca7254991 100644 --- a/src/proc/mobject/session/fixedlocation.hpp +++ b/src/proc/mobject/session/fixedlocation.hpp @@ -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) {}; diff --git a/src/proc/mobject/session/locatingpin.cpp b/src/proc/mobject/session/locatingpin.cpp index e43b4946c..a054b1736 100644 --- a/src/proc/mobject/session/locatingpin.cpp +++ b/src/proc/mobject/session/locatingpin.cpp @@ -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 diff --git a/src/proc/mobject/session/locatingpin.hpp b/src/proc/mobject/session/locatingpin.hpp index 5d0e3a1c5..8f030fff3 100644 --- a/src/proc/mobject/session/locatingpin.hpp +++ b/src/proc/mobject/session/locatingpin.hpp @@ -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 { diff --git a/src/proc/mobject/session/relativelocation.cpp b/src/proc/mobject/session/relativelocation.cpp index 73c655d80..7439a9913 100644 --- a/src/proc/mobject/session/relativelocation.cpp +++ b/src/proc/mobject/session/relativelocation.cpp @@ -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"); }