otsdaq  v2_04_01
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,
40  const TableGroupKey& key);
41  static void getGroupNameAndKey(const std::string& fullGroupString,
42  std::string& groupName,
43  TableGroupKey& key);
44  static const unsigned int getDefaultKey(void);
45  static const unsigned int getInvalidKey(void);
46 
47  private:
48  static const unsigned int INVALID;
49  static const unsigned int DEFAULT;
50  unsigned int key_;
51 };
52 } // namespace ots
53 #endif