change implementation of "bottom" PlacementRef to 0-LUID

This commit is contained in:
Fischlurch 2009-12-13 05:48:05 +01:00
parent e89b4503fd
commit b74a505c44
3 changed files with 13 additions and 6 deletions

View file

@ -103,12 +103,12 @@ namespace lib {
typedef lumiera_uid* LUID;
operator size_t () const { return lumiera_uid_hash ((LUID)&luid_); }
bool operator== (LuidH const& o) const { return lumiera_uid_eq ((LUID)&luid_, (LUID)&o.luid_); }
operator size_t () const { return lumiera_uid_hash (get()); }
bool operator== (LuidH const& o) const { return lumiera_uid_eq (get(), o.get()); }
bool operator!= (LuidH const& o) const { return !operator== (o); }
/** for passing to C APIs */
LUID get() const { return (LUID)&luid_; }
LUID get() const { return const_cast<LUID> (&luid_);}
};

View file

@ -72,7 +72,7 @@ namespace mobject {
class PlacementRef
{
typedef Placement<MX> PlacementMX;
typedef Placement<MObject>::ID _ID; ////TODO: could we define const& here??
typedef Placement<MObject>::ID _ID;
typedef Placement<MObject>::Id<MX> _Id;
_Id id_;
@ -103,7 +103,7 @@ namespace mobject {
/** Default is an NIL Placement ref. It throws on any access. */
PlacementRef ()
: id_()
: id_( bottomID() )
{
REQUIRE (!isValid(), "hash-ID clash with existing ID");
}
@ -232,6 +232,13 @@ namespace mobject {
return reinterpret_cast<_Id const&> (*luid);
}
static _Id const&
bottomID () ///< @return marker for \em invalid reference
{
static lumiera_uid invalidLUID;
return recast (&invalidLUID);
}
static PlacementMX&
access (_Id const& placementID)
{

View file

@ -119,7 +119,7 @@ namespace session {
/** constant \em invalid path token. Created by locating an invalid scope */
const ScopePath ScopePath::INVALID = ScopePath(Scope()); ///////////////////////TODO can this initialisation be deferred? it causes creation of an default session very early
const ScopePath ScopePath::INVALID = ScopePath(Scope());
/** a \em valid path consists of more than just the root element.