Smart pointer base class for auto-retained objects.
More...
#include <typeref.h>
Inherited by ucommon::typeref< const char * >, ucommon::typeref< const uint8_t * >, ucommon::ArrayRef, ucommon::MapRef, ucommon::SharedRef [protected]
, ucommon::typeref< T, R >, ucommon::typeref< const char * >, ucommon::typeref< const uint8_t * >, and ucommon::typeref_guard [protected]
.
|
void | clear (void) |
| Manually release the current container.
|
|
unsigned | copies () const |
| Get number of references to container. More...
|
|
bool | is_released (void) |
|
| operator bool () const |
| Check if pointer currently has a heap container. More...
|
|
bool | operator! () const |
| Check if we are currently not pointing to anything. More...
|
|
void | set (const TypeRef &pointer) |
| Set our smart pointer based on another pointer instance. More...
|
|
size_t | size (void) const |
| Get size of referenced heap object. More...
|
|
virtual | ~TypeRef () |
| Destroy pointer when falling out of scope. More...
|
|
|
void | assign (const typeref_guard &ref) |
| Assign from a guarded typeref.
|
|
void | set (Counted *object) |
| Set our smart pointer to a specific heap container. More...
|
|
| TypeRef (Counted *object) |
| Create a smart pointer referencing an existing heap object. More...
|
|
| TypeRef (const TypeRef &pointer) |
| Create a smart pointer based on another pointer. More...
|
|
| TypeRef () |
| Create a smart pointer referencing nothing.
|
|
|
static caddr_t | mem (caddr_t address) |
| Adjust memory pointer to atomic boundry. More...
|
|
|
class | ArrayRef |
|
class | MapRef |
|
class | SharedRef |
|
class | TypeRelease |
|
Smart pointer base class for auto-retained objects.
The underlying container is heap allocated and page aligned. A heap object is automatically de-referenced by release during destruction. The smart pointer is a protected base class used to derive strongly typed templates.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 68 of file typeref.h.
◆ TypeRef() [1/2]
ucommon::TypeRef::TypeRef |
( |
Counted * |
object | ) |
|
|
protected |
Create a smart pointer referencing an existing heap object.
- Parameters
-
◆ TypeRef() [2/2]
ucommon::TypeRef::TypeRef |
( |
const TypeRef & |
pointer | ) |
|
|
protected |
Create a smart pointer based on another pointer.
Both pointers then reference the same object.
- Parameters
-
pointer | instance to share reference with. |
◆ ~TypeRef()
virtual ucommon::TypeRef::~TypeRef |
( |
| ) |
|
|
virtual |
Destroy pointer when falling out of scope.
This de-references the heap container.
◆ copies()
unsigned ucommon::TypeRef::copies |
( |
| ) |
const |
Get number of references to container.
- Returns
- total number of pointers referencing container.
◆ mem()
static caddr_t ucommon::TypeRef::mem |
( |
caddr_t |
address | ) |
|
|
staticprotected |
Adjust memory pointer to atomic boundry.
- Parameters
-
address | that was allocated. |
- Returns
- address for actual atomic aligned object.
◆ operator bool()
ucommon::TypeRef::operator bool |
( |
| ) |
const |
|
inline |
Check if pointer currently has a heap container.
- Returns
- true if we are referencing a container.
Definition at line 238 of file typeref.h.
◆ operator!()
bool ucommon::TypeRef::operator! |
( |
| ) |
const |
|
inline |
Check if we are currently not pointing to anything.
- Returns
- true if not referencing a container.
Definition at line 246 of file typeref.h.
◆ put()
static void ucommon::TypeRef::put |
( |
TypeRef & |
target, |
|
|
Counted * |
object |
|
) |
| |
|
inlinestatic |
Special weak-public means to copy a container reference.
This uses the base class container which is not public, so only derived type specific smart pointers can actually use this method. It is made public because making it protected actually makes it inaccessible to template derived classes.
- Parameters
-
target | smart pointer object to set. |
object | to have it reference. |
Definition at line 259 of file typeref.h.
◆ set() [1/2]
void ucommon::TypeRef::set |
( |
Counted * |
object | ) |
|
|
protected |
Set our smart pointer to a specific heap container.
If we were pointing to something already we release that.
- Parameters
-
◆ set() [2/2]
void ucommon::TypeRef::set |
( |
const TypeRef & |
pointer | ) |
|
Set our smart pointer based on another pointer instance.
If we are already referencing, we release the current container.
- Parameters
-
pointer | instance to share reference with. |
◆ size()
size_t ucommon::TypeRef::size |
( |
void |
| ) |
const |
Get size of referenced heap object.
- Returns
- size of container or 0 if none.
The documentation for this class was generated from the following file: