49 #ifndef G4TAtomicHitsMap_h
50 #define G4TAtomicHitsMap_h 1
52 #include "G4THitsCollection.hh"
60 #include <type_traits>
77 "G4TAtomicHitsMap must use fundamental type");
83 typedef typename container_type::iterator
iterator;
110 {
return theCollection; }
122 return theCollection->size();
131 return theCollection->size();
154 template <
typename T>
160 template <
typename T>
168 template <
typename T>
171 for(
auto itr = theCollection->begin(); itr != theCollection->end(); itr++)
174 delete theCollection;
178 template <
typename T>
184 template <
typename T>
188 for(
auto itr = rhs.
GetMap()->begin(); itr != rhs.
GetMap()->end(); itr++)
189 add(itr->first, *(itr->second));
194 template <
typename T>
198 for(
auto itr = rhs.
GetMap()->begin(); itr != rhs.
GetMap()->end(); itr++)
199 add(itr->first, *(itr->second));
204 template <
typename T>
208 if(theCollection->find(key) != theCollection->end())
209 return theCollection->find(key)->second;
213 if(theCollection->find(key) == theCollection->end())
216 (*theCollection)[key] = ptr;
219 return theCollection->find(key)->second;
223 template <
typename T>
227 if(theCollection->find(key) != theCollection->end())
228 *(*theCollection)[key] += *aHit;
232 (*theCollection)[key] = aHit;
235 return theCollection->size();
238 template <
typename T>
243 if(theCollection->find(key) != theCollection->end())
244 *(*theCollection)[key] += aHit;
250 (*theCollection)[key] = hit;
253 return theCollection->size();
256 template <
typename T>
260 if(theCollection->find(key) != theCollection->end())
261 delete (*theCollection)[key]->second;
263 (*theCollection)[key] = aHit;
265 return theCollection->size();
268 template <
typename T>
272 if(theCollection->find(key) != theCollection->end())
273 *(*theCollection)[key] = aHit;
278 (*theCollection)[key] = hit;
281 return theCollection->size();
284 template <
typename T>
288 template <
typename T>
291 G4cout <<
"G4TAtomicHitsMap " << SDname <<
" / " << collectionName <<
" --- "
292 << entries() <<
" entries" <<
G4endl;
295 template <
typename T>
300 for(
auto itr = theCollection->begin(); itr != theCollection->end(); itr++)
303 theCollection->clear();
const_iterator cend() const
G4int add(const G4int &key, value_type *&aHit) const
virtual void DrawAllHits()
const_iterator cbegin() const
const_iterator end() const
virtual void PrintAllHits()
G4TAtomicHitsMap< T > & operator+=(const G4TAtomicHitsMap< T > &right) const
#define G4MUTEX_INITIALIZER
value_type * operator[](G4int key) const
G4int operator==(const G4TAtomicHitsMap< T > &right) const
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value
container_type::const_iterator const_iterator
G4int set(const G4int &key, value_type *&aHit) const
container_type::iterator iterator
const_iterator find(G4int p) const
const_iterator begin() const
container_type * GetMap() const
std::map< G4int, mapped_type > container_type
std::map< G4int, T * > * GetMap() const
virtual ~G4TAtomicHitsMap()
virtual G4VHit * GetHit(size_t) const
Definition of the G4atomic class.
virtual size_t GetSize() const
#define G4MUTEXDESTROY(mutex)