Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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
 
void * operator 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

◆ G4ReferenceCountedHandle() [1/2]

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

Definition at line 221 of file G4ReferenceCountedHandle.hh.

223 : fObj( 0 )
224{
225 if( rep != 0 ) {
226 fObj = new G4CountedObject<X>( rep );
227 }
228}

◆ G4ReferenceCountedHandle() [2/2]

template<class X >
G4ReferenceCountedHandle< X >::G4ReferenceCountedHandle ( const G4ReferenceCountedHandle< X > &  right)
inline

Definition at line 231 of file G4ReferenceCountedHandle.hh.

233 : fObj( right.fObj )
234{
235 fObj->AddRef();
236}

◆ ~G4ReferenceCountedHandle()

template<class X >
G4ReferenceCountedHandle< X >::~G4ReferenceCountedHandle
inline

Definition at line 239 of file G4ReferenceCountedHandle.hh.

240{
241 if( fObj ) fObj->Release();
242}

Member Function Documentation

◆ Count()

template<class X >
unsigned int G4ReferenceCountedHandle< X >::Count
inline

Definition at line 268 of file G4ReferenceCountedHandle.hh.

269{
270 return( fObj ? fObj->fCount : 0 );
271}

◆ operator bool()

template<class X >
G4ReferenceCountedHandle< X >::operator bool
inline

Definition at line 286 of file G4ReferenceCountedHandle.hh.

287{
288 return( ( fObj ) ? true : false );
289}

◆ operator delete()

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

Definition at line 304 of file G4ReferenceCountedHandle.hh.

305{
307}
G4DLLIMPORT G4Allocator< G4ReferenceCountedHandle< void > > aRCHAllocator

◆ operator new()

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

Definition at line 298 of file G4ReferenceCountedHandle.hh.

299{
300 return( (void *)aRCHAllocator.MallocSingle() );
301}

◆ operator!()

template<class X >
G4bool G4ReferenceCountedHandle< X >::operator!
inline

Definition at line 280 of file G4ReferenceCountedHandle.hh.

281{
282 return( ( !fObj ) ? true : false );
283}

◆ operator()()

template<class X >
X * G4ReferenceCountedHandle< X >::operator()
inline

Definition at line 292 of file G4ReferenceCountedHandle.hh.

293{
294 return( fObj ? fObj->fRep : 0 );
295}

◆ operator->()

template<class X >
X * G4ReferenceCountedHandle< X >::operator->
inline

Definition at line 274 of file G4ReferenceCountedHandle.hh.

275{
276 return( fObj ? fObj->fRep : 0 );
277}

◆ operator=() [1/2]

template<class X >
G4ReferenceCountedHandle< X > & G4ReferenceCountedHandle< X >::operator= ( const G4ReferenceCountedHandle< X > &  right)
inline

Definition at line 245 of file G4ReferenceCountedHandle.hh.

247{
248 if( fObj != right.fObj ) {
249 if( fObj )
250 fObj->Release();
251 this->fObj = right.fObj;
252 fObj->AddRef();
253 }
254 return *this;
255}

◆ operator=() [2/2]

template<class X >
G4ReferenceCountedHandle< X > & G4ReferenceCountedHandle< X >::operator= ( X *  objPtr)
inline

Definition at line 258 of file G4ReferenceCountedHandle.hh.

260{
261 if( fObj )
262 fObj->Release();
263 this->fObj = new G4CountedObject<X>( objPtr );
264 return *this;
265}

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