ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BbcVertexMapv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BbcVertexMapv1.cc
1 #include "BbcVertexMapv1.h"
2 
3 #include "BbcVertex.h"
4 #include "BbcVertexMap.h"
5 
6 #include <iterator> // for reverse_iterator
7 #include <utility> // for pair, make_pair
8 
9 using namespace std;
10 
12  : _map()
13 {
14 }
15 
17 {
18  clear();
19 }
20 
21 void BbcVertexMapv1::identify(ostream& os) const
22 {
23  os << "BbcVertexMapv1: size = " << _map.size() << endl;
24  return;
25 }
26 
28 {
29  for (Iter iter = _map.begin();
30  iter != _map.end();
31  ++iter)
32  {
33  delete iter->second;
34  }
35  _map.clear();
36  return;
37 }
38 
39 const BbcVertex* BbcVertexMapv1::get(unsigned int id) const
40 {
41  ConstIter iter = _map.find(id);
42  if (iter == _map.end()) return NULL;
43  return iter->second;
44 }
45 
46 BbcVertex* BbcVertexMapv1::get(unsigned int id)
47 {
48  Iter iter = _map.find(id);
49  if (iter == _map.end()) return NULL;
50  return iter->second;
51 }
52 
54 {
55  unsigned int index = 0;
56  if (!_map.empty()) index = _map.rbegin()->first + 1;
57  _map.insert(make_pair(index, clus));
58  _map[index]->set_id(index);
59  return _map[index];
60 }