otsdaq  3.03.00
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  bool isValid(void) const { return !isInvalid(); };
22  std::string toString(void) const;
23  std::string str() const { return toString(); }
24 
26  TableGroupKey& operator=(const unsigned int key);
27  bool operator==(unsigned int key) const;
28  bool operator==(const TableGroupKey& key) const;
29  bool operator!=(unsigned int key) const;
30  bool operator!=(const TableGroupKey& key) const;
31  bool operator<(const TableGroupKey& key) const;
32  bool operator>(const TableGroupKey& key) const;
33  bool operator<=(const TableGroupKey& key) const { return !operator>(key); }
34  bool operator>=(const TableGroupKey& key) const { return !operator<(key); }
35  TableGroupKey& operator*=(
36  const unsigned int a);
37  TableGroupKey& operator*=(
38  const TableGroupKey a);
39  TableGroupKey& operator+=(
40  const TableGroupKey a);
41  TableGroupKey& operator-=(
42  const TableGroupKey a);
43  TableGroupKey& operator/=(
44  const TableGroupKey a);
45 
46  friend std::ostream& operator<<(std::ostream& out, const TableGroupKey& key)
47  {
48  out << key.toString();
49  return out;
50  }
51 
52  static TableGroupKey getNextKey(const TableGroupKey& key = TableGroupKey());
53  static std::string getFullGroupString(const std::string& groupName,
54  const TableGroupKey& key,
55  const std::string& preKey = "_v",
56  const std::string& postKey = "");
57  static void getGroupNameAndKey(const std::string& fullGroupString,
58  std::string& groupName,
59  TableGroupKey& key);
60  static unsigned int getDefaultKey(void);
61  static unsigned int getInvalidKey(void);
62 
63  static const unsigned int INVALID;
64 
65  private:
66  static const unsigned int DEFAULT;
67  unsigned int key_;
68 };
69 } // namespace ots
70 #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:23
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<