gem5 v24.0.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. | |
RefCountingPtr (T *data) | |
Create a new reference counting pointer to some object (probably something newly created). | |
RefCountingPtr (const RefCountingPtr &r) | |
Create a new reference counting pointer by copying another one. | |
RefCountingPtr (RefCountingPtr &&r) | |
Move-constructor. | |
template<bool B = TisConst> | |
RefCountingPtr (const NonConstT &r) | |
~RefCountingPtr () | |
Destroy the pointer and any reference it may hold. | |
T * | operator-> () const |
Access a member variable. | |
T & | operator* () const |
Dereference the pointer. | |
T * | get () const |
Directly access the pointer itself without taking a reference. | |
template<bool B = TisConst> | |
operator RefCountingPtr< typename std::enable_if_t<!B, ConstT > > () | |
const RefCountingPtr & | operator= (T *p) |
Assign a new value to the pointer. | |
const RefCountingPtr & | operator= (const RefCountingPtr &r) |
Copy the pointer from another RefCountingPtr. | |
const RefCountingPtr & | operator= (RefCountingPtr &&r) |
Move-assign the pointer from another RefCountingPtr. | |
bool | operator! () const |
Check if the pointer is empty. | |
operator bool () const | |
Check if the pointer is non-empty. | |
Protected Member Functions | |
void | copy (T *d) |
Copy a new pointer value and increment the reference count if it is a valid pointer. | |
void | del () |
Delete the reference to any existing object if it is non NULL. | |
void | set (T *d) |
Drop the old reference and change it to something new. | |
Protected Attributes | |
T * | data |
The stored pointer. | |
using | ConstT |
using | NonConstT |
static constexpr auto | TisConst = std::is_const_v<T> |
Convenience aliases for const/non-const versions of T w/ friendship. | |
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 gem5::RefCountingPtr< T >::PtrType = T* |
|
inline |
Create an empty reference counting pointer.
Definition at line 191 of file refcnt.hh.
Referenced by gem5::RefCountingPtr< T >::operator RefCountingPtr< typename std::enable_if_t<!B, ConstT > >().
|
inline |
Create a new reference counting pointer to some object (probably something newly created).
Adds a reference.
Definition at line 195 of file refcnt.hh.
References gem5::RefCountingPtr< T >::copy(), and gem5::RefCountingPtr< T >::data.
|
inline |
Create a new reference counting pointer by copying another one.
Adds a reference.
Definition at line 199 of file refcnt.hh.
References gem5::RefCountingPtr< T >::copy(), and gem5::MipsISA::r.
|
inline |
Move-constructor.
Does not add a reference.
Definition at line 204 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data, and gem5::MipsISA::r.
|
inline |
Definition at line 211 of file refcnt.hh.
References gem5::RefCountingPtr< T >::copy(), and gem5::MipsISA::r.
|
inline |
Destroy the pointer and any reference it may hold.
Definition at line 214 of file refcnt.hh.
References gem5::RefCountingPtr< T >::del().
|
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 155 of file refcnt.hh.
References gem5::ArmISA::d, and gem5::RefCountingPtr< T >::data.
Referenced by gem5::RefCountingPtr< T >::RefCountingPtr(), gem5::RefCountingPtr< T >::RefCountingPtr(), gem5::RefCountingPtr< T >::RefCountingPtr(), and gem5::RefCountingPtr< T >::set().
|
inlineprotected |
Delete the reference to any existing object if it is non NULL.
Definition at line 168 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data.
Referenced by gem5::RefCountingPtr< T >::operator=(), gem5::RefCountingPtr< T >::set(), and gem5::RefCountingPtr< T >::~RefCountingPtr().
|
inline |
Directly access the pointer itself without taking a reference.
Definition at line 227 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data.
Referenced by gem5::o3::LSQUnit::checkSnoop(), gem5::trace::TarmacParserRecord::dump(), gem5::o3::DynInst::forwardOldRegs(), gem5::ArmISA::ArmFault::instrAnnotate(), gem5::ArmISA::UndefinedInstruction::invoke(), gem5::X86ISA::InvalidOpcode::invoke(), gem5::RiscvISA::IllegalInstFault::invokeSE(), gem5::RiscvISA::UnknownInstFault::invokeSE(), gem5::o3::LSQUnit::read(), gem5::trace::TarmacTracerRecord::TraceInstEntry::TraceInstEntry(), gem5::trace::TarmacTracerRecordV8::TraceRegEntryV8::updateInt(), gem5::ArmISA::VldMultOp::VldMultOp(), gem5::ArmISA::VldSingleOp::VldSingleOp(), gem5::ArmISA::VstMultOp::VstMultOp(), gem5::ArmISA::VstSingleOp::VstSingleOp(), gem5::o3::LSQUnit::writeback(), and gem5::o3::LSQUnit::writebackStores().
|
inline |
Check if the pointer is non-empty.
Definition at line 262 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data.
|
inline |
Definition at line 230 of file refcnt.hh.
References gem5::RefCountingPtr< T >::RefCountingPtr().
|
inline |
Check if the pointer is empty.
Definition at line 259 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data.
|
inline |
Dereference the pointer.
Definition at line 224 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data.
|
inline |
Access a member variable.
Definition at line 221 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data.
|
inline |
Copy the pointer from another RefCountingPtr.
Definition at line 240 of file refcnt.hh.
References gem5::RefCountingPtr< T >::operator=(), and gem5::MipsISA::r.
|
inline |
Move-assign the pointer from another RefCountingPtr.
Definition at line 247 of file refcnt.hh.
References gem5::RefCountingPtr< T >::data, gem5::RefCountingPtr< T >::del(), and gem5::MipsISA::r.
|
inline |
Assign a new value to the pointer.
Definition at line 236 of file refcnt.hh.
References gem5::MipsISA::p, and gem5::ArmISA::set.
Referenced by gem5::RefCountingPtr< T >::operator=().
|
inlineprotected |
Drop the old reference and change it to something new.
Definition at line 178 of file refcnt.hh.
References gem5::RefCountingPtr< T >::copy(), gem5::ArmISA::d, gem5::RefCountingPtr< T >::data, and gem5::RefCountingPtr< T >::del().
|
protected |
|
protected |
The stored pointer.
Arguably this should be private.
Definition at line 146 of file refcnt.hh.
Referenced by gem5::RefCountingPtr< T >::copy(), gem5::RefCountingPtr< T >::del(), gem5::RefCountingPtr< T >::get(), gem5::RefCountingPtr< T >::operator bool(), gem5::RefCountingPtr< T >::operator!(), gem5::RefCountingPtr< T >::operator*(), gem5::RefCountingPtr< T >::operator->(), gem5::RefCountingPtr< T >::operator=(), gem5::o3::LSQUnit::read(), gem5::RefCountingPtr< T >::RefCountingPtr(), gem5::RefCountingPtr< T >::RefCountingPtr(), and gem5::RefCountingPtr< T >::set().
|
protected |
|
staticconstexprprotected |