Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VTHitsMap< T, Map_t > Class Template Reference

#include <G4THitsMap.hh>

+ Inheritance diagram for G4VTHitsMap< T, Map_t >:

Public Types

using this_type = G4VTHitsMap<T, Map_t>
 
using value_type = T
 
using map_type = Map_t
 
using iterator = typename map_type::iterator
 
using const_iterator = typename map_type::const_iterator
 

Public Member Functions

 G4VTHitsMap ()
 
 G4VTHitsMap (const G4String &detName, const G4String &colNam)
 
 ~G4VTHitsMap () override
 
G4bool operator== (const G4VTHitsMap< T, Map_t > &right) const
 
template<typename U, typename MapU_t>
this_typeoperator+= (const G4VTHitsMap< U, MapU_t > &right) const
 
void DrawAllHits () override
 
void PrintAllHits () override
 
Map_t * GetContainer () const
 
Map_t::size_type size ()
 
Map_t::size_type GetIndex (iterator itr)
 
Map_t::size_type GetIndex (const_iterator itr) const
 
template<typename MapU_t = Map_t, enable_if_t<! is_mmap_t(MapU_t), G4int > = 0>
T * GetObject (G4int idx) const
 
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
T * GetObject (G4int idx) const
 
T * GetObject (iterator itr) const
 
const T * GetObject (const_iterator itr) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
Map_t * GetMap () const
 
std::size_t entries () const
 
void clear ()
 
G4VHitGetHit (std::size_t) const override
 
std::size_t GetSize () const override
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t< is_same_t(U, T) &&! is_mmap_t(MapU_t), G4int > = 0>
std::size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t set (const G4int &key, U &aHit) const
 
template<typename MapU_t = Map_t, enable_if_t<! is_mmap_t(MapU_t), G4int > = 0>
T * operator[] (G4int key) const
 
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
T * operator[] (G4int key) const
 
- Public Member Functions inherited from G4HitsCollection
 ~G4HitsCollection () override=default
 
G4bool operator== (const G4HitsCollection &right) const
 
 G4VHitsCollection ()=default
 
 G4VHitsCollection (const G4String &detName, const G4String &colNam)
 
- Public Member Functions inherited from G4VHitsCollection
 G4VHitsCollection ()=default
 
 G4VHitsCollection (const G4String &detName, const G4String &colNam)
 
virtual ~G4VHitsCollection ()=default
 
G4bool operator== (const G4VHitsCollection &right) const
 
const G4StringGetName () const
 
const G4StringGetSDname () const
 
void SetColID (G4int i)
 
G4int GetColID () const
 

Additional Inherited Members

- Protected Attributes inherited from G4HitsCollection
void * theCollection = nullptr
 
- Protected Attributes inherited from G4VHitsCollection
G4String collectionName = "Unknown"
 
G4String SDname = "Unknown"
 
G4int colID = -1
 

Detailed Description

template<typename T, typename Map_t = std::map<G4int, T*>>
class G4VTHitsMap< T, Map_t >

Definition at line 51 of file G4THitsMap.hh.

Member Typedef Documentation

◆ const_iterator

template<typename T, typename Map_t = std::map<G4int, T*>>
using G4VTHitsMap< T, Map_t >::const_iterator = typename map_type::const_iterator

Definition at line 88 of file G4THitsMap.hh.

◆ iterator

template<typename T, typename Map_t = std::map<G4int, T*>>
using G4VTHitsMap< T, Map_t >::iterator = typename map_type::iterator

Definition at line 87 of file G4THitsMap.hh.

◆ map_type

template<typename T, typename Map_t = std::map<G4int, T*>>
using G4VTHitsMap< T, Map_t >::map_type = Map_t

Definition at line 86 of file G4THitsMap.hh.

◆ this_type

template<typename T, typename Map_t = std::map<G4int, T*>>
using G4VTHitsMap< T, Map_t >::this_type = G4VTHitsMap<T, Map_t>

Definition at line 84 of file G4THitsMap.hh.

◆ value_type

template<typename T, typename Map_t = std::map<G4int, T*>>
using G4VTHitsMap< T, Map_t >::value_type = T

Definition at line 85 of file G4THitsMap.hh.

Constructor & Destructor Documentation

◆ G4VTHitsMap() [1/2]

template<typename T, typename Map_t>
G4VTHitsMap< T, Map_t >::G4VTHitsMap ( )

Definition at line 438 of file G4THitsMap.hh.

439{
440 theCollection = (void*)new Map_t;
441}

Referenced by operator==().

◆ G4VTHitsMap() [2/2]

