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