Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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

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

Friends

template<class MOX >
bool operator== (MORef const &oRef, PlacementRef< MOX > const &pRef)
 
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!= (PlacementRef< MOX > const &pRef, MORef const &oRef)
 

Private Types

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

Private Attributes

PlacementRef< MO > pRef_
 
SmPtr smPtr_
 

Additional Inherited Members

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

Member Typedef Documentation

◆ _Handle

template<class MO = MObject>
typedef lib::Handle<MO> _Handle
private

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

◆ _Id

template<class MO = MObject>
typedef PlacementMO::Id<MO> _Id
private

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

Member Function Documentation

◆ operator->()

template<class MO = MObject>
MO * operator-> ( ) const
inline

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

References INSTANCEOF, LERR_, and MORef< MO >::smPtr_.

◆ getPlacement()

template<class MO = MObject>
Placement< MO > & getPlacement ( ) const
inline

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

References INSTANCEOF, MORef< MO >::isValid(), LERR_, MORef< MO >::pRef_, and MORef< MO >::smPtr_.

Referenced by MORef< MO >::activate(), MORef< MO >::activate(), MObjectRef_test::checkBuildMObjectRef(), MObjectRef_test::checkLifecycle(), MObjectRef_test::checkTypeHandling(), steam::mobject::isEquivalentPlacement(), steam::mobject::isSharedPointee(), MORef< MO >::operator string(), PlacementObjectIdentity_test::run(), and SessionElementQuery_test::run().

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

◆ getRef()

template<class MO = MObject>
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.

References MORef< MO >::pRef_.

Referenced by SessionElementQuery_test::run().

+ Here is the caller graph for this function:

◆ operator _Id const &()

template<class MO = MObject>
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.

References MORef< MO >::pRef_.

◆ getStartTime()

template<class MO = MObject>
lib::time::Time getStartTime ( )
inline

resolves the referred placement to an ExplicitPlacement and returns the found start time

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

References MORef< MO >::pRef_.

Referenced by MObjectRef_test::checkBuildMObjectRef().

+ Here is the caller graph for this function:

◆ attach()

template<class MO = MObject>
template<class MOX >
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.

References MORef< MO >::activate(), SessionServiceMutate::attach_toModel(), MORef< MO >::isValid(), LERR_, and MORef< MO >::pRef_.

+ Here is the call graph for this function:

◆ purge()

template<class MO = MObject>
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(), MORef< MO >::isValid(), and MORef< MO >::pRef_.

Referenced by Timeline::unlink().

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

◆ activate() [1/4]

template<class MO = MObject>
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.

References MORef< MO >::pRef_, and MORef< MO >::smPtr_.

Referenced by MORef< MO >::activate(), MORef< MO >::activate(), MORef< MO >::activate(), MORef< MO >::attach(), MObjectRef_test::checkBuildMObjectRef(), MObjectRef_test::checkComparison(), MObjectRef_test::checkLifecycle(), MObjectRef_test::checkTypeHandling(), MORef< MO >::operator=(), and PlacementObjectIdentity_test::run().

+ Here is the caller graph for this function:

◆ activate() [2/4]

template<class MO = MObject>
template<typename REF >
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.

References MORef< MO >::activate(), MORef< MO >::isValid(), and MORef< MO >::pRef_.

+ Here is the call graph for this function:

◆ activate() [3/4]

template<class MO = MObject>
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.

References MORef< MO >::activate(), and MORef< MO >::getPlacement().

+ Here is the call graph for this function:

◆ activate() [4/4]

template<class MO = MObject>
template<typename MOX >
MORef & activate ( MORef< MOX > const &  oRef)
inline

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

References MORef< MO >::activate(), and MORef< MO >::getPlacement().

+ Here is the call graph for this function:

◆ operator=()

template<class MO = MObject>
template<typename MOX >
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.

References MORef< MO >::activate().

+ Here is the call graph for this function:

◆ isValid()

template<class MO = MObject>
bool isValid ( ) const
inline

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

References Handle< IMP >::isValid(), and MORef< MO >::pRef_.

Referenced by MORef< MO >::activate(), MORef< MO >::attach(), MObjectRef_test::checkBuildMObjectRef(), MObjectRef_test::checkTypeHandling(), MORef< MO >::getPlacement(), steam::mobject::isEquivalentPlacement(), steam::mobject::isSharedPointee(), MORef< MO >::operator string(), MORef< MO >::operator!=(), MORef< MO >::operator!=(), MORef< MO >::operator==(), MORef< MO >::operator==(), MORef< MO >::purge(), SessionElementQuery_test::run(), and MORef< MO >::use_count().

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

◆ use_count()

template<class MO = MObject>
size_t use_count ( ) const
inline

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

References MORef< MO >::isValid(), and MORef< MO >::pRef_.

Referenced by MObjectRef_test::checkBuildMObjectRef(), MObjectRef_test::checkLifecycle(), MObjectRef_test::checkTypeHandling(), and PlacementObjectIdentity_test::run().

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

◆ isCompatible()

template<class MO = MObject>
template<class MOX >
bool isCompatible ( ) const
inline

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

References MORef< MO >::pRef_.

Referenced by MObjectRef_test::checkBuildMObjectRef().

+ Here is the caller graph for this function:

◆ operator string()

template<class MO = MObject>
operator string ( ) const
inline

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

References MORef< MO >::getPlacement(), and MORef< MO >::isValid().

+ Here is the call graph for this function:

◆ operator==() [1/2]

template<class MO = MObject>
template<class MOX >
bool operator== ( MORef< MOX > const &  oRef) const
inline

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

References MORef< MO >::isValid(), and MORef< MO >::pRef_.

+ Here is the call graph for this function:

◆ operator!=() [1/2]

template<class MO = MObject>
template<class MOX >
bool operator!= ( MORef< MOX > const &  oRef) const
inline

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

References MORef< MO >::isValid(), and MORef< MO >::pRef_.

+ Here is the call graph for this function:

◆ operator==() [2/2]

template<class MO = MObject>
bool operator== ( PlacementMO::ID const &  pID) const
inline

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

References MORef< MO >::isValid(), and MORef< MO >::pRef_.

+ Here is the call graph for this function:

◆ operator!=() [2/2]

template<class MO = MObject>
bool operator!= ( PlacementMO::ID const &  pID) const
inline

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

References MORef< MO >::isValid(), and MORef< MO >::pRef_.

+ Here is the call graph for this function:

Member Data Documentation

◆ pRef_

◆ smPtr_

template<class MO = MObject>
SmPtr smPtr_
private

Friends And Related Symbol Documentation

◆ operator== [1/2]

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

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

◆ operator!= [1/2]

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

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

◆ operator== [2/2]

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

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

◆ operator!= [2/2]

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

Definition at line 336 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: