ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
![]() ![]() |
A general purpose smart pointer helper class. More...
#include <object.h>
Public Member Functions | |
void | release (void) |
Manually release the pointer. More... | |
bool | operator! () const |
Test if the pointer is not set. More... | |
operator bool () const | |
Test if the pointer is referencing an object. More... | |
Protected Member Functions | |
AutoObject () | |
AutoObject (ObjectProtocol *object) | |
Construct an auto-pointer referencing an existing object. More... | |
AutoObject (const AutoObject &pointer) | |
Construct an auto-pointer as a copy of another pointer. More... | |
~AutoObject () | |
Delete auto pointer. More... | |
void | set (ObjectProtocol *object) |
Set our pointer to a specific object. More... | |
Protected Attributes | |
ObjectProtocol * | object |
A general purpose smart pointer helper class.
This is particularly useful in conjunction with reference counted objects which can be managed and automatically removed from the heap when they are no longer being referenced by a smart pointer. The smart pointer itself would normally be constructed and initialized as an auto variable in a method call, and will dereference the object when the pointer falls out of scope. This is actually a helper class for the typed pointer template.
|
protected |
Definition at line 65 of file object.cpp.
|
protected |
Construct an auto-pointer referencing an existing object.
object | we point to. |
Definition at line 57 of file object.cpp.
References ucommon::ObjectProtocol::retain().
|
protected |
Construct an auto-pointer as a copy of another pointer.
The retention of the object being pointed to will be increased.
pointer | we are a copy of. |
Definition at line 82 of file object.cpp.
References object, and ucommon::ObjectProtocol::retain().
|
protected |
Delete auto pointer.
When it falls out of scope, the retention of the object it references is reduced. If it falls to zero in a reference counted object, then the object is auto-deleted.
Definition at line 77 of file object.cpp.
References release().
ucommon::AutoObject::operator bool | ( | ) | const |
Test if the pointer is referencing an object.
Definition at line 94 of file object.cpp.
bool ucommon::AutoObject::operator! | ( | ) | const |
Test if the pointer is not set.
Definition at line 89 of file object.cpp.
void ucommon::AutoObject::release | ( | void | ) |
Manually release the pointer.
This reduces the retention level of the object and resets the pointer to point to nobody.
Definition at line 70 of file object.cpp.
Referenced by ~AutoObject().
|
protected |
Set our pointer to a specific object.
If the pointer currently references another object, that object is released. The pointer references our new object and that new object is retained.
object | to assign to. |
Definition at line 99 of file object.cpp.
References ucommon::ObjectProtocol::retain().
Referenced by ucommon::object_pointer< T >::operator=().
|
protected |
Definition at line 140 of file object.h.
Referenced by AutoObject(), and ucommon::object_pointer< T >::operator=().