Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4Cache< VALTYPE > Class Template Reference

#include <G4Cache.hh>

Inheritance diagram for G4Cache< VALTYPE >:

Public Types

typedef VALTYPE value_type
 

Public Member Functions

 G4Cache ()
 
 G4Cache (const value_type &v)
 
virtual ~G4Cache ()
 
value_typeGet () const
 
void Put (const value_type &val) const
 
value_type Pop ()
 
 G4Cache (const G4Cache &rhs)
 
G4Cacheoperator= (const G4Cache &rhs)
 

Protected Member Functions

const intGetId () const
 

Detailed Description

template<class VALTYPE>
class G4Cache< VALTYPE >

Definition at line 85 of file G4Cache.hh.

Member Typedef Documentation

template<class VALTYPE>
typedef VALTYPE G4Cache< VALTYPE >::value_type

Definition at line 87 of file G4Cache.hh.

Constructor & Destructor Documentation

template<class V >
G4Cache< V >::G4Cache ( )

Definition at line 216 of file G4Cache.hh.

217 {
218  G4AutoLock l(&gMutex);
219  id = instancesctr++;
220 #ifdef g4cdebug
221  cout<<"G4Cache id: "<<id<<endl;
222 #endif
223 }
template<class VALTYPE>
G4Cache< VALTYPE >::G4Cache ( const value_type v)
template<class V >
G4Cache< V >::~G4Cache ( )
virtual

Definition at line 266 of file G4Cache.hh.

267 { //Move base calss
268 #ifdef g4cdebug
269  cout<<"~G4Cache id: "<<id<<" "<<endl;
270 #endif
271  G4AutoLock l(&gMutex);
272  ++dstrctr;
273  G4bool last = ( dstrctr == instancesctr );
274  theCache.Destroy(id,last);
275  if (last) {
276  instancesctr = 0;
277  dstrctr = 0;
278  }
279 }
bool G4bool
Definition: G4Types.hh:79
void Destroy(unsigned int id, G4bool last)
template<class VALTYPE>
G4Cache< VALTYPE >::G4Cache ( const G4Cache< VALTYPE > &  rhs)

Member Function Documentation

template<class V >
V & G4Cache< V >::Get ( ) const
inline

Definition at line 282 of file G4Cache.hh.

283 { return GetCache(); }
template<class VALTYPE>
const int& G4Cache< VALTYPE >::GetId ( ) const
inlineprotected

Definition at line 112 of file G4Cache.hh.

112 { return id; }

Here is the caller graph for this function:

template<class VALTYPE>
G4Cache< V > & G4Cache< V >::operator= ( const G4Cache< VALTYPE > &  rhs)

Definition at line 242 of file G4Cache.hh.

243 {
244  if (this == &rhs) return *this;
245  //Force copy of cached data
246  V aCopy = rhs.GetCache();
247  Put(aCopy);
248 #ifdef g4cdebug
249  cout<<"Assignement operator with id: "<<id<<endl;
250 #endif
251  return *this;
252 }
void Put(const value_type &val) const
Definition: G4Cache.hh:286
template<class V >
V G4Cache< V >::Pop ( )
inline

Definition at line 291 of file G4Cache.hh.

292 { return GetCache(); }
template<class VALTYPE>
void G4Cache< V >::Put ( const value_type val) const
inline

Definition at line 286 of file G4Cache.hh.

287 { GetCache() = val; }

Here is the caller graph for this function:


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