template<typename T, typename Map_t>
G4VTHitsMap< T, Map_t >::G4VTHitsMap ( const G4String & detName,
const G4String & colNam )

Definition at line 446 of file G4THitsMap.hh.

448{
449 theCollection = (void*)new Map_t;
450}

◆ ~G4VTHitsMap()

template<typename T, typename Map_t>
G4VTHitsMap< T, Map_t >::~G4VTHitsMap ( )
override

Definition at line 455 of file G4THitsMap.hh.

456{
458 for (auto itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
459 delete itr->second;
460 delete theHitsMap;
461}
Map_t * GetMap() const
iterator end()
iterator begin()

Member Function Documentation

◆ add() [1/7]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 214 of file G4THitsMap.hh.

215 {
217 if (theHitsMap->find(key) == theHitsMap->end())
218 theHitsMap->insert(pair_t(key, new T(aHit)));
219 else
220 *theHitsMap->find(key)->second += aHit;
221 return theHitsMap->size();
222 }
Map_t::size_type size()

◆ add() [2/7]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 229 of file G4THitsMap.hh.

230 {
232 if (theHitsMap->find(key) == theHitsMap->end()) theHitsMap->insert(pair_t(key, allocate()));
233 *theHitsMap->find(key)->second += aHit;
234 return theHitsMap->size();
235 }

◆ add() [3/7]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 241 of file G4THitsMap.hh.

242 {
244 theHitsMap->insert(pair_t(key, new T(aHit)));
245 return theHitsMap->size();
246 }

◆ add() [4/7]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 253 of file G4THitsMap.hh.

254 {
256 T* hit = allocate();
257 *hit += aHit;
258 theHitsMap->insert(pair_t(key, hit));
259 return theHitsMap->size();
260 }

◆ add() [5/7]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t< is_same_t(U, T) &&! is_mmap_t(MapU_t), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U *& aHit ) const
inline

Definition at line 171 of file G4THitsMap.hh.

172 {
174 if (theHitsMap->find(key) == theHitsMap->end())
175 theHitsMap->insert(pair_t(key, new T(*aHit)));
176 else
177 *theHitsMap->find(key)->second += *aHit;
178 return theHitsMap->size();
179 }

Referenced by G4THitsMap< G4double >::add(), and operator+=().

◆ add() [6/7]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U *& aHit ) const
inline

Definition at line 185 of file G4THitsMap.hh.

186 {
188 theHitsMap->insert(pair_t(key, aHit));
189 return theHitsMap->size();
190 }

◆ add() [7/7]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U *& aHit ) const
inline

Definition at line 197 of file G4THitsMap.hh.

198 {
200 T* hit = allocate();
201 *hit += *aHit;
202 theHitsMap->insert(pair_t(key, hit));
203 return theHitsMap->size();
204 }

