Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MapCache< KEYTYPE, VALTYPE > Class Template Reference

#include <G4Cache.hh>

+ Inheritance diagram for G4MapCache< KEYTYPE, VALTYPE >:

Public Types

typedef KEYTYPE key_type
 
typedef VALTYPE value_type
 
typedef std::map< key_type, value_typemap_type
 
typedef map_type::size_type size_type
 
typedef map_type::iterator iterator
 
typedef map_type::const_iterator const_iterator
 
- Public Types inherited from G4Cache< std::map< KEYTYPE, VALTYPE > >
typedef std::map< KEYTYPE, VALTYPE > value_type
 

Public Member Functions

virtual ~G4MapCache ()
 
G4bool Has (const key_type &k)
 
std::pair< iterator, G4boolInsert (const key_type &k, const value_type &v)
 
iterator Begin ()
 
iterator End ()
 
iterator Find (const key_type &k)
 
value_typeGet (const key_type &k)
 
size_type Erase (const key_type &k)
 
value_typeoperator[] (const key_type &k)
 
size_type Size ()
 
- Public Member Functions inherited from G4Cache< std::map< KEYTYPE, 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::map< KEYTYPE, VALTYPE > >
const G4intGetId () const
 

Detailed Description

template<class KEYTYPE, class VALTYPE>
class G4MapCache< KEYTYPE, VALTYPE >

Definition at line 175 of file G4Cache.hh.

Member Typedef Documentation

◆ const_iterator

template<class KEYTYPE , class VALTYPE >
typedef map_type::const_iterator G4MapCache< KEYTYPE, VALTYPE >::const_iterator

Definition at line 185 of file G4Cache.hh.

◆ iterator

template<class KEYTYPE , class VALTYPE >
typedef map_type::iterator G4MapCache< KEYTYPE, VALTYPE >::iterator

Definition at line 184 of file G4Cache.hh.

◆ key_type

template<class KEYTYPE , class VALTYPE >
typedef KEYTYPE G4MapCache< KEYTYPE, VALTYPE >::key_type

Definition at line 180 of file G4Cache.hh.

◆ map_type

template<class KEYTYPE , class VALTYPE >
typedef std::map<key_type, value_type> G4MapCache< KEYTYPE, VALTYPE >::map_type

Definition at line 182 of file G4Cache.hh.

◆ size_type

template<class KEYTYPE , class VALTYPE >
typedef map_type::size_type G4MapCache< KEYTYPE, VALTYPE >::size_type

Definition at line 183 of file G4Cache.hh.

◆ value_type

template<class KEYTYPE , class VALTYPE >
typedef VALTYPE G4MapCache< KEYTYPE, VALTYPE >::value_type

Definition at line 181 of file G4Cache.hh.

Constructor & Destructor Documentation

◆ ~G4MapCache()

template<class K , class V >
G4MapCache< K, V >::~G4MapCache
virtual

Definition at line 423 of file G4Cache.hh.

424{
425#ifdef g4cdebug
426 std::cout << "~G4MacCache " << G4Cache<map_type>::GetId()
427 << " with size: " << Size() << "->";
428 for(iterator it = Begin(); it != End(); ++it)
429 std::cout << it->first << ":" << it->second << ",";
430 std::cout << "<-" << std::endl;
431#endif
432}
const G4int & GetId() const
Definition: G4Cache.hh:116
map_type::iterator iterator
Definition: G4Cache.hh:184
iterator Begin()
Definition: G4Cache.hh:448
iterator End()
Definition: G4Cache.hh:453
size_type Size()
Definition: G4Cache.hh:203

Member Function Documentation

◆ Begin()

template<class K , class V >
G4MapCache< K, V >::iterator G4MapCache< K, V >::Begin
inline

Definition at line 448 of file G4Cache.hh.

449{
450 return G4Cache<map_type>::Get().begin();
451}
value_type & Get() const
Definition: G4Cache.hh:315

◆ End()

template<class K , class V >
G4MapCache< K, V >::iterator G4MapCache< K, V >::End
inline

Definition at line 453 of file G4Cache.hh.

454{
455 return G4Cache<map_type>::Get().end();
456}

Referenced by G4VBiasingOperator::AttachTo(), and G4VBiasingOperator::GetBiasingOperator().

◆ Erase()

template<class KEYTYPE , class VALTYPE >
G4MapCache< K, V >::size_type G4MapCache< K, V >::Erase ( const key_type k)
inline

Definition at line 477 of file G4Cache.hh.

478{
479 return G4Cache<map_type>::Get().erase(k);
480}

◆ Find()

template<class KEYTYPE , class VALTYPE >
G4MapCache< K, V >::iterator G4MapCache< K, V >::Find ( const key_type k)
inline

◆ Get()

template<class KEYTYPE , class VALTYPE >
V & G4MapCache< K, V >::Get ( const key_type k)
inline

Definition at line 471 of file G4Cache.hh.

472{
473 return Find(k)->second;
474}
iterator Find(const key_type &k)
Definition: G4Cache.hh:459

◆ Has()

template<class KEYTYPE , class VALTYPE >
G4bool G4MapCache< K, V >::Has ( const key_type k)
inline

Definition at line 465 of file G4Cache.hh.

466{
467 return (Find(k) != End());
468}

◆ Insert()

template<class KEYTYPE , class VALTYPE >
std::pair< typename G4MapCache< K, V >::iterator, G4bool > G4MapCache< K, V >::Insert ( const key_type k,
const value_type v 
)
inline

Definition at line 435 of file G4Cache.hh.

437{
438 return G4Cache<map_type>::Get().insert(std::pair<key_type, value_type>(k, v));
439}

◆ operator[]()

template<class KEYTYPE , class VALTYPE >
V & G4MapCache< K, V >::operator[] ( const key_type k)
inline

Definition at line 483 of file G4Cache.hh.

484{
485 return (G4Cache<map_type>::Get())[k];
486}

◆ Size()

template<class KEYTYPE , class VALTYPE >
size_type G4MapCache< KEYTYPE, VALTYPE >::Size ( )
inline

Definition at line 203 of file G4Cache.hh.

203{ return G4Cache<map_type>::Get().size(); }

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