gem5
|
If you want a reference counting pointer to a mutable object, create it like this: More...
#include <refcnt.hh>
Public Member Functions | |
RefCountingPtr () | |
Create an empty reference counting pointer. More... | |
RefCountingPtr (T *data) | |
Create a new reference counting pointer to some object (probably something newly created). More... | |
RefCountingPtr (const RefCountingPtr &r) | |
Create a new reference counting pointer by copying another one. More... | |
~RefCountingPtr () | |
Destroy the pointer and any reference it may hold. More... | |
T * | operator-> () const |
Access a member variable. More... | |
T & | operator* () const |
Dereference the pointer. More... | |
T * | get () const |
Directly access the pointer itself without taking a reference. More... | |
const RefCountingPtr & | operator= (T *p) |
Assign a new value to the pointer. More... | |
const RefCountingPtr & | operator= (const RefCountingPtr &r) |
Copy the pointer from another RefCountingPtr. More... | |
bool | operator! () const |
Check if the pointer is empty. More... | |
operator bool () const | |
Check if the pointer is non-empty. More... | |
Protected Member Functions | |
void | copy (T *d) |
Copy a new pointer value and increment the reference count if it is a valid pointer. More... | |
void | del () |
Delete the reference to any existing object if it is non NULL. More... | |
void | set (T *d) |
Drop the old reference and change it to something new. More... | |
Protected Attributes | |
T * | data |
The stored pointer. More... | |
If you want a reference counting pointer to a mutable object, create it like this:
These two usages are analogous to iterator and const_iterator in the stl.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
Copy a new pointer value and increment the reference count if it is a valid pointer.
Note, this does not delete the reference any existing object.
d | Pointer to store. |
Definition at line 120 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::RefCountingPtr(), and RefCountingPtr< MinorDynInst >::set().
|
inlineprotected |
Delete the reference to any existing object if it is non NULL.
Definition at line 133 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::set(), and RefCountingPtr< MinorDynInst >::~RefCountingPtr().
|
inline |
Directly access the pointer itself without taking a reference.
Definition at line 180 of file refcnt.hh.
Referenced by BaseO3DynInst< Impl >::forwardOldRegs(), ArmISA::ArmFault::invoke(), ArmISA::ArmFault::invoke64(), operator!=(), operator==(), ArmISA::VldMultOp::VldMultOp(), ArmISA::VldSingleOp::VldSingleOp(), ArmISA::VstMultOp::VstMultOp(), and ArmISA::VstSingleOp::VstSingleOp().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Assign a new value to the pointer.
Definition at line 183 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::operator=().
|
inline |
Copy the pointer from another RefCountingPtr.
|
inlineprotected |
Drop the old reference and change it to something new.
Definition at line 143 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::operator=().
|
protected |
The stored pointer.
Arguably this should be private.
Definition at line 111 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::copy(), RefCountingPtr< MinorDynInst >::del(), RefCountingPtr< MinorDynInst >::get(), RefCountingPtr< MinorDynInst >::operator bool(), RefCountingPtr< MinorDynInst >::operator!(), RefCountingPtr< MinorDynInst >::operator*(), RefCountingPtr< MinorDynInst >::operator->(), RefCountingPtr< MinorDynInst >::operator=(), RefCountingPtr< MinorDynInst >::RefCountingPtr(), and RefCountingPtr< MinorDynInst >::set().