#include <support/Atom.h>
Can be used with SAtom, SLightAtom, SLimAtom, and SSharedBuffer.
For the most part a sptr<T> looks and feels like a raw C++ pointer. However, currently sptr<> does not have a boolean conversion operator, so to check whether a sptr is NULL you will need to write code like this:
if (my_sptr == NULL) ...
Public Member Functions | |
TYPE * | detach () |
Clear (set to NULL) and return the raw pointer of this object. | |
TYPE * | edit (size_t size) |
Version of edit() that allows you to change the size of the shared buffer. | |
TYPE * | edit () |
Retrieve edit access to the object. | |
bool | is_null () const |
Return true if ptr() is NULL. | |
TYPE & | operator * () const |
Dereference pointer. | |
TYPE * | operator-> () const |
Member dereference. | |
template<> | |
sptr< SSharedBuffer > & | operator= (SSharedBuffer *p) |
template<class NEWTYPE> | |
sptr< TYPE > & | operator= (const sptr< NEWTYPE > &p) |
Assignment from a strong pointer to another type of SAtom subclass (type conversion). | |
sptr< TYPE > & | operator= (const sptr< TYPE > &p) |
Assignment from another sptr. | |
sptr< TYPE > & | operator= (TYPE *p) |
Assignment from a raw pointer. | |
TYPE * | ptr () const |
Return the raw pointer of this object. | |
template<> | |
sptr (SSharedBuffer *p) | |
template<class NEWTYPE> | |
sptr (const sptr< NEWTYPE > &p) | |
Initialization from a strong pointer to another type of SAtom subclass (type conversion). | |
sptr (const sptr< TYPE > &p) | |
Initialize from another sptr. | |
sptr (TYPE *p) | |
Initialize from a raw pointer. | |
sptr () | |
Initialize to NULL pointer. | |
~sptr () | |
Release strong reference on object. | |
Friends | |
class | wptr< TYPE > |
|
Initialize to NULL pointer.
|
|
Initialize from a raw pointer.
|
|
Initialize from another sptr.
|
|
Initialization from a strong pointer to another type of SAtom subclass (type conversion).
|
|
Release strong reference on object.
|
|
|
|
Clear (set to NULL) and return the raw pointer of this object. You now own its strong reference and must manually call DecStrong(). |
|
Version of edit() that allows you to change the size of the shared buffer.
|
|
Retrieve edit access to the object. Use this with SSharedBuffer objects to request edit access to the buffer. If the buffer needs to be copied, the sptr<> will be updated to point to the new buffer. Returns a raw pointer to the buffer that you can modify. |
|
Return true if ptr() is NULL.
|
|
Dereference pointer.
|
|
Member dereference.
|
|
|
|
Assignment from a strong pointer to another type of SAtom subclass (type conversion).
|
|
Assignment from another sptr.
|
|
Assignment from a raw pointer.
|
|
Return the raw pointer of this object. Keeps the object and leaves its reference count as-is. You normally don't need to use this, and instead can use the -> and * operators. |
|
|