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

#include <G4ReferenceCountedHandle.hh>

Public Member Functions

 G4ReferenceCountedHandle (X *rep=0)
 
 G4ReferenceCountedHandle (const G4ReferenceCountedHandle< X > &right)
 
 ~G4ReferenceCountedHandle ()
 
G4ReferenceCountedHandle< X > & operator= (const G4ReferenceCountedHandle< X > &right)
 
G4ReferenceCountedHandle< X > & operator= (X *objPtr)
 
unsigned int Count () const
 
X * operator-> () const
 
G4bool operator! () const
 
 operator bool () const
 
X * operator() () const
 
voidoperator new (size_t)
 
void operator delete (void *pObj)
 

Detailed Description

template<class X>
class G4ReferenceCountedHandle< X >

Definition at line 63 of file G4ReferenceCountedHandle.hh.

Constructor & Destructor Documentation

template<class X>
G4ReferenceCountedHandle< X >::G4ReferenceCountedHandle ( X *  rep = 0)
inline

Definition at line 214 of file G4ReferenceCountedHandle.hh.

215  : fObj( 0 )
216 {
217  if( rep != 0 )
218  fObj = new G4CountedObject<X>( rep );
219 }
template<class X>
G4ReferenceCountedHandle< X >::G4ReferenceCountedHandle ( const G4ReferenceCountedHandle< X > &  right)
inline

Definition at line 223 of file G4ReferenceCountedHandle.hh.

224  : fObj( right.fObj )
225 {
226  fObj->AddRef();
227 }
template<class X >
G4ReferenceCountedHandle< X >::~G4ReferenceCountedHandle ( )
inline

Definition at line 230 of file G4ReferenceCountedHandle.hh.

231 {
232  if( fObj ) fObj->Release();
233 }

Member Function Documentation

template<class X >
unsigned int G4ReferenceCountedHandle< X >::Count ( ) const
inline

Definition at line 260 of file G4ReferenceCountedHandle.hh.

261 {
262  return( fObj ? fObj->fCount : 0 );
263 }
template<class X >
G4ReferenceCountedHandle< X >::operator bool ( ) const
inline

Definition at line 278 of file G4ReferenceCountedHandle.hh.

279 {
280  return( ( fObj ) ? true : false );
281 }
template<class X >
void G4ReferenceCountedHandle< X >::operator delete ( void pObj)
inline

Definition at line 298 of file G4ReferenceCountedHandle.hh.

299 {
300  aRCHAllocator->FreeSingle( (G4ReferenceCountedHandle<void>*)pObj );
301 }
G4GLOB_DLL G4ThreadLocal G4Allocator< G4ReferenceCountedHandle< void > > * aRCHAllocator
template<class X >
void * G4ReferenceCountedHandle< X >::operator new ( size_t  )
inline

Definition at line 290 of file G4ReferenceCountedHandle.hh.

291 {
292  if (!aRCHAllocator)
294  return( (void *)aRCHAllocator->MallocSingle() );
295 }
G4GLOB_DLL G4ThreadLocal G4Allocator< G4ReferenceCountedHandle< void > > * aRCHAllocator
template<class X >
G4bool G4ReferenceCountedHandle< X >::operator! ( ) const
inline

Definition at line 272 of file G4ReferenceCountedHandle.hh.

273 {
274  return( ( !fObj ) ? true : false );
275 }
template<class X >
X * G4ReferenceCountedHandle< X >::operator() ( ) const
inline

Definition at line 284 of file G4ReferenceCountedHandle.hh.

285 {
286  return( fObj ? fObj->fRep : 0 );
287 }
template<class X >
X * G4ReferenceCountedHandle< X >::operator-> ( ) const
inline

Definition at line 266 of file G4ReferenceCountedHandle.hh.

267 {
268  return( fObj ? fObj->fRep : 0 );
269 }
template<class X>
G4ReferenceCountedHandle< X > & G4ReferenceCountedHandle< X >::operator= ( const G4ReferenceCountedHandle< X > &  right)
inline

Definition at line 237 of file G4ReferenceCountedHandle.hh.

238 {
239  if( fObj != right.fObj )
240  {
241  if( fObj )
242  fObj->Release();
243  this->fObj = right.fObj;
244  fObj->AddRef();
245  }
246  return *this;
247 }
template<class X>
G4ReferenceCountedHandle< X > & G4ReferenceCountedHandle< X >::operator= ( X *  objPtr)
inline

Definition at line 251 of file G4ReferenceCountedHandle.hh.

252 {
253  if( fObj )
254  fObj->Release();
255  this->fObj = new G4CountedObject<X>( objPtr );
256  return *this;
257 }

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