FairRoot/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  if (fTubeMap.count(tubeId) > 0)
24  return fTubeMap[tubeId];
25  else return nullptr;
26  }
27  std::map<int, PndSttTube*> GetMap(){return fTubeMap;} //todo: change this to an iterator running through all fields of the map to hide the implementation
28  int GetMapSize() { return fTubeMap.size(); }
29 private:
31  std::map<int, PndSttTube*> fTubeMap;
32  PndSttTubeMap();
33 
35 };
36 
37 #endif /* DETECTORS_STT_PNDSTTTUBEMAP_H_ */
std::map< int, PndSttTube * > GetMap()
Definition: PndSttTubeMap.h:27
PndSttTube * GetTube(int tubeId)
Definition: PndSttTubeMap.h:22
static PndSttTubeMap * Instance()
static PndSttTubeMap * fInstance
Definition: PndSttTubeMap.h:30
ClassDef(PndSttTubeMap, 1)
virtual ~PndSttTubeMap()
std::map< int, PndSttTube * > fTubeMap
Definition: PndSttTubeMap.h:31
void AddTube(int tubeId, PndSttTube *tube)
Definition: PndSttTubeMap.h:21