Lumiera  0.pre.03
»edit your freedom«
MORef< MO > Class Template Reference

#include "steam/mobject/mobject-ref.hpp"

Description

template<class MO = MObject>
class steam::mobject::MORef< MO >

An active (smart-ptr like) external reference to a specifically placed MObject "instance" within the session.

Implemented as a smart-ptr sharing ownership of the pointee MObject with the corresponding placement within the session. Additionally, a PlacementRef is incorporated, allowing to re-access this placement with the help of PlacementIndex within the current session.

Definition at line 85 of file mobject-ref.hpp.

Public Member Functions

MORefactivate (Placement< MO > const &placement)
 activate an MObject reference, based on an existing placement, which needs to be contained (added to) the session. More...
 
template<typename REF >
MORefactivate (REF const &pRefID)
 build and activate an MObject reference, based on anything which might be assigned to an PlarementRef<MO> : More...
 
MORefactivate (MORef const &oRef)
 build and activate an MObject reference based on an existing reference of the same pointee type More...
 
template<typename MOX >
MORefactivate (MORef< MOX > const &oRef)
 
template<class MOX >
MORef< MOX > attach (Placement< MOX > const &newPlacement)
 attach a child element to the model More...
 
Placement< MO > & getPlacement () const
 
PlacementRef< MO > const & getRef () const
 allow to use a MObjectRef like a (bare) PlacementRef More...
 
lib::time::Time getStartTime ()
 resolves the referred placement to an ExplicitPlacement and returns the found start time
 
template<class MOX >
bool isCompatible () const
 
bool isValid () const
 
 operator _Id const & () const
 allow to use MObjectRef instead of a Placement-ID (hash) More...
 
 operator string () const
 
template<class MOX >
bool operator!= (MORef< MOX > const &oRef) const
 
bool operator!= (PlacementMO::ID const &pID) const
 
MO * operator-> () const
 
template<typename MOX >
MORefoperator= (MORef< MOX > const &oRef)
 cross assignment. More...
 
template<class MOX >
bool operator== (MORef< MOX > const &oRef) const
 
bool operator== (PlacementMO::ID const &pID) const
 
void purge ()
 detach this object instance from model, including all child elements. More...
 
size_t use_count () const
 
- Public Member Functions inherited from Handle< MO >
 Handle ()=default
 by default create an Null handle. More...
 
 Handle (MO *imp)
 directly establish handle from an implementation, which typically way just heap allocated beforehand.
 
 Handle (Handle const &r)=default
 
 Handle (Handle &&rr)=default
 
 Handle (shared_ptr< Y > const &r)
 
 Handle (shared_ptr< Y > &&srr)
 
 Handle (weak_ptr< Y > const &wr)
 
 Handle (unique_ptr< Y > &&urr)
 
Handleactivate (MO *impl, DEL whenDead)
 Activation of the handle by the managing service. More...
 
Handleactivate (shared_ptr< MO > const &impl)
 another way of activating a handle by sharing ownership with an existing smart-ptr
 
Handleactivate (shared_ptr< MO > &&impl)
 
void close ()
 deactivate this handle, so it isn't tied any longer to the associated implementation or service object. More...
 
bool isValid () const
 
 operator bool () const
 
Handleoperator= (Handle const &r)=default
 
Handleoperator= (Handle &&rr)=default
 
Handleoperator= (shared_ptr< Y > const &sr)
 
Handleoperator= (shared_ptr< Y > &&srr)
 
Handleoperator= (unique_ptr< Y > &&urr)
 

Friends

template<class MOX >
bool operator!= (MORef const &oRef, PlacementRef< MOX > const &pRef)
 
template<class MOX >
bool operator!= (PlacementRef< MOX > const &pRef, MORef const &oRef)
 
template<class MOX >
bool operator== (MORef const &oRef, PlacementRef< MOX > const &pRef)
 
template<class MOX >
bool operator== (PlacementRef< MOX > const &pRef, MORef const &oRef)
 

Private Types

typedef lib::Handle< MO > _Handle
 
typedef PlacementMO::Id< MO > _Id
 

Private Attributes

PlacementRef< MO > pRef_
 

Additional Inherited Members

- Protected Types inherited from Handle< MO >
typedef std::shared_ptr< MO > SmPtr
 
- Protected Member Functions inherited from Handle< MO >
MO & impl () const
 
- Protected Attributes inherited from Handle< MO >
SmPtr smPtr_
 

Member Function Documentation

◆ getRef()

PlacementRef<MO> const& getRef ( ) const
inline

allow to use a MObjectRef like a (bare) PlacementRef

Note
no test if this MObjectRef is NIL

Definition at line 125 of file mobject-ref.hpp.

◆ operator _Id const &()

operator _Id const & ( ) const
inline

allow to use MObjectRef instead of a Placement-ID (hash)

Todo:
not sure if that leads to unexpected conversions, because the underlying implementation can be converted to size_t

Definition at line 134 of file mobject-ref.hpp.

◆ attach()

MORef<MOX> attach ( Placement< MOX > const &  newPlacement)
inline

attach a child element to the model

Parameters
newPlacementto be copied into the model, placed into the scope of the object denoted by this MORef
Returns
MORef designing the newly created and attached object instance

Definition at line 158 of file mobject-ref.hpp.

◆ purge()

void purge ( )
inline

detach this object instance from model, including all child elements.

Note
the object itself remains accessible

Definition at line 175 of file mobject-ref.hpp.

References SessionServiceMutate::detach_and_clear().

Referenced by Timeline::unlink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activate() [1/3]

MORef& activate ( Placement< MO > const &  placement)
inline

activate an MObject reference, based on an existing placement, which needs to be contained (added to) the session.

After checking the validity of the placement, this MObjectRef shares ownership of the referred MObject with the denoted placement.

Note
STRONG exception safety guarantee
See also
close() for detaching this MObjectRef

Definition at line 195 of file mobject-ref.hpp.

Referenced by SessionImpl::attach().

+ Here is the caller graph for this function:

◆ activate() [2/3]

MORef& activate ( REF const &  pRefID)
inline

build and activate an MObject reference, based on anything which might be assigned to an PlarementRef<MO> :

  • any Placement
  • any Placement-ID
  • any Placement-Ref
  • a plain LUID
    Exceptions
    error::Invalidwhen the (directly or indirectly referred placement isn't known to the session PlacementIndex, or when the placement actually found has an incompatible dynamic type

Definition at line 215 of file mobject-ref.hpp.

◆ activate() [3/3]

MORef& activate ( MORef< MO > const &  oRef)
inline

build and activate an MObject reference based on an existing reference of the same pointee type

Note
STRONG exception safety guarantee
Exceptions
error::Invalidwhen the referred placement isn't known to the current session's PlacementIndex

Definition at line 232 of file mobject-ref.hpp.

◆ operator=()

MORef& operator= ( MORef< MOX > const &  oRef)
inline

cross assignment.

Note
besides that, we use the default generated copy operations.
STRONG exception safety guarantee
Exceptions
error::Invalidwhen the referred placement isn't registered within the current session, or if the runtime type of the pointees aren't assignment compatible

Definition at line 253 of file mobject-ref.hpp.

+ Inheritance diagram for MORef< MO >:
+ Collaboration diagram for MORef< MO >:

The documentation for this class was generated from the following file: