]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: global | |
3 | // | |
79401af9 | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class TG4NameMap | |
7 | // ---------------- | |
2817d3e2 | 8 | // The map container for associated names. |
9 | // The names can be added into map either in pairs (Add() method) | |
10 | // or standalone - then they are paired with the fSecond data member | |
11 | // (AddName() method) | |
12 | ||
13 | #ifndef TG4_NAME_MAP_H | |
14 | #define TG4_NAME_MAP_H | |
15 | ||
63c8351a | 16 | #include <g4std/map> |
17 | #include <globals.hh> | |
2817d3e2 | 18 | |
19 | class TG4NameMap | |
20 | { | |
79401af9 | 21 | typedef G4std::map<G4String, G4String, G4std::less<G4String> > Map; |
22 | typedef Map::iterator MapIterator; | |
23 | typedef Map::const_iterator MapConstIterator; | |
24 | ||
2817d3e2 | 25 | public: |
26 | TG4NameMap(); | |
27 | // --> protected | |
28 | // TG4NameMap(const TG4NameMap& right); | |
29 | virtual ~TG4NameMap(); | |
30 | ||
31 | // methods | |
32 | G4bool Add(const G4String& first, const G4String& second); | |
33 | G4bool AddName(const G4String& name); | |
34 | const G4String& GetSecond(const G4String& name); | |
79401af9 | 35 | void PrintAll() const; |
2817d3e2 | 36 | void Clear(); |
37 | ||
38 | // set methods | |
39 | void SetSecond(const G4String& name); | |
40 | ||
41 | protected: | |
42 | TG4NameMap(const TG4NameMap& right); | |
43 | ||
44 | // operators | |
45 | TG4NameMap& operator=(const TG4NameMap& right); | |
46 | ||
47 | private: | |
48 | // static data members | |
49 | static G4String fgUndefined; //the value of undefined second | |
50 | ||
51 | // data members | |
79401af9 | 52 | Map fMap; //map container |
53 | G4String fSecond; //the current second | |
2817d3e2 | 54 | }; |
55 | ||
56 | // inline methods | |
57 | inline void TG4NameMap::SetSecond(const G4String& secondName) | |
58 | { fSecond = secondName; } | |
59 | ||
60 | #endif //TG4_NAME_MAP_H |