aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
TiCppRC Class Reference

Base class for reference counting functionality. More...

#include <ticpprc.h>

+ Inheritance diagram for TiCppRC:
+ Collaboration diagram for TiCppRC:

Public Attributes

std::vector< ticpp::Base *> m_spawnedWrappers
 Remember all wrappers that we've created with 'new' - ( e.g. More...
 

Public Member Functions

 TiCppRC ()
 Constructor Spawns new reference counter with a pointer to this. More...
 
virtual ~TiCppRC ()
 Destructor Nullifies the pointer to this held by the reference counter Decrements reference count. More...
 
void DeleteSpawnedWrappers ()
 Delete all container objects we've spawned with 'new'. More...
 

Friends

class ticpp::Base
 

Detailed Description

Base class for reference counting functionality.

Definition at line 41 of file ticpprc.h.

Constructor & Destructor Documentation

◆ TiCppRC()

TiCppRC::TiCppRC ( )

Constructor Spawns new reference counter with a pointer to this.

Definition at line 924 of file ticpp.cpp.

924  {
925  // Spawn reference counter for this object
926  m_tiRC = new TiCppRCImp(this);
927 }
TiCppRCImp * m_tiRC
Pointer to reference counter.
Definition: ticpprc.h:46

◆ ~TiCppRC()

TiCppRC::~TiCppRC ( )
virtual

Destructor Nullifies the pointer to this held by the reference counter Decrements reference count.

Definition at line 940 of file ticpp.cpp.

940  {
942 
943  // Set pointer held by reference counter to nullptr
944  this->m_tiRC->Nullify();
945 
946  // Decrement reference - so reference counter will delete itself if necessary
947  this->m_tiRC->DecRef();
948 }
void Nullify()
Allows the TiCppRC object to set the pointer to itself ( m_tiCppRc ) to nullptr when the TiCppRC obje...
Definition: ticpp.cpp:969
TiCppRCImp * m_tiRC
Pointer to reference counter.
Definition: ticpprc.h:46
void DecRef()
Decrement Reference Count.
Definition: ticpp.cpp:958
void DeleteSpawnedWrappers()
Delete all container objects we&#39;ve spawned with &#39;new&#39;.
Definition: ticpp.cpp:929

Member Function Documentation

◆ DeleteSpawnedWrappers()

void TiCppRC::DeleteSpawnedWrappers ( )

Delete all container objects we've spawned with 'new'.

Definition at line 929 of file ticpp.cpp.

929  {
930  std::vector< Base* >::reverse_iterator wrapper;
931 
932  for (wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend();
933  ++wrapper) {
934  delete *wrapper;
935  }
936 
937  m_spawnedWrappers.clear();
938 }
std::vector< ticpp::Base *> m_spawnedWrappers
Remember all wrappers that we&#39;ve created with &#39;new&#39; - ( e.g.
Definition: ticpprc.h:63

Friends And Related Function Documentation

◆ ticpp::Base

friend class ticpp::Base
friend

Definition at line 43 of file ticpprc.h.

Member Data Documentation

◆ m_spawnedWrappers

std::vector< ticpp::Base* > TiCppRC::m_spawnedWrappers

Remember all wrappers that we've created with 'new' - ( e.g.

NodeFactory, FirstChildElement, etc. )

Definition at line 63 of file ticpprc.h.

◆ m_tiRC

TiCppRCImp* TiCppRC::m_tiRC
private

Pointer to reference counter.

Definition at line 46 of file ticpprc.h.

Referenced by ticpp::Base::SetImpRC().


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