gem5
v20.1.0.0
|
If you want a reference counting pointer to a mutable object, create it like this: More...
#include <refcnt.hh>
Public Types | |
using | PtrType = T * |
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 (RefCountingPtr &&r) | |
Move-constructor. More... | |
template<bool B = TisConst> | |
RefCountingPtr (const NonConstT &r) | |
~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... | |
template<bool B = TisConst> | |
operator RefCountingPtr< typename std::enable_if<!B, ConstT >::type > () | |
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... | |
const RefCountingPtr & | operator= (RefCountingPtr &&r) |
Move-assign 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... | |
using | ConstT = typename std::conditional< TisConst, RefCountingPtr< T >, RefCountingPtr< typename std::add_const< T >::type > >::type |
using | NonConstT = typename std::conditional< TisConst, RefCountingPtr< typename std::remove_const< T >::type >, RefCountingPtr< T > >::type |
static constexpr auto | TisConst = std::is_const<T>::value |
Convenience aliases for const/non-const versions of T w/ friendship. More... | |
friend | ConstT |
friend | NonConstT |
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.
|
protected |
|
protected |
using RefCountingPtr< T >::PtrType = T* |
|
inline |
|
inline |
|
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 147 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 160 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::operator=(), RefCountingPtr< MinorDynInst >::set(), and RefCountingPtr< MinorDynInst >::~RefCountingPtr().
|
inline |
Directly access the pointer itself without taking a reference.
Definition at line 219 of file refcnt.hh.
Referenced by Trace::TarmacParserRecord::dump(), BaseO3DynInst< Impl >::forwardOldRegs(), ArmISA::ArmFault::instrAnnotate(), ArmISA::UndefinedInstruction::invoke(), Trace::TarmacTracerRecord::TraceInstEntry::TraceInstEntry(), Trace::TarmacTracerRecordV8::TraceRegEntryV8::updateInt(), ArmISA::VldMultOp::VldMultOp(), ArmISA::VldSingleOp::VldSingleOp(), ArmISA::VstMultOp::VstMultOp(), and ArmISA::VstSingleOp::VstSingleOp().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Copy the pointer from another RefCountingPtr.
|
inline |
Move-assign the pointer from another RefCountingPtr.
|
inline |
Assign a new value to the pointer.
Definition at line 228 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::operator=().
|
inlineprotected |
Drop the old reference and change it to something new.
Definition at line 170 of file refcnt.hh.
Referenced by RefCountingPtr< MinorDynInst >::operator=().
|
protected |
|
protected |
The stored pointer.
Arguably this should be private.
Definition at line 138 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().
|
protected |
|
staticconstexprprotected |