My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
MonitorCondition.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_MONITORCONDITION_H
2 #define GCP_UTIL_MONITORCONDITION_H
3 
11 #include "gcp/util/common/DataType.h"
12 #include "gcp/util/common/DataTypeTruthFn.h"
13 
14 namespace gcp {
15  namespace util {
16 
21  public:
22 
26  MonitorCondition(unsigned packetCount = defaultPacketCount_,
27  unsigned stablePacketCount = defaultStablePacketCount_,
28  unsigned giveUpPacketCount = defaultGiveUpPacketCount_);
29 
51  bool delta = false,
52  unsigned packetCount = defaultPacketCount_,
53  unsigned stablePacketCount = defaultStablePacketCount_,
54  unsigned giveUpPacketCount = defaultGiveUpPacketCount_);
55 
62  bool delta = false,
63  unsigned packetCount = defaultPacketCount_,
64  unsigned stablePacketCount = defaultStablePacketCount_,
65  unsigned giveUpPacketCount = defaultGiveUpPacketCount_);
66 
67 
68  // Equivalent setTo() methods to the constructor versions
69 
70  void setTo(unsigned packetCount = defaultPacketCount_,
71  unsigned stablePacketCount = defaultStablePacketCount_,
72  unsigned giveUpPacketCount = defaultGiveUpPacketCount_);
73 
74  void setTo(gcp::util::DataTypeTruthFn fn,
76  bool delta = false,
77  unsigned packetCount = defaultPacketCount_,
78  unsigned stablePacketCount = defaultStablePacketCount_,
79  unsigned giveUpPacketCount = defaultGiveUpPacketCount_);
80 
81  void setTo(gcp::util::DataTypeTruthFn fn,
84  bool delta = false,
85  unsigned packetCount = defaultPacketCount_,
86  unsigned stablePacketCount = defaultStablePacketCount_,
87  unsigned giveUpPacketCount = defaultGiveUpPacketCount_);
88 
89  void operator=(const MonitorCondition& condition);
90 
94  std::string format(std::string& reg);
95 
99  virtual ~MonitorCondition();
100 
101  // Return true if the condition is satisfied by the passed value
102 
103  bool isSatisfiedBy(gcp::util::DataType& dataType);
104 
108  void checkPacketCount(unsigned packetCount, unsigned stablePacketCount,
109  unsigned giveUpPacketCount);
110 
111  // Public query functions
112 
113  bool isDelta() {return isDeltaCondition_;}
114  unsigned nFrame() {return stablePacketCount_;}
115  double min() {return op1_.getValAsDouble();}
116  double max() {return op2_.getValAsDouble();}
117 
118  // Members
119 
121  gcp::util::DataType op1_;
122  gcp::util::DataType op2_;
123 
124  bool isDeltaCondition_;
125  bool first_;
126  gcp::util::DataType last_;
127 
128  unsigned packetCount_;
129  unsigned stablePacketCount_;
130  unsigned giveUpPacketCount_;
131 
132  static const unsigned defaultPacketCount_ = 1;
133  static const unsigned defaultStablePacketCount_ = 0;
134  static const unsigned defaultGiveUpPacketCount_ = 20;
135 
136  }; // End class MonitorCondition
137 
138  } // End namespace util
139 } // End namespace gcp
140 
141 
142 
143 #endif // End #ifndef GCP_UTIL_MONITORCONDITION_H
virtual ~MonitorCondition()
Definition: MonitorCondition.cc:138
void checkPacketCount(unsigned packetCount, unsigned stablePacketCount, unsigned giveUpPacketCount)
Definition: MonitorCondition.cc:191
MonitorCondition(unsigned packetCount=defaultPacketCount_, unsigned stablePacketCount=defaultStablePacketCount_, unsigned giveUpPacketCount=defaultGiveUpPacketCount_)
Definition: MonitorCondition.cc:12
Definition: DataTypeTruthFn.h:24
Definition: MonitorCondition.h:20
bool isSatisfiedBy(gcp::util::DataType &dataType)
Definition: MonitorCondition.cc:143
Definition: DataType.h:27
std::string format(std::string &reg)
Definition: MonitorCondition.cc:199