00001 #ifndef LTBREADOUTFORMAT_LTBTIME_H 00002 #define LTBREADOUTFORMAT_LTBTIME_H 00003 00012 #include "LtbReadoutFormat/LtbBuffer.h" 00013 00014 #include <ctime> 00015 00016 #include "LtbReadoutFormat/LtbTraits.h" 00017 00018 namespace DybDaq { 00019 class LtbFrame; 00020 } 00021 00022 namespace DybDaq { 00023 00024 class LtbTime : public LtbBuffer { 00025 00026 public: 00027 00028 friend class LtbFrame; 00029 friend class LtbTraits; 00030 00034 LtbTime(const LtbTraits::LtbDateTime& dateTime, 00035 const unsigned int halfNanoseconds, 00036 const unsigned int accumulation, 00037 const LtbTraits& traits); 00038 00042 LtbTime(const ByteBuffer& byteBuffer, 00043 const LtbTraits& traits); 00044 00048 virtual ~LtbTime(); 00049 00053 unsigned int year() const; 00054 00058 unsigned int month() const; 00059 00063 unsigned int day() const; 00064 00068 unsigned int hour() const; 00069 00073 unsigned int minutes() const; 00074 00078 unsigned int seconds() const; 00079 00083 unsigned int ticks() const; 00084 00088 time_t unixTime() const; 00089 00093 unsigned int halfNanoseconds() const; 00094 00098 int accumulation() const; 00099 00103 virtual unsigned int bufferSize() const; 00104 00108 void setDateTime(const LtbTraits::LtbDateTime& dateTime); 00109 00113 void setDateTime(const time_t& dateTime); 00114 00118 void setHalfNanoseconds(const unsigned int halfNanoseconds); 00119 00123 void setAccumulation(const int accumulation); 00124 00125 protected: 00126 00130 LtbTime(const time_t& dateTime, 00131 const unsigned int halfNanoseconds, 00132 const unsigned int accumulation, 00133 const LtbTraits& traits); 00134 00138 virtual unsigned int formatComponent() const; 00139 00140 private: 00141 00145 LtbTime(LtbTime& rhs); 00146 00150 LtbTime& operator=(LtbTime& rhs); 00151 00152 }; 00153 00154 } 00155 00156 #endif // LTBREADOUTFORMAT_LTBTIME_H