Geant4-11
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4VectorCache< VALTYPE > Class Template Reference

#include <G4Cache.hh>

Inheritance diagram for G4VectorCache< VALTYPE >:
G4Cache< std::vector< VALTYPE > >

Public Types

typedef vector_type::const_iterator const_iterator
 
typedef vector_type::iterator iterator
 
typedef vector_type::size_type size_type
 
typedef VALTYPE value_type
 
typedef std::vector< value_typevector_type
 

Public Member Functions

iterator Begin ()
 
void Clear ()
 
iterator End ()
 
 G4VectorCache ()
 
 G4VectorCache (G4int nElems)
 
 G4VectorCache (G4int nElems, value_type *vals)
 
value_typeGet () const
 
value_typeoperator[] (const G4int &idx)
 
value_type Pop ()
 
value_type Pop_back ()
 
void Push_back (const value_type &val)
 
void Put (const value_type &val) const
 
size_type Size ()
 
virtual ~G4VectorCache ()
 

Protected Member Functions

const G4intGetId () const
 

Private Member Functions

value_typeGetCache () const
 

Private Attributes

G4int id
 
G4CacheReference< value_typetheCache
 

Static Private Attributes

static std::atomic< unsigned int > dstrctr
 
static std::atomic< unsigned int > instancesctr
 

Detailed Description

template<class VALTYPE>
class G4VectorCache< VALTYPE >

Definition at line 135 of file G4Cache.hh.

Member Typedef Documentation

◆ const_iterator

template<class VALTYPE >
typedef vector_type::const_iterator G4VectorCache< VALTYPE >::const_iterator

Definition at line 144 of file G4Cache.hh.

◆ iterator

template<class VALTYPE >
typedef vector_type::iterator G4VectorCache< VALTYPE >::iterator

Definition at line 143 of file G4Cache.hh.

◆ size_type

template<class VALTYPE >
typedef vector_type::size_type G4VectorCache< VALTYPE >::size_type

Definition at line 142 of file G4Cache.hh.

◆ value_type

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

Definition at line 140 of file G4Cache.hh.

◆ vector_type

template<class VALTYPE >
typedef std::vector<value_type> G4VectorCache< VALTYPE >::vector_type

Definition at line 141 of file G4Cache.hh.

Constructor & Destructor Documentation

◆ G4VectorCache() [1/3]

template<class V >
G4VectorCache< V >::G4VectorCache

Definition at line 342 of file G4Cache.hh.

343{}

◆ G4VectorCache() [2/3]

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

Definition at line 359 of file G4Cache.hh.

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

References G4Cache< VALTYPE >::Get().

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

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

Member Function Documentation

◆ Begin()

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

Definition at line 397 of file G4Cache.hh.

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

References G4Cache< VALTYPE >::Get().

◆ Clear()

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

Definition at line 409 of file G4Cache.hh.

410{
412}

References G4Cache< VALTYPE >::Get().

◆ End()

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

Definition at line 403 of file G4Cache.hh.

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

References G4Cache< VALTYPE >::Get().

◆ Get()

V & G4Cache< V >::Get
inlineinherited

Definition at line 103 of file G4Cache.hh.

316{
317 return GetCache();
318}
value_type & GetCache() const
Definition: G4Cache.hh:124

◆ GetCache()

value_type & G4Cache< std::vector< VALTYPE > >::GetCache ( ) const
inlineprivateinherited

Definition at line 124 of file G4Cache.hh.

125 {
127 return theCache.GetCache(id);
128 }
VALTYPE & GetCache(unsigned int id) const
void Initialize(unsigned int id)
G4CacheReference< value_type > theCache
Definition: G4Cache.hh:120

◆ GetId()

const G4int & G4Cache< std::vector< VALTYPE > >::GetId ( ) const
inlineprotectedinherited

Definition at line 116 of file G4Cache.hh.

116{ return id; }

◆ operator[]()

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

Definition at line 390 of file G4Cache.hh.

391{
393 return cc[idx];
394}

References G4Cache< VALTYPE >::Get().

◆ Pop()

V G4Cache< V >::Pop
inlineinherited

Definition at line 109 of file G4Cache.hh.

329{
330 return GetCache();
331}

◆ Pop_back()

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

Definition at line 381 of file G4Cache.hh.

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

References G4Cache< VALTYPE >::Get().

◆ Push_back()

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

Definition at line 375 of file G4Cache.hh.

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

References G4Cache< VALTYPE >::Get().

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

◆ Put()

void G4Cache< V >::Put ( const value_type val) const
inlineinherited

Definition at line 106 of file G4Cache.hh.

322{
323 GetCache() = val;
324}

◆ Size()

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

Field Documentation

◆ dstrctr

std::atomic< unsigned int > G4Cache< V >::dstrctr
staticprivateinherited

Definition at line 122 of file G4Cache.hh.

◆ id

G4int G4Cache< std::vector< VALTYPE > >::id
privateinherited

Definition at line 119 of file G4Cache.hh.

◆ instancesctr

std::atomic< unsigned int > G4Cache< V >::instancesctr
staticprivateinherited

Definition at line 121 of file G4Cache.hh.

◆ theCache

G4CacheReference<value_type> G4Cache< std::vector< VALTYPE > >::theCache
mutableprivateinherited

Definition at line 120 of file G4Cache.hh.


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