Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VectorCache< VALTYPE > Class Template Reference

#include <G4Cache.hh>

+ Inheritance diagram for G4VectorCache< VALTYPE >:

Public Types

using value_type = VALTYPE
 
using vector_type = typename std::vector< value_type >
 
using size_type = typename vector_type::size_type
 
using iterator = typename vector_type::iterator
 
using const_iterator = typename vector_type::const_iterator
 
- Public Types inherited from G4Cache< std::vector< VALTYPE > >
using value_type = std::vector< VALTYPE >
 

Public Member Functions

 G4VectorCache ()
 
 G4VectorCache (G4int nElems)
 
 G4VectorCache (G4int nElems, value_type *vals)
 
virtual ~G4VectorCache ()
 
void Push_back (const value_type &val)
 
value_type Pop_back ()
 
value_typeoperator[] (const G4int &idx)
 
iterator Begin ()
 
iterator End ()
 
void Clear ()
 
size_type Size ()
 
- Public Member Functions inherited from G4Cache< std::vector< VALTYPE > >
 G4Cache ()
 
 G4Cache (const value_type &v)
 
 G4Cache (const G4Cache &rhs)
 
virtual ~G4Cache ()
 
value_typeGet () const
 
void Put (const value_type &val) const
 
value_type Pop ()
 
G4Cacheoperator= (const G4Cache &rhs)
 

Additional Inherited Members

- Protected Member Functions inherited from G4Cache< std::vector< VALTYPE > >
const G4intGetId () const
 

Detailed Description

template<class VALTYPE>
class G4VectorCache< VALTYPE >

Definition at line 135 of file G4Cache.hh.

Member Typedef Documentation

◆ const_iterator

template<class VALTYPE >
using G4VectorCache< VALTYPE >::const_iterator = typename vector_type::const_iterator

Definition at line 144 of file G4Cache.hh.

◆ iterator

template<class VALTYPE >
using G4VectorCache< VALTYPE >::iterator = typename vector_type::iterator

Definition at line 143 of file G4Cache.hh.

◆ size_type

template<class VALTYPE >
using G4VectorCache< VALTYPE >::size_type = typename vector_type::size_type

Definition at line 142 of file G4Cache.hh.

◆ value_type

template<class VALTYPE >
using G4VectorCache< VALTYPE >::value_type = VALTYPE

Definition at line 140 of file G4Cache.hh.

◆ vector_type

template<class VALTYPE >
using G4VectorCache< VALTYPE >::vector_type = typename std::vector<value_type>

Definition at line 141 of file G4Cache.hh.

Constructor & Destructor Documentation

◆ G4VectorCache() [1/3]

template<class V >
G4VectorCache< V >::G4VectorCache ( )
default

◆ G4VectorCache() [2/3]

template<class V >
G4VectorCache< V >::G4VectorCache ( G4int  nElems)

Definition at line 358 of file G4Cache.hh.

359{
361 cc.resize(nElems);
362}
value_type & Get() const
Definition: G4Cache.hh:315
typename std::vector< value_type > vector_type
Definition: G4Cache.hh:141

◆ G4VectorCache() [3/3]

template<class VALTYPE >
G4VectorCache< VALTYPE >::G4VectorCache ( G4int  nElems,
value_type vals 
)

◆ ~G4VectorCache()

template<class V >
G4VectorCache< V >::~G4VectorCache
virtual

Definition at line 345 of file G4Cache.hh.

346{
347#ifdef g4cdebug
348 std::cout << "~G4VectorCache "
350 << " with size: " << Size() << "->";
351 for(size_type i = 0; i < Size(); ++i)
352 std::cout << operator[](i) << ",";
353 std::cout << "<-" << std::endl;
354#endif
355}
const G4int & GetId() const
Definition: G4Cache.hh:116
typename vector_type::size_type size_type
Definition: G4Cache.hh:142
size_type Size()
Definition: G4Cache.hh:166

Member Function Documentation

◆ Begin()

template<class V >
G4VectorCache< V >::iterator G4VectorCache< V >::Begin
inline

Definition at line 396 of file G4Cache.hh.

397{
398 return G4Cache<vector_type>::Get().begin();
399}

◆ Clear()

template<class V >
void G4VectorCache< V >::Clear
inline

Definition at line 408 of file G4Cache.hh.

409{
411}

◆ End()

template<class V >
G4VectorCache< V >::iterator G4VectorCache< V >::End
inline

Definition at line 402 of file G4Cache.hh.

403{
404 return G4Cache<vector_type>::Get().end();
405}

◆ operator[]()

template<class V >
V & G4VectorCache< V >::operator[] ( const G4int idx)
inline

Definition at line 389 of file G4Cache.hh.

390{
392 return cc[idx];
393}

◆ Pop_back()

template<class V >
V G4VectorCache< V >::Pop_back
inline

Definition at line 380 of file G4Cache.hh.

381{
383 value_type val = cc[cc.size() - 1];
384 cc.pop_back();
385 return val;
386}
VALTYPE value_type
Definition: G4Cache.hh:140

◆ Push_back()

template<class VALTYPE >
void G4VectorCache< V >::Push_back ( const value_type val)
inline

Definition at line 374 of file G4Cache.hh.

375{
376 G4Cache<vector_type>::Get().push_back(val);
377}

Referenced by G4VBiasingOperator::G4VBiasingOperator(), and G4BiasingOperationManager::Register().

◆ Size()

template<class VALTYPE >
size_type G4VectorCache< VALTYPE >::Size ( )
inline

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