Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions
G4Cache< VALTYPE > Class Template Reference

#include <G4Cache.hh>

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 ()
 

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 237 of file G4Cache.hh.

238 { //Move base calss
239 #ifdef g4cdebug
240  cout<<"~G4Cache id: "<<id<<" "<<endl;
241 #endif
242  G4AutoLock l(&gMutex);
243  ++dstrctr;
244  G4bool last = ( dstrctr == instancesctr );
245  theCache.Destroy(id,last);
246  if (last) {
247  instancesctr = 0;
248  dstrctr = 0;
249  }
250 }
bool G4bool
Definition: G4Types.hh:79
void Destroy(unsigned int id, G4bool last)

Member Function Documentation

template<class V >
V & G4Cache< V >::Get ( ) const
inline
template<class VALTYPE>
const int& G4Cache< VALTYPE >::GetId ( ) const
inlineprotected

Definition at line 109 of file G4Cache.hh.

Referenced by G4MapCache< KEYTYPE, VALTYPE >::~G4MapCache().

109 { return id; }
template<class V >
V G4Cache< V >::Pop ( )
inline

Definition at line 262 of file G4Cache.hh.

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

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