otsdaq  v2_05_02_indev
TableGroupKey.h
1 #ifndef _ots_TableGroupKey_h_
2 #define _ots_TableGroupKey_h_
3 
4 #include <ostream>
5 
6 namespace ots
7 {
8 // TableGroupKey is the type used for versions association with global configurations
9 //(whereas TableVersion is the type used for version associated with a configuration
10 // table)
12 {
13  public:
14  explicit TableGroupKey(unsigned int key = INVALID);
15  explicit TableGroupKey(char* const& groupString);
16  explicit TableGroupKey(const std::string& groupString);
17  virtual ~TableGroupKey(void);
18 
19  unsigned int key(void) const;
20  bool isInvalid(void) const;
21  std::string toString(void) const;
22 
23  // Operators
24  TableGroupKey& operator=(const unsigned int key);
25  bool operator==(unsigned int key) const;
26  bool operator==(const TableGroupKey& key) const;
27  bool operator!=(unsigned int key) const;
28  bool operator!=(const TableGroupKey& key) const;
29  bool operator<(const TableGroupKey& key) const;
30  bool operator>(const TableGroupKey& key) const;
31 
32  friend std::ostream& operator<<(std::ostream& out, const TableGroupKey& key)
33  {
34  out << key.toString();
35  return out;
36  }
37 
38  static TableGroupKey getNextKey(const TableGroupKey& key = TableGroupKey());
39  static std::string getFullGroupString(const std::string& groupName, const TableGroupKey& key);
40  static void getGroupNameAndKey(const std::string& fullGroupString, std::string& groupName, TableGroupKey& key);
41  static unsigned int getDefaultKey(void);
42  static unsigned int getInvalidKey(void);
43 
44  private:
45  static const unsigned int INVALID;
46  static const unsigned int DEFAULT;
47  unsigned int key_;
48 };
49 } // namespace ots
50 #endif