Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CacheReference< G4double > Class Reference

#include <G4CacheDetails.hh>

Public Member Functions

void Initialize (unsigned int id)
 
void Destroy (unsigned int id, G4bool last)
 
G4doubleGetCache (unsigned int id) const
 

Detailed Description

Definition at line 116 of file G4CacheDetails.hh.

Member Function Documentation

◆ Destroy()

void G4CacheReference< G4double >::Destroy ( unsigned int id,
G4bool last )
inline

Definition at line 298 of file G4CacheDetails.hh.

299{
300 if(cache() != nullptr && last)
301 {
302#ifdef g4cdebug
303 std::cout << "DB: Destroying LAST element! Is it last? " << last
304 << std::endl;
305#endif
306 delete cache();
307 cache() = nullptr;
308 }
309}

◆ GetCache()

G4double & G4CacheReference< G4double >::GetCache ( unsigned int id) const
inline

Definition at line 311 of file G4CacheDetails.hh.

312{
313 return cache()->operator[](id);
314}

◆ Initialize()

void G4CacheReference< G4double >::Initialize ( unsigned int id)
inline

Definition at line 283 of file G4CacheDetails.hh.

284{
285 if(cache() == nullptr)
286 {
287#ifdef g4cdebug
288 std::cout << "Specialized template for G4double container..." << std::endl;
289#endif
290 cache() = new cache_container;
291 }
292 if(cache()->size() <= id)
293 {
294 cache()->resize(id + 1, static_cast<G4double>(0));
295 }
296}
double G4double
Definition G4Types.hh:83

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