59 #ifndef MOBJECT_MOBJECT_REF_H 60 #define MOBJECT_MOBJECT_REF_H 93 template<
class MO =MObject>
98 typedef PlacementMO::Id<MO> _Id;
102 using _Handle::smPtr_;
112 throw error::State(
"Lifecycle error: MObject ref not activated" 113 , LERR_(BOTTOM_MOBJECTREF));
116 return smPtr_.operator-> ();
124 , LERR_(BOTTOM_MOBJECTREF));
143 operator _Id
const&()
const 156 return pRef_.resolve().time;
170 throw error::State(
"Attempt to attach a child to an inactive MObject ref" 171 , LERR_(BOTTOM_MOBJECTREF));
173 PlacementMO::ID thisScope = pRef_;
206 ASSERT (placement.isValid());
208 placement.extendOwnershipTo(smPtr_);
222 template<
typename REF>
228 if (isValid() && pRef_ == newRef )
231 return activate (*newRef);
243 return activate (oRef.getPlacement());
246 template<
typename MOX>
250 return activate (oRef.getPlacement().getID());
260 template<
typename MOX>
264 return activate (oRef);
274 return _Handle::isValid()
281 return isValid()? pRef_.use_count() : 0;
289 && (*pRef_).template isCompatible<MOX>();
292 operator string()
const 294 return isValid()? string(getPlacement())
308 && oRef == this->pRef_;
316 or oRef != this->pRef_;
323 return oRef.isValid()
324 and oRef.pRef_ == pRef;
331 return not oRef.isValid()
332 or oRef.pRef_ != pRef;
339 return oRef.isValid()
340 and pRef == oRef.pRef_;
347 return not oRef.isValid()
348 or pRef != oRef.pRef_;
352 operator== (PlacementMO::ID
const& pID)
const 355 and PlacementMO::ID (pRef_) == pID;
359 operator!= (PlacementMO::ID
const& pID)
const 362 or PlacementMO::ID (pRef_) != pID;
377 template<
class MOX,
class MOY>
381 return ref1.isValid() && ref2.isValid()
386 template<
class MOX,
class MOY>
390 return ref1.isValid() && ref2.isValid()
391 &&
isSameDef (ref1.getPlacement(), ref2.getPlacement());
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Generic opaque reference counting handle, for accessing a service and managing its lifecycle...
An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the ...
void purge()
detach this object instance from model, including all child elements.
Core abstraction: placement of a media object into session context.
#define INSTANCEOF(CLASS, EXPR)
shortcut for subclass test, intended for assertions only.
MORef< MOX > attach(Placement< MOX > const &newPlacement)
attach a child element to the model
lib::time::Time getStartTime()
resolves the referred placement to an ExplicitPlacement and returns the found start time ...
MORef & activate(MORef const &oRef)
build and activate an MObject reference based on an existing reference of the same pointee type ...
bool isSharedPointee(MORef< MOX > const &ref1, MORef< MOY > const &ref2)
check if the two references actually share ownership on the same underlying MObject (as opposed to re...
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Steam-Layer implementation namespace root.
Lumiera's internal time value datatype.
Derived specific exceptions within Lumiera's exception hierarchy.
bool isSameDef(PlacementMO const &pl1, PlacementMO const &pl2)
compare the properties of placement
static PID attach_toModel(PMO, PID)
attach an object by placement onto the session.
A generic reference mechanism for Placements, as added to the current session.
MORef & activate(REF const &pRefID)
build and activate an MObject reference, based on anything which might be assigned to an PlarementRef...
static bool detach_and_clear(PID)
detach the denoted element from the model including all children.
Lumiera public interface.
MORef & activate(Placement< MO > const &placement)
activate an MObject reference, based on an existing placement, which needs to be contained (added to)...
A generic opaque handle to an implementation entity, including lifecycle management.
PlacementRef< MO > const & getRef() const
allow to use a MObjectRef like a (bare) PlacementRef
Implementation level session API: add or remove Session contents.
bool isEquivalentPlacement(MORef< MOX > const &ref1, MORef< MOY > const &ref2)
check if the two references actually denote an equivalent placement