Geant4 11.2.2
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 (G4String detName, 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
 
size_t entries () const
 
void clear ()
 
G4VHitGetHit (size_t) const override
 
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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 (G4String detName, G4String colNam)
 
- Public Member Functions inherited from G4VHitsCollection
 G4VHitsCollection ()=default
 
 G4VHitsCollection (G4String detName, 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 49 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 85 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 84 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 83 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 81 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 82 of file G4THitsMap.hh.

Constructor & Destructor Documentation

◆ G4VTHitsMap() [1/2]

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

Definition at line 448 of file G4THitsMap.hh.

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

◆ G4VTHitsMap() [2/2]

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

Definition at line 456 of file G4THitsMap.hh.

457 : G4HitsCollection(detName, colNam)
458{
459 theCollection = (void*)new Map_t;
460}

◆ ~G4VTHitsMap()

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

Definition at line 465 of file G4THitsMap.hh.

466{
467 map_type* theHitsMap = GetMap();
468 for (auto itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
469 delete itr->second;
470 delete theHitsMap;
471}
Map_t * GetMap() const
Map_t map_type
Definition G4THitsMap.hh:83

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>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 218 of file G4THitsMap.hh.

219 {
220 map_type* theHitsMap = GetMap();
221 if (theHitsMap->find(key) == theHitsMap->end())
222 theHitsMap->insert(pair_t(key, new T(aHit)));
223 else
224 *theHitsMap->find(key)->second += aHit;
225 return theHitsMap->size();
226 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 233 of file G4THitsMap.hh.

234 {
235 map_type* theHitsMap = GetMap();
236 if (theHitsMap->find(key) == theHitsMap->end()) theHitsMap->insert(pair_t(key, allocate()));
237 *theHitsMap->find(key)->second += aHit;
238 return theHitsMap->size();
239 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 245 of file G4THitsMap.hh.

246 {
247 map_type* theHitsMap = GetMap();
248 theHitsMap->insert(pair_t(key, new T(aHit)));
249 return theHitsMap->size();
250 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 257 of file G4THitsMap.hh.

258 {
259 map_type* theHitsMap = GetMap();
260 T* hit = allocate();
261 *hit += aHit;
262 theHitsMap->insert(pair_t(key, hit));
263 return theHitsMap->size();
264 }

◆ add() [5/7]

◆ 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>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U *& aHit ) const
inline

Definition at line 188 of file G4THitsMap.hh.

189 {
190 map_type* theHitsMap = GetMap();
191 theHitsMap->insert(pair_t(key, aHit));
192 return theHitsMap->size();
193 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int & key,
U *& aHit ) const
inline

Definition at line 200 of file G4THitsMap.hh.

201 {
202 map_type* theHitsMap = GetMap();
203 T* hit = allocate();
204 *hit += *aHit;
205 theHitsMap->insert(pair_t(key, hit));
206 return theHitsMap->size();
207 }

◆ 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

◆ 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(); }

◆ 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(); }

◆ clear()

◆ DrawAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 484 of file G4THitsMap.hh.

485{
486 ;
487}

◆ 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(); }

◆ 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()

◆ GetContainer()

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

◆ GetHit()

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

Reimplemented from G4VHitsCollection.

Definition at line 160 of file G4THitsMap.hh.

160{ return nullptr; }

◆ 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()

◆ 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*>>
size_t G4VTHitsMap< T, Map_t >::GetSize ( ) const
inlineoverridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 161 of file G4THitsMap.hh.

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

◆ 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 102 of file G4THitsMap.hh.

103 {
104 MapU_t* aHitsMap = right.GetMap();
105 for (auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
106 add<U, map_type>(itr->first, *(itr->second));
107 return (this_type&)(*this);
108 }
G4VTHitsMap< T, Map_t > this_type
Definition G4THitsMap.hh:81
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 476 of file G4THitsMap.hh.

477{
478 return (collectionName == right.collectionName);
479}

◆ 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 410 of file G4THitsMap.hh.

411 {
412 map_type* theHitsMap = GetMap();
413 if (theHitsMap->find(key) != theHitsMap->end()) return theHitsMap->find(key)->second;
414 return nullptr;
415 }

◆ 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 418 of file G4THitsMap.hh.

419 {
420#ifdef G4VERBOSE
421 static bool _first = true;
422 if (_first) {
423 _first = false;
424 G4Exception("G4THitsMap operator[]", "calling [] on multimap", JustWarning,
425 "Returning the last matching entry");
426 }
427#endif
428 map_type* theHitsMap = GetMap();
429 iterator itr = theHitsMap->find(key);
430 if (itr != theHitsMap->end()) {
431 std::advance(itr, theHitsMap->count(key) - 1);
432 return itr->second;
433 }
434 return nullptr;
435 }
@ JustWarning
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 492 of file G4THitsMap.hh.

493{
494 G4cout << "G4THitsMap " << SDname << " / " << collectionName << " --- " << entries() << " entries"
495 << G4endl;
496 /*----- commented out for the use-case where <T> cannot be initialized
497 to be zero or does not support += operator.
498 Map_t * theHitsMap = GetMap();
499 typename Map_t::iterator itr = theHitsMap->begin();
500 T sum = 0.;
501 for(; itr != theHitsMap->end(); ++itr) {
502 G4cout << " " << itr->first << " : "
503 << *(itr->second) << G4endl;
504 sum += *(itr->second);
505 }
506 G4cout << " Total : " << sum << G4endl;
507 ----------------------------------------------------------------------*/
508}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
size_t entries() const

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 344 of file G4THitsMap.hh.

345 {
346 map_type* theHitsMap = GetMap();
347 T* hit = nullptr;
348 if (theHitsMap->find(key) != theHitsMap->end())
349 hit = theHitsMap->find(key)->second;
350 else
351 theHitsMap->insert(pair_t(key, hit = allocate()));
352 *hit = aHit;
353 return theHitsMap->size();
354 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 360 of file G4THitsMap.hh.

361 {
362 map_type* theHitsMap = GetMap();
363 if (theHitsMap->find(key) != theHitsMap->end())
364 *theHitsMap->find(key)->second = aHit;
365 else
366 theHitsMap->insert(pair_t(key, new T(aHit)));
367 return theHitsMap->size();
368 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 374 of file G4THitsMap.hh.

375 {
376 map_type* theHitsMap = GetMap();
377 T* hit = nullptr;
378 if (theHitsMap->find(key) == theHitsMap->end())
379 theHitsMap->insert(std::make_pair(key, hit = allocate()));
380 else
381 hit = theHitsMap->find(key)->second;
382 *hit += aHit;
383 return theHitsMap->size();
384 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 390 of file G4THitsMap.hh.

391 {
392 map_type* theHitsMap = GetMap();
393 T* hit = allocate();
394 *hit += aHit;
395 if (theHitsMap->find(key) != theHitsMap->end())
396 *theHitsMap->find(key)->second = *hit;
397 else
398 theHitsMap->insert(pair_t(key, hit));
399 return theHitsMap->size();
400 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 276 of file G4THitsMap.hh.

277 {
278 map_type* theHitsMap = GetMap();
279 if (theHitsMap->find(key) != theHitsMap->end()) delete theHitsMap->find(key)->second;
280 theHitsMap->find(key)->second = aHit;
281 return theHitsMap->size();
282 }

Referenced by G4PSMinKinEAtGeneration::ProcessHits().

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 288 of file G4THitsMap.hh.

289 {
290 map_type* theHitsMap = GetMap();
291 if (theHitsMap->find(key) != theHitsMap->end())
292 theHitsMap->insert(pair_t(key, aHit));
293 else {
294 delete theHitsMap->find(key)->second;
295 theHitsMap->find(key)->second = aHit;
296 }
297 return theHitsMap->size();
298 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 304 of file G4THitsMap.hh.

305 {
306 map_type* theHitsMap = GetMap();
307 T* hit = nullptr;
308 if (theHitsMap->find(key) == theHitsMap->end())
309 theHitsMap->insert(std::make_pair(key, hit = allocate()));
310 else
311 hit = theHitsMap->find(key)->second;
312 *hit += *aHit;
313 return theHitsMap->size();
314 }

◆ 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>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 320 of file G4THitsMap.hh.

321 {
322 map_type* theHitsMap = GetMap();
323 T* hit = allocate();
324 *hit += *aHit;
325 if (theHitsMap->find(key) != theHitsMap->end())
326 theHitsMap->insert(pair_t(key, hit));
327 else {
328 delete theHitsMap->find(key)->second;
329 theHitsMap->find(key)->second = hit;
330 }
331 return theHitsMap->size();
332 }

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