PandaRoot
PndSttTubeMap.h
Go to the documentation of this file.
1 /*
2  * PndSttTubeMap.h
3  *
4  * Created on: 02.08.2018
5  * Author: tstockmanns
6  */
7 
8 #ifndef DETECTORS_STT_PNDSTTTUBEMAP_H_
9 #define DETECTORS_STT_PNDSTTTUBEMAP_H_
10 
11 #include <TObject.h>
12 #include <map>
13 
14 class PndSttTube;
15 
16 class PndSttTubeMap : public TObject {
17  public:
18  static PndSttTubeMap *Instance();
19  virtual ~PndSttTubeMap();
20 
21  void AddTube(int tubeId, PndSttTube *tube) { fTubeMap[tubeId] = tube; }
22  PndSttTube *GetTube(int tubeId)
23  {
24  if (fTubeMap.count(tubeId) > 0)
25  return fTubeMap[tubeId];
26  else
27  return nullptr;
28  }
29  std::map<int, PndSttTube *> GetMap() { return fTubeMap; } // todo: change this to an iterator running through all fields of the map to hide the implementation
30  int GetMapSize() { return fTubeMap.size(); }
31 
32  private:
33  static PndSttTubeMap *fInstance;
34  std::map<int, PndSttTube *> fTubeMap;
35  PndSttTubeMap();
36 
37  ClassDef(PndSttTubeMap, 1);
38 };
39 
40 #endif /* DETECTORS_STT_PNDSTTTUBEMAP_H_ */
PndSttTube * GetTube(int tubeId)
Definition: PndSttTubeMap.h:22
virtual ~PndSttTubeMap()
std::map< int, PndSttTube * > GetMap()
Definition: PndSttTubeMap.h:29
static PndSttTubeMap * Instance()
void AddTube(int tubeId, PndSttTube *tube)
Definition: PndSttTubeMap.h:21