|
gem5 [DEVELOP-FOR-25.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< MinorDynInst >::operator RefCountingPtr< typename std::enable_if_t<!B, ConstT > >().
|
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 155 of file refcnt.hh.
Referenced by gem5::RefCountingPtr< MinorDynInst >::RefCountingPtr(), gem5::RefCountingPtr< MinorDynInst >::RefCountingPtr(), gem5::RefCountingPtr< MinorDynInst >::RefCountingPtr(), and gem5::RefCountingPtr< MinorDynInst >::set().
|
inlineprotected |
Delete the reference to any existing object if it is non NULL.
Definition at line 168 of file refcnt.hh.
Referenced by gem5::RefCountingPtr< MinorDynInst >::operator=(), gem5::RefCountingPtr< MinorDynInst >::set(), and gem5::RefCountingPtr< MinorDynInst >::~RefCountingPtr().
|
inline |
Directly access the pointer itself without taking a reference.
Definition at line 227 of file refcnt.hh.
Referenced by gem5::o3::LSQUnit::checkSnoop(), 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::o3::LSQUnit::writeback(), and gem5::o3::LSQUnit::writebackStores().
|
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 236 of file refcnt.hh.
Referenced by gem5::RefCountingPtr< MinorDynInst >::operator=().
|
inlineprotected |
|
protected |
|
protected |
The stored pointer.
Arguably this should be private.
Definition at line 146 of file refcnt.hh.
Referenced by gem5::o3::LSQUnit::read().
|
protected |
|
staticconstexprprotected |