A reference to a BReferenceable object. More...
Public Member Functions | |
BReference () | |
Creates a reference without initializing it. More... | |
BReference (const BReference< Type > &other) | |
Copy constructor. More... | |
BReference (Type *object, bool alreadyHasReference=false) | |
Creates and initialize a reference. More... | |
~BReference () | |
Destructor. More... | |
Type * | Detach () |
Detach the pointed object from the reference. More... | |
Type * | Get () const |
Get the target object. More... | |
void | SetTo (Type *object, bool alreadyHasReference=false) |
Sets a new target for the reference. More... | |
void | Unset () |
Unsets the reference. More... | |
A reference to a BReferenceable object.
BReference simplifies the use of BReferenceable and makes it more transparent. It automatically acquires and release references to the pointed objects. It provides an API similar to a standard C++ pointer, allowing use of assignment and comparison operators and direct access to the object with -> and *.
|
inline |
Creates a reference without initializing it.
An uninitialized references behaves similarly to a NULL pointer.
|
inline |
Creates and initialize a reference.
The reference is set to the pointed object. If the parameter is set to true, the reference count is not incremented, this should only be used when referencing a freshly constructed object.
|
inline |
Copy constructor.
The reference is set to the same object as the source. The reference count of the target object is incremented.
|
inline |
Destructor.
The reference count of the target object is decremented.
|
inline |
Detach the pointed object from the reference.
This returns the pointed object and unsets the reference, without decrementing the object reference count. It is used to transfer ownership of the reference to something else.
|
inline |
Get the target object.
Referenced by BReference< const BNetworkAddressResolver >::BReference().
|
inline |
Sets a new target for the reference.
The reference to the previously targetted object is released. A reference to the new object is acquired only if alreadyHasReference
is false.
Referenced by BReference< const BNetworkAddressResolver >::BReference().
|
inline |
Unsets the reference.
The targetted object is released. The reference is unset and can't be used to access it anymore.
Referenced by BReference< const BNetworkAddressResolver >::SetTo(), and BReference< const BNetworkAddressResolver >::~BReference().