Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlobalVertexMapv1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GlobalVertexMapv1.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4VERTEX_GLOBALVERTEXMAPV1_H
4 #define G4VERTEX_GLOBALVERTEXMAPV1_H
5 
6 #include "GlobalVertexMap.h"
7 
8 #include "GlobalVertex.h"
9 
10 #include <cstddef> // for size_t
11 #include <iostream>
12 #include <map>
13 
15 {
16  public:
17  GlobalVertexMapv1() = default;
18  ~GlobalVertexMapv1() override;
19 
20  void identify(std::ostream& os = std::cout) const override;
21  void Reset() override { clear(); }
22  int isValid() const override { return 1; }
23 
24  bool empty() const override { return _map.empty(); }
25  size_t size() const override { return _map.size(); }
26  size_t count(unsigned int idkey) const override { return _map.count(idkey); }
27 // cppcheck-suppress virtualCallInConstructor
28  void clear() override;
29 
30  const GlobalVertex* get(unsigned int idkey) const override;
31  GlobalVertex* get(unsigned int idkey) override;
33  size_t erase(unsigned int idkey) override
34  {
35  delete _map[idkey];
36  return _map.erase(idkey);
37  }
38 
39  ConstIter begin() const override { return _map.begin(); }
40  ConstIter find(unsigned int idkey) const override { return _map.find(idkey); }
41  ConstIter end() const override { return _map.end(); }
42 
43  Iter begin() override { return _map.begin(); }
44  Iter find(unsigned int idkey) override { return _map.find(idkey); }
45  Iter end() override { return _map.end(); }
46 
47  private:
48  std::map<unsigned int, GlobalVertex*> _map;
49 
51 };
52 
53 #endif // G4VERTEX_GLOBALVERTEXMAPv1_H