tdaq-develop-2025-02-12
TableGroupKey.h
1 #ifndef _ots_TableGroupKey_h_
2 #define _ots_TableGroupKey_h_
3 
4 #include <ostream>
5 
6 namespace ots
7 {
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  std::string str() const { return toString(); }
23 
25  TableGroupKey& operator=(const unsigned int key);
26  bool operator==(unsigned int key) const;
27  bool operator==(const TableGroupKey& key) const;
28  bool operator!=(unsigned int key) const;
29  bool operator!=(const TableGroupKey& key) const;
30  bool operator<(const TableGroupKey& key) const;
31  bool operator>(const TableGroupKey& key) const;
32  bool operator<=(const TableGroupKey& key) const { return !operator>(key); }
33  bool operator>=(const TableGroupKey& key) const { return !operator<(key); }
34  TableGroupKey& operator*=(
35  const unsigned int a);
36  TableGroupKey& operator*=(
37  const TableGroupKey a);
38  TableGroupKey& operator+=(
39  const TableGroupKey a);
40  TableGroupKey& operator-=(
41  const TableGroupKey a);
42  TableGroupKey& operator/=(
43  const TableGroupKey a);
44 
45  friend std::ostream& operator<<(std::ostream& out, const TableGroupKey& key)
46  {
47  out << key.toString();
48  return out;
49  }
50 
51  static TableGroupKey getNextKey(const TableGroupKey& key = TableGroupKey());
52  static std::string getFullGroupString(const std::string& groupName,
53  const TableGroupKey& key,
54  const std::string& preKey = "_v",
55  const std::string& postKey = "");
56  static void getGroupNameAndKey(const std::string& fullGroupString,
57  std::string& groupName,
58  TableGroupKey& key);
59  static unsigned int getDefaultKey(void);
60  static unsigned int getInvalidKey(void);
61 
62  static const unsigned int INVALID;
63 
64  private:
65  static const unsigned int DEFAULT;
66  unsigned int key_;
67 };
68 } // namespace ots
69 #endif
std::string toString(void) const
toString
static TableGroupKey getNextKey(const TableGroupKey &key=TableGroupKey())
bool operator>(const TableGroupKey &key) const
operator>
bool operator==(unsigned int key) const
operator==
TableGroupKey & operator=(const unsigned int key)
Operators.
static void getGroupNameAndKey(const std::string &fullGroupString, std::string &groupName, TableGroupKey &key)
requires fullGroupString created as name + "_v" + key + ""
bool isInvalid(void) const
isInvalid
TableGroupKey & operator/=(const TableGroupKey a)
to support StringMacros on TableGroupKey types
TableGroupKey & operator-=(const TableGroupKey a)
to support StringMacros on TableGroupKey types
std::string str() const
alternative alias method
Definition: TableGroupKey.h:22
TableGroupKey & operator+=(const TableGroupKey a)
to support StringMacros on TableGroupKey types
TableGroupKey & operator*=(const unsigned int a)
to support StringMacros on TableGroupKey types
static std::string getFullGroupString(const std::string &groupName, const TableGroupKey &key, const std::string &preKey="_v", const std::string &postKey="")
bool operator<(const TableGroupKey &key) const
operator<