00001
00035 #ifndef OUTPUTFILEROLLERTOOL
00036 #define OUTPUTFILEROLLERTOOL
00037
00038 #include "RootIOSvc/IRootIOSvc.h"
00039 #include "Context/TimeStamp.h"
00040 #include "DybKernel/IRegSeqVisitor.h"
00041 #include "Event/RegistrationSequence.h"
00042
00043 #include "GaudiAlg/GaudiTool.h"
00044
00045 #include <string>
00046
00047 class OutputFileRollerTool : public GaudiTool ,
00048 virtual public IRegSeqVisitor
00049 {
00050 public:
00051 OutputFileRollerTool(const std::string& type,
00052 const std::string& name,
00053 const IInterface* parent);
00054 virtual ~OutputFileRollerTool();
00055
00056
00057 virtual StatusCode visit(DayaBay::RegistrationSequence& rs);
00058
00059 private:
00060
00071 std::string m_condition;
00072
00076 int m_startOffset;
00077
00091 typedef std::map<std::string,std::string> ConditionPropertyMap_t;
00092 ConditionPropertyMap_t m_condpropmap;
00093
00094 private:
00095 int m_current_execnum;
00096 IRootIOSvc* m_rio;
00097 IRootIOSvc::FileMap m_filemap;
00098
00099
00100 struct ConditionData {
00101 ConditionData(int s, char u, int c=0,
00102 int e = 0, const TimeStamp& ts = TimeStamp::GetBOT())
00103 : size(s), unit(u), count(c), cycles(e), timestamp(ts) {}
00104 ConditionData()
00105 : size(0), unit(0), count(0), cycles(0), timestamp(TimeStamp::GetBOT()) {}
00106 int size;
00107 char unit;
00108 int count;
00109 int cycles;
00110 TimeStamp timestamp;
00111
00112 };
00113
00114 typedef std::map<std::string,ConditionData> CDMap_t;
00115 CDMap_t m_cdmap;
00116
00117 bool m_initialized;
00118 virtual StatusCode _initialize();
00119
00120
00121 StatusCode roll(std::string stream, ConditionData& cd);
00122 StatusCode check_e(std::string stream, ConditionData& cd);
00123 StatusCode check_m(std::string stream, ConditionData& cd);
00124 StatusCode check_s(std::string stream, ConditionData& cd);
00125
00126 };
00127
00128 #endif // OUTPUTFILEROLLERTOOL