#ifndef __AlertBase_h_ #define __AlertBase_h_ #include "../misc_framework/GenericDataNodes.h" // All alert definitions must inherit from AlertBase. class Alert : public GenericDataNode { private: double _quality; std::string _msg, _altMsg; int _count; bool _qualityValid; public: void getQuality(bool &valid, double &quality) const { valid = _qualityValid; quality = _quality; } std::string const &getMsg() const { return _msg; } std::string const &getAltMsg() const { return _altMsg; } int getCount() const { return _count; } static std::string durationString(time_t fromTime, time_t toTime); static std::string formatPrice(double price, bool alwaysShowSign = false); void getInteger(bool &valid, Integer &value) const; void getDouble(bool &valid, double &value) const; void getString(bool &valid, std::string &value) const; protected: Alert(); static std::string BLANK; // Quality defaults to not valid. void report(std::string const &msg, std::string const &altMsg=BLANK); void report(std::string const &msg, double quality) { report(msg, BLANK, quality); } void report(std::string const &msg, std::string const &altMsg, double quality); public: // This is used by numerous alerts. We start with scaler data, then convert // it to an alert when two values cross each other. enum AboveOrBelow { ccEqual, ccAbove, ccBelow }; }; #endif