Type to define object link parameters as ParamsBase::Param< ObjectLink< ObjectT > > or to define object link list parameters as ParamsBase::ListParam< ObjectLink< ObjectT > >. Such parameters own (one or multiple) ObjectLink instances and assign a resource to each instance. ObjectLink instances hold a std::weak_ptr to the resource and lock this weak_ptr if requested returning a respective LinkedObjectWrapper instance. A new resource can be assigned to an ObjectLink instance while LinkedObjectWrapper(s) exist since they hold an independent shared_ptr to the resource they have been created from. ObjectLink does not need to be thread-safe itself. All operations on it are performed through the respective ParamsBase::Param or ParamsBase::ListParam instance. To operate on those instances, the ParamsBase instance owning the respective parameter needs to be locked which renders ObjectLink implicitely thread-safe.
More...
#include <Object.h>
|
| | ObjectLink () |
| | Constructs an empty object link.
|
| |
| | ObjectLink (const std::shared_ptr< ObjectType > &DestinyResource) |
| | Constructs an object link pointing to DestinyResource.
|
| |
| virtual | ~ObjectLink () |
| |
| void | Reset () |
| | Resets this object link rendering it empty.
|
| |
| auto & | operator= (const std::shared_ptr< ObjectType > &NewDestinyResource) |
| | Assigns a new resource to this object link.
|
| |
| auto | TryLockDestinyRaw () |
| | Locks the resource this object link points to by creating a shared_ptr from it. This function can only be directly called by the main thread since only the respective ParamsBase::Param < LinkType > class has non-const access.
|
| |
|
| std::weak_ptr< ObjectType > | DestinyResource |
| | Pointer to the (unlocked) resource this object link points to. Logical const-ness: the weak_ptr's type (type of the unlocked Object) is not const, so that the main thread (which locks the objects) can perform any operation on unlocked objects.
|
| |
template<typename ObjectT>
class DynExp::ObjectLink< ObjectT >
Type to define object link parameters as ParamsBase::Param< ObjectLink< ObjectT > > or to define object link list parameters as ParamsBase::ListParam< ObjectLink< ObjectT > >. Such parameters own (one or multiple) ObjectLink instances and assign a resource to each instance. ObjectLink instances hold a std::weak_ptr to the resource and lock this weak_ptr if requested returning a respective LinkedObjectWrapper instance. A new resource can be assigned to an ObjectLink instance while LinkedObjectWrapper(s) exist since they hold an independent shared_ptr to the resource they have been created from. ObjectLink does not need to be thread-safe itself. All operations on it are performed through the respective ParamsBase::Param or ParamsBase::ListParam instance. To operate on those instances, the ParamsBase instance owning the respective parameter needs to be locked which renders ObjectLink implicitely thread-safe.
- Template Parameters
-
| ObjectT | Type of the managed Object. |
Definition at line 3382 of file Object.h.
◆ ConstObjectType
template<typename ObjectT >
Equals const ObjectT.
Definition at line 3386 of file Object.h.
◆ ObjectType
template<typename ObjectT >
◆ ObjectLink() [1/2]
template<typename ObjectT >
Constructs an empty object link.
Definition at line 3393 of file Object.h.
◆ ObjectLink() [2/2]
template<typename ObjectT >
Constructs an object link pointing to DestinyResource.
- Parameters
-
| DestinyResource | Resource this object link points to |
Definition at line 3399 of file Object.h.
◆ ~ObjectLink()
template<typename ObjectT >
◆ LockObject()
template<typename ObjectT >
◆ operator=()
template<typename ObjectT >
Assigns a new resource to this object link.
- Parameters
-
| NewDestinyResource | Resource this object link now points to |
- Returns
- Returns the object link instance itself.
Definition at line 3413 of file Object.h.
◆ Reset()
template<typename ObjectT >
Resets this object link rendering it empty.
Definition at line 3406 of file Object.h.
◆ TryLockDestinyRaw()
template<typename ObjectT >
Locks the resource this object link points to by creating a shared_ptr from it. This function can only be directly called by the main thread since only the respective ParamsBase::Param < LinkType > class has non-const access.
- Returns
shared_ptr pointing to the resource this object link points to
Definition at line 3430 of file Object.h.
◆ TryLockObject()
template<typename ObjectT >
Locks DestinyResource and wraps the locked Object in a LinkedObjectWrapper instance. Logical const-ness: the locked objects are const, so that users can only call const member functions on them.
- Parameters
-
- Returns
- Returns a pointer to a
LinkedObjectWrapper instance containing the locked Object instance. Returns nullptr if this object link is empty.
Definition at line 3447 of file Object.h.
◆ RunnableInstance
template<typename ObjectT >
◆ DestinyResource
template<typename ObjectT >
Pointer to the (unlocked) resource this object link points to. Logical const-ness: the weak_ptr's type (type of the unlocked Object) is not const, so that the main thread (which locks the objects) can perform any operation on unlocked objects.
Definition at line 3486 of file Object.h.
The documentation for this class was generated from the following file: