50 #ifndef MOBJECT_MOBJECT_REF_H 51 #define MOBJECT_MOBJECT_REF_H 84 template<
class MO =MObject>
89 typedef PlacementMO::Id<MO> _Id;
93 using _Handle::smPtr_;
103 throw error::State(
"Lifecycle error: MObject ref not activated" 104 , LERR_(BOTTOM_MOBJECTREF));
107 return smPtr_.operator-> ();
115 , LERR_(BOTTOM_MOBJECTREF));
134 operator _Id
const&()
const 147 return pRef_.resolve().time;
161 throw error::State(
"Attempt to attach a child to an inactive MObject ref" 162 , LERR_(BOTTOM_MOBJECTREF));
164 PlacementMO::ID thisScope = pRef_;
197 ASSERT (placement.isValid());
199 placement.extendOwnershipTo(smPtr_);
213 template<
typename REF>
219 if (isValid() && pRef_ == newRef )
222 return activate (*newRef);
234 return activate (oRef.getPlacement());
237 template<
typename MOX>
241 return activate (oRef.getPlacement().getID());
251 template<
typename MOX>
255 return activate (oRef);
265 return _Handle::isValid()
272 return isValid()? pRef_.use_count() : 0;
280 && (*pRef_).template isCompatible<MOX>();
283 operator string()
const 285 return isValid()? string(getPlacement())
299 && oRef == this->pRef_;
307 or oRef != this->pRef_;
314 return oRef.isValid()
315 and oRef.pRef_ == pRef;
322 return not oRef.isValid()
323 or oRef.pRef_ != pRef;
330 return oRef.isValid()
331 and pRef == oRef.pRef_;
338 return not oRef.isValid()
339 or pRef != oRef.pRef_;
343 operator== (PlacementMO::ID
const& pID)
const 346 and PlacementMO::ID (pRef_) == pID;
350 operator!= (PlacementMO::ID
const& pID)
const 353 or PlacementMO::ID (pRef_) != pID;
368 template<
class MOX,
class MOY>
372 return ref1.isValid() && ref2.isValid()
377 template<
class MOX,
class MOY>
381 return ref1.isValid() && ref2.isValid()
382 &&
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