Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4CountedObject< X > Class Template Reference

#include <G4ReferenceCountedHandle.hh>

Public Member Functions

 G4CountedObject (X *pObj=0)
 
 ~G4CountedObject ()
 
void AddRef ()
 
void Release ()
 
voidoperator new (size_t)
 
void operator delete (void *pObj)
 

Friends

class G4ReferenceCountedHandle< X >
 

Detailed Description

template<class X>
class G4CountedObject< X >

Definition at line 60 of file G4ReferenceCountedHandle.hh.

Constructor & Destructor Documentation

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

Definition at line 172 of file G4ReferenceCountedHandle.hh.

173  : fCount(0), fRep( pObj )
174 {
175  if( pObj != 0 ) fCount = 1;
176 }
template<class X >
G4CountedObject< X >::~G4CountedObject ( )

Definition at line 179 of file G4ReferenceCountedHandle.hh.

180 {
181  delete fRep;
182 }

Member Function Documentation

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

Definition at line 185 of file G4ReferenceCountedHandle.hh.

186 {
187  ++fCount;
188 }
template<class X >
void G4CountedObject< X >::operator delete ( void pObj)
inline

Definition at line 205 of file G4ReferenceCountedHandle.hh.

206 {
207  aCountedObjectAllocator->FreeSingle( (G4CountedObject<void>*)pObj );
208 }
G4GLOB_DLL G4ThreadLocal G4Allocator< G4CountedObject< void > > * aCountedObjectAllocator
template<class X >
void * G4CountedObject< X >::operator new ( size_t  )
inline

Definition at line 197 of file G4ReferenceCountedHandle.hh.

198 {
201  return( (void *)aCountedObjectAllocator->MallocSingle() );
202 }
G4GLOB_DLL G4ThreadLocal G4Allocator< G4CountedObject< void > > * aCountedObjectAllocator
template<class X >
void G4CountedObject< X >::Release ( )
inline

Definition at line 191 of file G4ReferenceCountedHandle.hh.

192 {
193  if( --fCount == 0 ) delete this;
194 }

Friends And Related Function Documentation

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

Definition at line 133 of file G4ReferenceCountedHandle.hh.


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