Geant4 11.1.1
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

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

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 >
using G4MapCache< KEYTYPE, VALTYPE >::const_iterator = typename map_type::const_iterator

Definition at line 185 of file G4Cache.hh.

◆ iterator

template<class KEYTYPE , class VALTYPE >
using G4MapCache< KEYTYPE, VALTYPE >::iterator = typename map_type::iterator

Definition at line 184 of file G4Cache.hh.

◆ key_type

template<class KEYTYPE , class VALTYPE >
using G4MapCache< KEYTYPE, VALTYPE >::key_type = KEYTYPE

Definition at line 180 of file G4Cache.hh.

◆ map_type

template<class KEYTYPE , class VALTYPE >
using G4MapCache< KEYTYPE, VALTYPE >::map_type = typename std::map<key_type, value_type>

Definition at line 182 of file G4Cache.hh.

◆ size_type

template<class KEYTYPE , class VALTYPE >
using G4MapCache< KEYTYPE, VALTYPE >::size_type = typename map_type::size_type

Definition at line 183 of file G4Cache.hh.

◆ value_type

template<class KEYTYPE , class VALTYPE >
using G4MapCache< KEYTYPE, VALTYPE >::value_type = VALTYPE

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

423{
424#ifdef g4cdebug
425 std::cout << "~G4MacCache " << G4Cache<map_type>::GetId()
426 << " with size: " << Size() << "->";
427 for(iterator it = Begin(); it != End(); ++it)
428 std::cout << it->first << ":" << it->second << ",";
429 std::cout << "<-" << std::endl;
430#endif
431}
const G4int & GetId() const
Definition: G4Cache.hh:116
typename map_type::iterator iterator
Definition: G4Cache.hh:184
iterator Begin()
Definition: G4Cache.hh:447
iterator End()
Definition: G4Cache.hh:452
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 447 of file G4Cache.hh.

448{
449 return G4Cache<map_type>::Get().begin();
450}
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 452 of file G4Cache.hh.

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

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

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

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

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

◆ Has()

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

Definition at line 464 of file G4Cache.hh.

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

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

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

◆ operator[]()

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

Definition at line 482 of file G4Cache.hh.

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

◆ 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: