Om
1.0.0
A universal framework for multimedia simulation
|
A class that implements a reference-counted thread-safe shared pointer. More...
#include <omShared.h>
Public Member Functions | |
Shared () | |
Create a Shared object that is NULL. More... | |
Shared (T *newShared) | |
Create a Shared object that wraps the specified raw pointer. More... | |
template<typename U > | |
Shared (U *newShared) | |
Create a Shared object that wraps the specified raw pointer of a different type. More... | |
Shared (const Shared &other) | |
Create a copy of the specified Shared object, increasing its reference count by 1. More... | |
template<typename U > | |
Shared (const Shared< U > &other) | |
Create a copy of the specified Shared object, increasing its reference count by 1. More... | |
Shared & | operator= (const Shared &other) |
Assign the pointer stored by another Shared object to this object. More... | |
template<typename U > | |
Shared & | operator= (const Shared< U > &other) |
Assign the pointer stored by another Shared object of different templated type to this object. More... | |
~Shared () | |
Release this Shared's reference to the object. More... | |
operator T * () const | |
Cast this Shared object to a raw pointer. More... | |
template<typename U > | |
operator U * () const | |
Cast this Shared object to a raw pointer of a different type to allow polymorphism. More... | |
Bool | operator== (const Shared &other) const |
Return whether or not this pointer is equal to another pointer. More... | |
template<typename U > | |
Bool | operator== (const Shared< U > &other) const |
Return whether or not this pointer is equal to another pointer. More... | |
Bool | operator!= (const Shared &other) const |
Return whether or not this pointer is not equal to another pointer. More... | |
template<typename U > | |
Bool | operator!= (const Shared< U > &other) const |
Return whether or not this pointer is not equal to another pointer. More... | |
T & | operator* () const |
Dereference the object referenced by this Shared. More... | |
T * | operator-> () const |
Overload the indirection operator so that this Shared object behaves like a raw pointer. More... | |
T * | getPointer () const |
Get a raw pointer to the object that this Shared references. More... | |
Bool | isUnique () const |
Return whether or not if the object that this Shared references is not referenced by another Shared. More... | |
Bool | isNull () const |
Return whether or not this pointer is equal to NULL. More... | |
Bool | isSet () const |
Return whether or not this pointer is not equal to NULL. More... | |
operator Bool () const | |
Cast this pointer to a boolean value, indicating whether or not the pointer is NULL. More... | |
Size | getReferenceCount () const |
Get the number of references there are to this Shared's object. More... | |
void | release () |
Release this pointer's reference to its object, resulting in a NULL pointer with 0 reference count. More... | |
template<typename U > | |
Shared< U > | cast () const |
Cast this pointer to the template type using static_cast. More... | |
template<typename U > | |
Shared< U > | dynamicCast () const |
Cast this pointer to the template type using dynamic_cast. More... | |
Static Public Member Functions | |
static Shared | construct () |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
template<typename P1 > | |
static Shared | construct (P1 p1) |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
template<typename P1 , typename P2 > | |
static Shared | construct (P1 p1, P2 p2) |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
template<typename P1 , typename P2 , typename P3 > | |
static Shared | construct (P1 p1, P2 p2, P3 p3) |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
template<typename P1 , typename P2 , typename P3 , typename P4 > | |
static Shared | construct (P1 p1, P2 p2, P3 p3, P4 p4) |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 > | |
static Shared | construct (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 > | |
static Shared | construct (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 > | |
static Shared | construct (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) |
Construct an object of the templated type with the specified arguments for its constructor. More... | |
A class that implements a reference-counted thread-safe shared pointer.
A shared pointer should be used to encapsulate objects that have a lifetime that is not easily known or that need to be shared by more than one system. The internal pointer is owned by the shared pointer and is destructed and freed when its reference count reaches 0.
An atomic reference count is used to make the pointer thread-safe.
|
inline |
Create a Shared object that is NULL.
|
inlineexplicit |
Create a Shared object that wraps the specified raw pointer.
If the specified raw pointer is equal to NULL, the reference count for the pointer is set to 0. Otherwise, the reference count for the Shared is 1. By calling this constructor, the user acknowledges that the Shared object now owns the object pointed to by the raw pointer and retains the right to destroy it when the reference count reaches 0.
newShared | - the raw pointer which this Shared object should wrap. |
|
inlineexplicit |
Create a Shared object that wraps the specified raw pointer of a different type.
If the specified raw pointer is equal to NULL, the reference count for the pointer is set to 0. Otherwise, the reference count for the Shared is 1. By calling this constructor, the user acknowledges that the Shared object now owns the object pointed to by the raw pointer and retains the right to destroy it when the reference count reaches 0.
newShared | - the raw pointer which this Shared object should wrap. |
|
inline |
Create a copy of the specified Shared object, increasing its reference count by 1.
|
inline |
Create a copy of the specified Shared object, increasing its reference count by 1.
|
inline |
Release this Shared's reference to the object.
|
inline |
Assign the pointer stored by another Shared object to this object.
The reference count of the old pointer stored in this object is reduced by 1 and the pointer is copied from the other Shared object. The reference count for the new pointer is increased by 1.
other | - the Shared object whose pointer should be copied. |
|
inline |
Assign the pointer stored by another Shared object of different templated type to this object.
The reference count of the old pointer stored in this object is reduced by 1 and the pointer is copied from the other Shared object. The reference count for the new pointer is increased by 1.
other | - the Shared object whose pointer should be copied. |
|
inline |
Cast this Shared object to a raw pointer.
Cast this Shared object to a raw pointer of a different type to allow polymorphism.
|
inline |
Return whether or not this pointer is equal to another pointer.
This method compares the pointers themselves, not the objects pointed to by the pointers.
other | - the pointer to compare for equality. |
|
inline |
Return whether or not this pointer is equal to another pointer.
This method compares the pointers themselves, not the objects pointed to by the pointers.
other | - the pointer to compare for equality. |
|
inline |
Return whether or not this pointer is not equal to another pointer.
This method compares the pointers themselves, not the objects pointed to by the pointers.
other | - the pointer to compare for inequality. |
|
inline |
Return whether or not this pointer is not equal to another pointer.
This method compares the pointers themselves, not the objects pointed to by the pointers.
other | - the pointer to compare for inequality. |
|
inline |
|
inline |
|
inline |
Get a raw pointer to the object that this Shared references.
|
inline |
|
inline |
Return whether or not this pointer is equal to NULL.
|
inline |
Return whether or not this pointer is not equal to NULL.
|
inline |
Cast this pointer to a boolean value, indicating whether or not the pointer is NULL.
|
inline |
Get the number of references there are to this Shared's object.
|
inline |
Release this pointer's reference to its object, resulting in a NULL pointer with 0 reference count.
Cast this pointer to the template type using static_cast.
|
inline |
Cast this pointer to the template type using dynamic_cast.
If the cast was invalid and not able to performed, a NULL pointer is returned.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.
|
inlinestatic |
Construct an object of the templated type with the specified arguments for its constructor.