CARMA C++
MonitorCondition.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_MONITORCONDITION_H
2 #define SZA_UTIL_MONITORCONDITION_H
3 
11 #include "carma/szautil/DataType.h"
13 
14 namespace sza {
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(sza::util::DataTypeTruthFn fn,
76  bool delta = false,
77  unsigned packetCount = defaultPacketCount_,
78  unsigned stablePacketCount = defaultStablePacketCount_,
79  unsigned giveUpPacketCount = defaultGiveUpPacketCount_);
80 
81  void setTo(sza::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(sza::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  sza::util::DataType op1_;
122  sza::util::DataType op2_;
123 
124  bool isDeltaCondition_;
125  bool first_;
126  sza::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 sza
140 
141 
142 
143 #endif // End #ifndef SZA_UTIL_MONITORCONDITION_H
A class for managing operations on DataType objects which return booleans.
Tagged: Tue Jun 22 22:32:16 UTC 2004.
void checkPacketCount(unsigned packetCount, unsigned stablePacketCount, unsigned giveUpPacketCount)
Check the packet count to see if it makes sense.
virtual ~MonitorCondition()
Destructor.
std::string format(std::string &reg)
Format this condition.
MonitorCondition(unsigned packetCount=defaultPacketCount_, unsigned stablePacketCount=defaultStablePacketCount_, unsigned giveUpPacketCount=defaultGiveUpPacketCount_)
Constructor for no condition.
Tagged: Mon Oct 25 18:41:34 PDT 2004.
A class for handling a condition for a monitor point.
Enumerate data types.
Definition: DataType.h:28