#ifndef __SDTOOLS_H #define __SDTOOLS_H #include #include #include "IoSd.h" #include class SdT3 : public IoSdT3Trigger { public: SdT3() : IoSdT3Trigger() { toMerge = 0; EvId = 0; Date = ""; Time = 0; }; SdT3(const IoSdT3Trigger &t3) : IoSdT3Trigger(t3) {}; SdT3(const IoSdEvent &ev, const int position) : IoSdT3Trigger(ev.Trigger) { toMerge = 0; EvId=ev.Id; Date = ev.UTCDate; Time = ev.UTCTime; pos = position;}; bool operator <(const SdT3 &right) const { if (Second == right.Second && MicroSecond == right.MicroSecond) return (Id < right.Id); if(Second == right.Second) return (MicroSecond < right.MicroSecond); else return (Second < right.Second); }; bool operator >(const SdT3 &right) const { if(Second == right.Second && MicroSecond == right.MicroSecond) return (Id > right.Id); if(Second == right.Second) return (MicroSecond > right.MicroSecond); else return (Second > right.Second); }; bool operator <=(const SdT3 &right) const { if(Second == right.Second) return (MicroSecond <= right.MicroSecond); else return (Second <= right.Second); }; bool operator >=(const SdT3 &right) const { if(Second == right.Second) return (MicroSecond >= right.MicroSecond); else return (Second >= right.Second); }; void Dump(ostream& ostr=cout); EventId EvId; std::string Date; time_t Time; int toMerge, pos; }; //int SdMerge(int n, char **files); void SdToolsPrepareForMerge(std::vector &SdT3s); void SdToolsAddEvent(IoSdEvent &a, IoSdEvent &m); void SdToolsPrepareForWrite(IoSdEvent &ev); IoSd *SdToolsSelectOutput(SdT3 &T3, SdT3 &lastT3, bool Overwrite, bool prod, bool lyon,bool &flagnew); IoSd *SdToolsSelectDailyOutput( bool Overwrite, bool prod, bool lyon, int yy, int mm,int dd); //IoSd *SdToolsSelectOutput(SdT3 &T3, SdT3 &lastT3, bool Overwrite, bool prod); int SdToolsBuildSdT3List(IoSd & input, std::vector &SdT3s); int SdToolsBuildDailySdT3List(int yy,int mm,int dd,IoSd & input, std::vector &SdT3s); bool CheckEvent(IoSdEvent& ev, SdT3& t3, bool verbose); double timeDiff(SdT3 &t1, SdT3 &t2,bool with_offset ); double GetOffset(IoSdEvent & ev); #endif