Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CountedObject< X > Class Template Reference

#include <G4ReferenceCountedHandle.hh>

Public Member Functions

 G4CountedObject (X *pObj=nullptr)
 
 ~G4CountedObject ()
 
void AddRef ()
 
void Release ()
 
void * operator new (std::size_t)
 
void operator delete (void *pObj)
 

Friends

class G4ReferenceCountedHandle< X >
 

Detailed Description

template<class X>
class G4CountedObject< X >

Definition at line 114 of file G4ReferenceCountedHandle.hh.

Constructor & Destructor Documentation

◆ G4CountedObject()

template<class X >
G4CountedObject< X >::G4CountedObject ( X *  pObj = nullptr)

Definition at line 154 of file G4ReferenceCountedHandle.hh.

155 : fRep(pObj)
156{
157 if(pObj != nullptr)
158 fCount = 1;
159}

◆ ~G4CountedObject()

template<class X >
G4CountedObject< X >::~G4CountedObject

Definition at line 162 of file G4ReferenceCountedHandle.hh.

163{
164 delete fRep;
165}

Member Function Documentation

◆ AddRef()

template<class X >
void G4CountedObject< X >::AddRef
inline

Definition at line 168 of file G4ReferenceCountedHandle.hh.

169{
170 ++fCount;
171}

◆ operator delete()

template<class X >
void G4CountedObject< X >::operator delete ( void *  pObj)
inline

Definition at line 189 of file G4ReferenceCountedHandle.hh.

190{
191 aCountedObjectAllocator()->FreeSingle((G4CountedObject<void>*) pObj);
192}
G4GLOB_DLL G4Allocator< G4CountedObject< void > > *& aCountedObjectAllocator()

◆ operator new()

template<class X >
void * G4CountedObject< X >::operator new ( std::size_t  )
inline

Definition at line 181 of file G4ReferenceCountedHandle.hh.

182{
183 if(aCountedObjectAllocator() == nullptr)
185 return ((void*) aCountedObjectAllocator()->MallocSingle());
186}

◆ Release()

template<class X >
void G4CountedObject< X >::Release
inline

Definition at line 174 of file G4ReferenceCountedHandle.hh.

175{
176 if(--fCount == 0)
177 delete this;
178}

Friends And Related Function Documentation

◆ G4ReferenceCountedHandle< X >

template<class X >
friend class G4ReferenceCountedHandle< X >
friend

Definition at line 107 of file G4ReferenceCountedHandle.hh.


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