Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CMFlashDifferenceContainerv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CMFlashDifferenceContainerv1.cc
1 
8 #include "CMFlashDifference.h"
9 #include "CMFlashDifferencev1.h"
10 
11 #include <cstdlib>
12 
14 {
15  while (m_map.begin() != m_map.end())
16  {
17  delete m_map.begin()->second;
18  m_map.erase(m_map.begin());
19  }
20  return;
21 }
22 
23 void CMFlashDifferenceContainerv1::identify(std::ostream& os) const
24 {
25  os << "-----CMFlashDifferenceContainerv1-----" << std::endl;
26  ConstIterator iter;
27  os << "Number of differences: " << size() << std::endl;
28  for (iter = m_map.begin(); iter != m_map.end(); ++iter)
29  {
30  os << "key " << iter->first << std::endl;
31  (iter->second)->identify();
32  }
33  os << "------------------------------" << std::endl;
34  return;
35 }
36 
37 void
39 {
40  auto ret = m_map.insert(std::make_pair(key, newclus));
41  if ( !ret.second )
42  {
43  std::cout << "CMFlashDifferenceContainerv1::AddDifferenceSpecifyKey: duplicate key: " << key << " exiting now" << std::endl;
44  exit(1);
45  }
46 }
47 
49 {
50  auto diff = findDifference(key);
51  delete diff;
52  m_map.erase(key);
53 }
54 
57 { return std::make_pair(m_map.cbegin(), m_map.cend()); }
58 
61 {
62  auto it = m_map.find(key);
63  return it == m_map.end() ? nullptr:it->second;
64 }
65 
67 {
68  return m_map.size();
69 }