bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
|
A reference to an RCObject which automatically ref() and deref() on creation and destruction. More...
#include <RCObject.h>
Public Member Functions | |
T * | get () const |
T & | operator* () const |
T * | operator-> () const |
RCPtr & | operator= (const RCPtr &rhs) |
RCPtr (const RCPtr &from) | |
RCPtr (T *pRef=0) | |
T * | refAndGet () const |
A reference to an RCObject which automatically ref() and deref() on creation and destruction.
Use this for temporary references to an RCObject* instead of std::unique_ptr to avoid leaks or double deletion. It is templated to allow RCObject subclass specific pointers.
For example,
RCPtr<RCObject> obj = RCPtr<RCObject>(new RCObject()); // count is now 1. // make a call to add to container that might throw exception. // we assume the container will up the ref() itself on a successful addition. addToContainer(obj.get()); // if previous line exceptions, ~RCPtr will unref() it back to 0, causing it to delete. // if we get here, the object is safely in the container and has been ref() to 2, // so ~RCPtr correctly drops it back to 1.
Definition at line 284 of file RCObject.h.
|
inline |
Definition at line 286 of file RCObject.h.
|
inline |
Definition at line 292 of file RCObject.h.
|
inline |
Definition at line 298 of file RCObject.h.
|
inline |
Definition at line 335 of file RCObject.h.
|
inline |
Definition at line 321 of file RCObject.h.
|
inline |
Definition at line 329 of file RCObject.h.
|
inline |
Definition at line 307 of file RCObject.h.
|
inline |
If not null, ref() the object and then return it.
Useful for adding a reference to a container, e.g.:
RCPtr<T> myObj; vector<T> myVecOfObj; myVecOfObj.push_back(myObj.refAndGet());
Definition at line 353 of file RCObject.h.