00001 #ifndef TIMESTAMP_H 00002 #define TIMESTAMP_H 00003 00004 #include "utilConstants.h" 00005 #include <string> 00006 00007 namespace acsalarm 00008 { 00009 /* 00010 * Utility class to hold a timestamp. This class is intended primarily for use 00011 * by the cpp laser alarm source library, but it may have other uses. It is 00012 * not very sophisticated, however. 00013 */ 00014 class Timestamp 00015 { 00016 public: 00017 00018 // constructors 00019 Timestamp(); 00020 Timestamp(const Timestamp &); 00021 Timestamp(long secs, long microSecs); 00022 00023 // destructor 00024 virtual ~Timestamp(); 00025 00026 // assignment operator 00027 Timestamp & operator=(const Timestamp & rhs); 00028 00029 // equality operator 00030 int operator==(const Timestamp &rhs) const; 00031 00032 // accessor for the seconds 00033 long getSeconds() { return seconds; } 00034 00035 // mutator for the seconds 00036 void setSeconds(long newSecs) { seconds = newSecs; } 00037 00038 // accessor for the microseconds 00039 long getMicroSeconds() { return microSeconds; } 00040 00041 // mutator for the microseconds 00042 void setMicroSeconds(long newMicroSecs) { microSeconds = newMicroSecs; } 00043 00057 std::string toXML(std::string elementName = USER_TIMESTAMP_ELEMENT_NAME, int amountToIndent = 6); 00058 00059 private: 00060 long seconds; 00061 long microSeconds; 00062 }; 00063 } 00064 #endif