StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMessTypeList.h
1 
9 #ifndef ClassStMessTypeList
10 #define ClassStMessTypeList
11 
12 #include <stdlib.h>
13 #include <vector>
14 #if !defined(ST_NO_NAMESPACES)
15 using std::vector;
16 #endif
17 
18 #ifdef ST_NO_TEMPLATE_DEF_ARGS
19 // Syntax currently required by Solaris compiler
20 #define StVector(T) vector<T, allocator<T> >
21 typedef vector<int, allocator<int> > intVector;
22 #else
23 #define StVector(T) vector<T>
24 typedef vector<int> intVector;
25 #endif
26 
28 private:
29  const char* type;
30  const char* text;
31 public:
32  StMessTypePair(const char* ty, const char* te);
33  virtual ~StMessTypePair();
34  const char* Type() const {return type;}
35  const char* Text() const {return text;}
36 };
37 
38 typedef StVector(StMessTypePair*) StMessTypeVec;
39 typedef StVector(StMessTypePair*)::iterator StMessTypeVecIter;
40 
41 
43  private:
44  static StMessTypeList* mInstance;
45 
46  protected:
47  StMessTypeVec messList;
48  StMessTypeList();
49  StMessTypeList(const StMessTypeList&);
50 
51  public:
52  virtual ~StMessTypeList();
53  static StMessTypeList* Instance();
54  int AddType(const char* type, const char* text);
55  int FindTypeNum(const char* type);
56  StMessTypePair* FindType(const char* type);
57  const char* FindNumType(size_t typeNum);
58  const char* FindNumText(size_t typeNum);
59  const char* Text(const char* type) {
60  StMessTypePair* temp = FindType(type);
61  return ( (temp) ? temp->Text() : 0 );
62  }
63  int ListTypes();
64 };
65 
66 #endif
67 
68 // $Id: StMessTypeList.h,v 1.10 2015/07/20 18:34:31 genevb Exp $
69 // $Log: StMessTypeList.h,v $
70 // Revision 1.10 2015/07/20 18:34:31 genevb
71 // Include stdlib to get size_t
72 //
73 // Revision 1.9 2003/09/25 21:19:22 genevb
74 // Some new cout-like functions and friend functions, some doxygen-ization
75 //
76 // Revision 1.8 2000/01/26 19:04:48 genevb
77 // Adjust use of namespaces
78 //
79 // Revision 1.7 1999/12/28 21:29:55 porter
80 // added 'using std::vector' and a (char*) cast to allow compilation
81 // using solaris CC5. Many warnings of const char* vs char* still
82 // exist but will await Gene's return to fix these
83 //
84 // Revision 1.6 1999/09/14 15:42:03 genevb
85 // Some bug fixes, workaround for nulls in strings
86 //
87 // Revision 1.5 1999/09/10 21:05:55 genevb
88 // Some workarounds for RedHat6.0
89 //
90 // Revision 1.4 1999/06/30 17:24:49 genevb
91 // Better limit management, remove Bool_t
92 //
93 // Revision 1.3 1999/06/29 17:37:30 genevb
94 // Lots of fixes...
95 //
96 // Revision 1.2 1999/06/26 00:24:52 genevb
97 // Fixed const type mismatches
98 //
99 // Revision 1.1 1999/06/23 15:17:45 genevb
100 // Introduction of StMessageManager
101 //
102 // Revision 1.0 1999/01/27 10:28:29 genevb
103 //