Lumiera  0.pre.03
»edit your freedom«
mobject-ref.hpp File Reference

Go to the source code of this file.

Description

External MObject/Placement reference.

This smart-handle referres to an MObject, attached (placed) into the session. It is a copyable value object, implemented by an LUID (hash) and an shared_ptr. Holding an MObject ref keeps the referred MObject alive, but gives no guarantees regarding the validity of the referred Placement within the session. On each access, the placement is re-fetched using the PlacementIndex, which may fail.

MObjectRef allows to access the pointee (MObject subclass) by using the dereferentiation operator, and it allows to access the Placement within the session. Moreover, as an convenience shortcut, some of Placement's query operations are directly exposed.

Lifecycle
An MObjectRef is always created inactive. It needs to be activated explicitly, providing either a direct (language) ref to an Placement within the session, or an PlacementRef tag, or another MObjecRef. It can be closed (detached).
Type handling
Like any smart-ptr MObjectRef is templated on the actual type of the pointee. It can be built or re-assigned from a variety of sources, given the runtime type of the referred pointee is compatible to this template parameter type. This allows flexibly to re-gain a specifically typed context, even based just on a plain LUID. This functionality is implemented by accessing the PlacementIndex within the session, and then by using the RTTI of the fetched Placement's pointee.
See also
MObject
Session
PlacementRef
PlacementIndex

Definition in file mobject-ref.hpp.

Classes

class  MORef< MO >
 An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the session. More...
 

Typedefs

typedef MORef< MObject > MObjectRef
 

Functions

template<class MOX , class MOY >
bool isEquivalentPlacement (MORef< MOX > const &ref1, MORef< MOY > const &ref2)
 check if the two references actually denote an equivalent placement
 
template<class MOX , class MOY >
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 referring to the same Placement, which is tested by operator== )
 
 LUMIERA_ERROR_DECLARE (BOTTOM_MOBJECTREF)
 NIL MObjectRef encountered.
 

Namespaces

 lumiera
 Lumiera public interface.
 
 steam
 Steam-Layer implementation namespace root.
 
 steam::mobject
 Media-Objects, edit operations and high-level session.