change implementation of "bottom" PlacementRef to 0-LUID
This commit is contained in:
parent
e89b4503fd
commit
b74a505c44
3 changed files with 13 additions and 6 deletions
|
|
@ -103,12 +103,12 @@ namespace lib {
|
||||||
|
|
||||||
typedef lumiera_uid* LUID;
|
typedef lumiera_uid* LUID;
|
||||||
|
|
||||||
operator size_t () const { return lumiera_uid_hash ((LUID)&luid_); }
|
operator size_t () const { return lumiera_uid_hash (get()); }
|
||||||
bool operator== (LuidH const& o) const { return lumiera_uid_eq ((LUID)&luid_, (LUID)&o.luid_); }
|
bool operator== (LuidH const& o) const { return lumiera_uid_eq (get(), o.get()); }
|
||||||
bool operator!= (LuidH const& o) const { return !operator== (o); }
|
bool operator!= (LuidH const& o) const { return !operator== (o); }
|
||||||
|
|
||||||
/** for passing to C APIs */
|
/** for passing to C APIs */
|
||||||
LUID get() const { return (LUID)&luid_; }
|
LUID get() const { return const_cast<LUID> (&luid_);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ namespace mobject {
|
||||||
class PlacementRef
|
class PlacementRef
|
||||||
{
|
{
|
||||||
typedef Placement<MX> PlacementMX;
|
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;
|
typedef Placement<MObject>::Id<MX> _Id;
|
||||||
|
|
||||||
_Id id_;
|
_Id id_;
|
||||||
|
|
@ -103,7 +103,7 @@ namespace mobject {
|
||||||
|
|
||||||
/** Default is an NIL Placement ref. It throws on any access. */
|
/** Default is an NIL Placement ref. It throws on any access. */
|
||||||
PlacementRef ()
|
PlacementRef ()
|
||||||
: id_()
|
: id_( bottomID() )
|
||||||
{
|
{
|
||||||
REQUIRE (!isValid(), "hash-ID clash with existing ID");
|
REQUIRE (!isValid(), "hash-ID clash with existing ID");
|
||||||
}
|
}
|
||||||
|
|
@ -232,6 +232,13 @@ namespace mobject {
|
||||||
return reinterpret_cast<_Id const&> (*luid);
|
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&
|
static PlacementMX&
|
||||||
access (_Id const& placementID)
|
access (_Id const& placementID)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ namespace session {
|
||||||
|
|
||||||
|
|
||||||
/** constant \em invalid path token. Created by locating an invalid scope */
|
/** 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.
|
/** a \em valid path consists of more than just the root element.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue