CARMA C++
ThresholdHandler.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_MONITOR_THRESHOLDHANDLER_H
11 #define CARMA_MONITOR_THRESHOLDHANDLER_H
12 
13 #include <xercesc/sax/HandlerBase.hpp>
14 #include <vector>
15 
16 XERCES_CPP_NAMESPACE_USE
17 
18 
19 namespace carma {
20  namespace monitor {
21 
22  class MonitorSystemWithThreshold; // forward declaration
23 
31  class ThresholdHandler : public HandlerBase {
32  public:
33 
34  // structure for holding information about subsystem and container elements
35  typedef struct {
36  char *name;
37  char *count;
38  } ElementInfoStruct;
39 
40  // structure for holding monitor point information
41  typedef struct {
42  char *name;
43  char *count;
44  char *type;
45  } PointInfoStruct;
46 
52  virtual ~ThresholdHandler();
53 
54  // SAX DocumentHandler methods
60  void characters(const XMLCh *const chars, const unsigned int length);
61 
67  void startElement(const XMLCh *const name, AttributeList &attributes);
73  void endElement(const XMLCh *const name);
74 
86  void setThresholds(const ElementInfoStruct &subsystemInfo,
87  const std::vector<ElementInfoStruct> &containerInfo,
88  const PointInfoStruct &mpInfo,
89  const char *thresholdName,
90  const char *value);
91 
99  void setThreshold(const char *canonicalName,
100  const char *mpType,
101  const char *thresholdName,
102  const char *value);
103 
104  // processing methods
109  void processSubsystem(AttributeList &attributes);
114  void processContainer(AttributeList &attributes);
119  void processPoint(AttributeList &attributes);
120 
124  void warning(const SAXParseException &ex);
130  void error(const SAXParseException &ex);
135  void fatalError(const SAXParseException &ex);
136 
137  private:
138  ElementInfoStruct subsystemInfo_; // subsystem information
139  std::vector<ElementInfoStruct> containerInfo_; // names of containers being parsed
140  PointInfoStruct pointInfo_; // monitor point info (name, count, data type)
141  carma::monitor::MonitorSystemWithThreshold *system_; // allows threshold modification in system
142  }; // end class ThresholdHandler
143  } // end namespace dbms
144 } // end namespace carma
145 
146 #endif
void setThreshold(const char *canonicalName, const char *mpType, const char *thresholdName, const char *value)
method for setting a threshold
void processContainer(AttributeList &attributes)
process the &lt;Container&gt; and &lt;Device&gt; elements
void warning(const SAXParseException &ex)
SAX ErrorHandler method for notification of a warning.
MonitorSystemWithThreshold is a class that contains methods for retrieving and setting threshold valu...
void processSubsystem(AttributeList &attributes)
process the &lt;Subsystem&gt; element
ThresholdHandler(carma::monitor::MonitorSystemWithThreshold *system)
constructor
void error(const SAXParseException &ex)
SAX ErrorHandler method for notification of a recoverable parser error.
void characters(const XMLCh *const chars, const unsigned int length)
parse data between &lt;element&gt; and &lt;/element&gt; tags
void setThresholds(const ElementInfoStruct &subsystemInfo, const std::vector< ElementInfoStruct > &containerInfo, const PointInfoStruct &mpInfo, const char *thresholdName, const char *value)
method for setting thresholds (setThreshold actually sets thresholds; this method expands all the nam...
void endElement(const XMLCh *const name)
parses end tag.
ThresholdHandler contains methods to deal with setting thresholds via mpml file.
void fatalError(const SAXParseException &ex)
SAX ErrorHandler method for reporting fatal errors.
void processPoint(AttributeList &attributes)
process the &lt;MonitorPoint&gt;, &lt;ControlPoint&gt;, &lt;SoftPoint&gt; elements
void startElement(const XMLCh *const name, AttributeList &attributes)
parse start tag, including attributes