μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Object Class Referenceabstract

Reference counted object base class. More...

#include </builds/ipbus/ipbus-software/uhal/python/pybind11-python2/tests/object.h>

Public Member Functions

 Object ()
 Default constructor. More...
 
 Object (const Object &)
 Copy constructor. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the object's reference count by one. More...
 
void decRef (bool dealloc=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const =0
 
 Object ()
 Default constructor. More...
 
 Object (const Object &)
 Copy constructor. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the object's reference count by one. More...
 
void decRef (bool dealloc=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const =0
 

Protected Member Functions

virtual ~Object ()
 Virtual protected deconstructor. More...
 
virtual ~Object ()
 Virtual protected deconstructor. More...
 

Private Attributes

std::atomic< int > m_refCount {0}
 

Detailed Description

Reference counted object base class.

Definition at line 9 of file object.h.

Constructor & Destructor Documentation

◆ Object() [1/4]

Object::Object ( )
inline

Default constructor.

Definition at line 12 of file object.h.

References print_default_created().

◆ Object() [2/4]

Object::Object ( const Object )
inline

Copy constructor.

Definition at line 15 of file object.h.

References print_copy_created().

◆ ~Object() [1/2]

virtual Object::~Object ( )
inlineprotectedvirtual

Virtual protected deconstructor.

(Will only be called by ref)

Definition at line 44 of file object.h.

References print_destroyed().

◆ Object() [3/4]

Object::Object ( )
inline

Default constructor.

Definition at line 12 of file object.h.

References print_default_created().

◆ Object() [4/4]

Object::Object ( const Object )
inline

Copy constructor.

Definition at line 15 of file object.h.

References print_copy_created().

◆ ~Object() [2/2]

virtual Object::~Object ( )
inlineprotectedvirtual

Virtual protected deconstructor.

(Will only be called by ref)

Definition at line 44 of file object.h.

References print_destroyed().

Member Function Documentation

◆ decRef() [1/2]

void Object::decRef ( bool  dealloc = true) const
inline

Decrease the reference count of the object and possibly deallocate it.

The object will automatically be deallocated once the reference count reaches zero.

Definition at line 29 of file object.h.

References m_refCount.

◆ decRef() [2/2]

void Object::decRef ( bool  dealloc = true) const
inline

Decrease the reference count of the object and possibly deallocate it.

The object will automatically be deallocated once the reference count reaches zero.

Definition at line 29 of file object.h.

References m_refCount.

◆ getRefCount() [1/2]

int Object::getRefCount ( ) const
inline

Return the current reference count.

Definition at line 18 of file object.h.

References m_refCount.

Referenced by TEST_SUBMODULE().

◆ getRefCount() [2/2]

int Object::getRefCount ( ) const
inline

Return the current reference count.

Definition at line 18 of file object.h.

References m_refCount.

◆ incRef() [1/2]

void Object::incRef ( ) const
inline

Increase the object's reference count by one.

Definition at line 21 of file object.h.

References m_refCount.

◆ incRef() [2/2]

void Object::incRef ( ) const
inline

Increase the object's reference count by one.

Definition at line 21 of file object.h.

References m_refCount.

◆ toString() [1/2]

virtual std::string Object::toString ( ) const
pure virtual

◆ toString() [2/2]

virtual std::string Object::toString ( ) const
pure virtual

Member Data Documentation

◆ m_refCount

std::atomic< int > Object::m_refCount {0}
mutableprivate

Definition at line 47 of file object.h.

Referenced by decRef(), getRefCount(), and incRef().


The documentation for this class was generated from the following files: