00001 #ifndef ASI_MESSAGE_H 00002 #define ASI_MESSAGE_H 00003 00004 #include <memory> 00005 #include <string> 00006 #include <vector> 00007 #include "Timestamp.h" 00008 #include "FaultState.h" 00009 00010 namespace acsalarm 00011 { 00012 /* 00013 * The class which encapsulates the data for one or more fault states (FaultState) 00014 * to be sent to the laser alarm server. 00015 */ 00016 class ASIMessage 00017 { 00018 public: 00019 ASIMessage(); 00020 ASIMessage(std::auto_ptr<std::vector<acsalarm::FaultState> > & faults); 00021 virtual ~ASIMessage(); 00022 00023 std::vector<acsalarm::FaultState> & getFaultStates() { return *faultStates; } 00024 void setFaultStates(std::auto_ptr<std::vector<acsalarm::FaultState> > & faults) { faultStates = faults; } 00025 00026 bool getBackup() { return backup; } 00027 void setBackup(bool bkup) { backup = bkup; } 00028 00029 std::string getVersion() { return version; } 00030 void setVersion(std::string ver) { version = ver; } 00031 00032 std::string getSourceName() { return sourceName; } 00033 void setSourceName(std::string name) { sourceName = name; } 00034 00035 std::string getSourceHostname() { return sourceHostname; } 00036 void setSourceHostname(std::string name) { sourceHostname = name; } 00037 00038 acsalarm::Timestamp & getSourceTimestamp() { return *sourceTimestamp; } 00039 void setSourceTimestamp(std::auto_ptr<acsalarm::Timestamp> ts) { sourceTimestamp = ts; } 00040 00041 // builds the xml representation of the message which will be sent to the alarm server 00042 std::string toXML(); 00043 00044 private: 00045 std::auto_ptr<std::vector<acsalarm::FaultState> > faultStates; 00046 bool backup; 00047 std::string version; 00048 std::string sourceName; 00049 std::string sourceHostname; 00050 std::auto_ptr<acsalarm::Timestamp> sourceTimestamp; 00051 }; 00052 }; 00053 #endif