◆ begin() [1/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
iterator G4VTHitsMap< T, Map_t >::begin ( )
inline

Definition at line 143 of file G4THitsMap.hh.

143{ return GetContainer()->begin(); }
Map_t * GetContainer() const

Referenced by G4THitsMap< G4double >::begin().

◆ begin() [2/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::begin ( ) const
inline

Definition at line 145 of file G4THitsMap.hh.

145{ return GetContainer()->begin(); }

◆ cbegin()

template<typename T, typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::cbegin ( ) const
inline

Definition at line 147 of file G4THitsMap.hh.

147{ return GetContainer()->cbegin(); }

Referenced by G4THitsMap< G4double >::cbegin().

◆ cend()

template<typename T, typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::cend ( ) const
inline

Definition at line 148 of file G4THitsMap.hh.

148{ return GetContainer()->cend(); }

Referenced by G4THitsMap< G4double >::cend().

◆ clear()

template<typename T, typename Map_t>
void G4VTHitsMap< T, Map_t >::clear ( )
inline

Definition at line 503 of file G4THitsMap.hh.

504{
506 for (iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
507 delete itr->second;
508 theHitsMap->clear();
509}
typename map_type::iterator iterator
Definition G4THitsMap.hh:87

Referenced by G4THitsMap< G4double >::clear().

◆ DrawAllHits()

template<typename T, typename Map_t>
void G4VTHitsMap< T, Map_t >::DrawAllHits ( )
overridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 474 of file G4THitsMap.hh.

475{
476 ;
477}

Referenced by G4THitsMap< G4double >::DrawAllHits().

◆ end() [1/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
iterator G4VTHitsMap< T, Map_t >::end ( )
inline

Definition at line 144 of file G4THitsMap.hh.

144{ return GetContainer()->end(); }

Referenced by G4THitsMap< G4double >::end().

◆ end() [2/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::end ( ) const
inline

Definition at line 146 of file G4THitsMap.hh.

146{ return GetContainer()->end(); }

◆ entries()

template<typename T, typename Map_t = std::map<G4int, T*>>
std::size_t G4VTHitsMap< T, Map_t >::entries ( ) const
inline

Definition at line 154 of file G4THitsMap.hh.

154{ return ((Map_t*)theCollection)->size(); }

Referenced by G4THitsMap< G4double >::entries(), and PrintAllHits().

◆ GetContainer()

template<typename T, typename Map_t = std::map<G4int, T*>>
Map_t * G4VTHitsMap< T, Map_t >::GetContainer ( ) const
inline

Definition at line 119 of file G4THitsMap.hh.

119{ return (Map_t*)theCollection; }

Referenced by begin(), begin(), cbegin(), cend(), end(), end(), GetObject(), and size().

◆ GetHit()

template<typename T, typename Map_t = std::map<G4int, T*>>
G4VHit * G4VTHitsMap< T, Map_t >::GetHit ( std::size_t ) const
inlineoverridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 158 of file G4THitsMap.hh.

158{ return nullptr; }

Referenced by G4THitsMap< G4double >::GetHit().

◆ GetIndex() [1/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
Map_t::size_type G4VTHitsMap< T, Map_t >::GetIndex ( const_iterator itr) const
inline

Definition at line 125 of file G4THitsMap.hh.

125{ return itr->first; }

◆ GetIndex() [2/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
Map_t::size_type G4VTHitsMap< T, Map_t >::GetIndex ( iterator itr)
inline

Definition at line 123 of file G4THitsMap.hh.

123{ return itr->first; }

◆ GetMap()

template<typename T, typename Map_t = std::map<G4int, T*>>
Map_t * G4VTHitsMap< T, Map_t >::GetMap ( ) const
inline

◆ GetObject() [1/4]

template<typename T, typename Map_t = std::map<G4int, T*>>
const T * G4VTHitsMap< T, Map_t >::GetObject ( const_iterator itr) const
inline

Definition at line 141 of file G4THitsMap.hh.

141{ return itr->second; }

◆ GetObject() [2/4]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t<! is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::GetObject ( G4int idx) const
inline

Definition at line 128 of file G4THitsMap.hh.

129 {
130 return (GetContainer()->count(idx) != 0) ? (*GetContainer())[idx] : nullptr;
131 }

◆ GetObject() [3/4]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::GetObject ( G4int idx) const
inline

Definition at line 134 of file G4THitsMap.hh.

135 {
136 return (GetContainer()->count(idx) != 0) ? GetContainer()->find(idx)->second : nullptr;
137 }

◆ GetObject() [4/4]

template<typename T, typename Map_t = std::map<G4int, T*>>
T * G4VTHitsMap< T, Map_t >::GetObject ( iterator itr) const
inline

Definition at line 139 of file G4THitsMap.hh.

139{ return itr->second; }

◆ GetSize()

template<typename T, typename Map_t = std::map<G4int, T*>>
std::size_t G4VTHitsMap< T, Map_t >::GetSize ( ) const
inlineoverridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 159 of file G4THitsMap.hh.

159{ return ((Map_t*)theCollection)->size(); }

Referenced by G4THitsMap< G4double >::GetSize().

◆ operator+=()

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U, typename MapU_t>
this_type & G4VTHitsMap< T, Map_t >::operator+= ( const G4VTHitsMap< U, MapU_t > & right) const
inline

Definition at line 104 of file G4THitsMap.hh.

105 {
107 for (auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
108 add<U, map_type>(itr->first, *(itr->second));
109 return (this_type&)(*this);
110 }
G4VTHitsMap< T, Map_t > this_type
Definition G4THitsMap.hh:84
std::size_t add(const G4int &key, U *&aHit) const

◆ operator==()

template<typename T, typename Map_t>
G4bool G4VTHitsMap< T, Map_t >::operator== ( const G4VTHitsMap< T, Map_t > & right) const

Definition at line 466 of file G4THitsMap.hh.

467{
469}

◆ operator[]() [1/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t<! is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::operator[] ( G4int key) const
inline

Definition at line 400 of file G4THitsMap.hh.

401 {
403 if (theHitsMap->find(key) != theHitsMap->end()) return theHitsMap->find(key)->second;
404 return nullptr;
405 }

◆ operator[]() [2/2]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::operator[] ( G4int key) const
inline

Definition at line 408 of file G4THitsMap.hh.

409 {
410#ifdef G4VERBOSE
411 static G4bool _first = true;
412 if (_first) {
413 _first = false;
414 G4Exception("G4THitsMap operator[]", "calling [] on multimap", JustWarning,
415 "Returning the last matching entry");
416 }
417#endif
419 iterator itr = theHitsMap->find(key);
420 if (itr != theHitsMap->end()) {
421 std::advance(itr, theHitsMap->count(key) - 1);
422 return itr->second;
423 }
424 return nullptr;
425 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)

◆ PrintAllHits()

template<typename T, typename Map_t>
void G4VTHitsMap< T, Map_t >::PrintAllHits ( )
overridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 482 of file G4THitsMap.hh.

483{
484 G4cout << "G4THitsMap " << SDname << " / " << collectionName << " --- " << entries() << " entries"
485 << G4endl;
486 /*----- commented out for the use-case where <T> cannot be initialized
487 to be zero or does not support += operator.
488 Map_t * theHitsMap = GetMap();
489 typename Map_t::iterator itr = theHitsMap->begin();
490 T sum = 0.;
491 for(; itr != theHitsMap->end(); ++itr) {
492 G4cout << " " << itr->first << " : "
493 << *(itr->second) << G4endl;
494 sum += *(itr->second);
495 }
496 G4cout << " Total : " << sum << G4endl;
497 ----------------------------------------------------------------------*/
498}
std::size_t entries() const

Referenced by G4THitsMap< G4double >::PrintAllHits().

◆ set() [1/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 336 of file G4THitsMap.hh.

337 {
339 T* hit = nullptr;
340 if (theHitsMap->find(key) != theHitsMap->end())
341 hit = theHitsMap->find(key)->second;
342 else
343 theHitsMap->insert(pair_t(key, hit = allocate()));
344 *hit = aHit;
345 return theHitsMap->size();
346 }

◆ set() [2/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 352 of file G4THitsMap.hh.

353 {
355 if (theHitsMap->find(key) != theHitsMap->end())
356 *theHitsMap->find(key)->second = aHit;
357 else
358 theHitsMap->insert(pair_t(key, new T(aHit)));
359 return theHitsMap->size();
360 }

◆ set() [3/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 366 of file G4THitsMap.hh.

367 {
369 T* hit = nullptr;
370 if (theHitsMap->find(key) == theHitsMap->end())
371 theHitsMap->insert(std::make_pair(key, hit = allocate()));
372 else
373 hit = theHitsMap->find(key)->second;
374 *hit += aHit;
375 return theHitsMap->size();
376 }

◆ set() [4/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 382 of file G4THitsMap.hh.

383 {
385 T* hit = allocate();
386 *hit += aHit;
387 if (theHitsMap->find(key) != theHitsMap->end())
388 *theHitsMap->find(key)->second = *hit;
389 else
390 theHitsMap->insert(pair_t(key, hit));
391 return theHitsMap->size();
392 }

◆ set() [5/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 270 of file G4THitsMap.hh.

271 {
273 if (theHitsMap->find(key) != theHitsMap->end()) delete theHitsMap->find(key)->second;
274 theHitsMap->find(key)->second = aHit;
275 return theHitsMap->size();
276 }

Referenced by G4THitsMap< G4double >::set().

◆ set() [6/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 282 of file G4THitsMap.hh.

283 {
285 if (theHitsMap->find(key) != theHitsMap->end())
286 theHitsMap->insert(pair_t(key, aHit));
287 else {
288 delete theHitsMap->find(key)->second;
289 theHitsMap->find(key)->second = aHit;
290 }
291 return theHitsMap->size();
292 }

◆ set() [7/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 298 of file G4THitsMap.hh.

299 {
301 T* hit = nullptr;
302 if (theHitsMap->find(key) == theHitsMap->end())
303 theHitsMap->insert(std::make_pair(key, hit = allocate()));
304 else
305 hit = theHitsMap->find(key)->second;
306 *hit += *aHit;
307 return theHitsMap->size();
308 }

◆ set() [8/8]

template<typename T, typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
std::size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 314 of file G4THitsMap.hh.

315 {
317 T* hit = allocate();
318 *hit += *aHit;
319 if (theHitsMap->find(key) != theHitsMap->end())
320 theHitsMap->insert(pair_t(key, hit));
321 else {
322 delete theHitsMap->find(key)->second;
323 theHitsMap->find(key)->second = hit;
324 }
325 return theHitsMap->size();
326 }

◆ size()

template<typename T, typename Map_t = std::map<G4int, T*>>
Map_t::size_type G4VTHitsMap< T, Map_t >::size ( )
inline

Definition at line 121 of file G4THitsMap.hh.

121{ return GetContainer()->size(); }

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