![]() |
![]() |
00001 #ifndef STREAMSERVICE_H 00002 #define STREAMSERVICE_H 00003 00004 // $Id: StreamService.h,v 1.12 2008/09/04 17:44:16 biery Exp $ 00005 00006 #include <EventFilter/StorageManager/interface/FileRecord.h> 00007 #include <EventFilter/StorageManager/interface/OutputService.h> 00008 00009 #include <IOPool/Streamer/interface/MsgHeader.h> 00010 #include <FWCore/ParameterSet/interface/ParameterSet.h> 00011 00012 #include <boost/shared_ptr.hpp> 00013 #include <boost/thread/thread.hpp> 00014 00015 #include <string> 00016 #include <map> 00017 00018 00019 namespace edm { 00020 00021 typedef std::map <boost::shared_ptr<FileRecord>, boost::shared_ptr<OutputService> > OutputMap; 00022 typedef std::map <boost::shared_ptr<FileRecord>, boost::shared_ptr<OutputService> >::iterator OutputMapIterator; 00023 00024 class StreamService 00025 { 00026 public: 00027 virtual ~StreamService(); 00028 00029 virtual bool nextEvent(const uint8 * const) = 0; 00030 virtual void stop() = 0; 00031 virtual void report(std::ostream &os, int indentation) const = 0; 00032 int lumiSection() const { return lumiSection_; } 00033 00034 void setNumberOfFileSystems(int i) { numberOfFileSystems_ = i; } 00035 void setCatalog(const std::string &s) { catalog_ = s; } 00036 void setSourceId(const std::string &s) { sourceId_ = s; } 00037 void setFileName(const std::string &s) { fileName_ = s; } 00038 void setFilePath(const std::string &s) { filePath_ = s; } 00039 void setMaxFileSize(int x); 00040 void setSetupLabel(std::string s) { setupLabel_ = s; } 00041 void setHighWaterMark(double d) { highWaterMark_ = d; } 00042 void setLumiSectionTimeOut(double d) { lumiSectionTimeOut_ = d; } 00043 virtual void closeTimedOutFiles(int lumi, double timeoutstart) = 0; 00044 virtual void closeTimedOutFiles() = 0; 00045 00046 double getCurrentTime() const; 00047 00048 std::list<std::string> getFileList(); 00049 std::list<std::string> getCurrentFileList(); 00050 const std::string& getStreamLabel() const { return streamLabel_; } 00051 00052 protected: 00053 void setStreamParameter(); 00054 bool checkFileSystem() const; 00055 void fillOutputSummaryClosed(const boost::shared_ptr<FileRecord> &file); 00056 00057 // variables 00058 ParameterSet parameterSet_; 00059 OutputMap outputMap_; 00060 std::map<std::string, int> outputSummary_; 00061 std::list<std::string> outputSummaryClosed_; 00062 00063 // set from event message 00064 int runNumber_; 00065 int lumiSection_; 00066 00067 // should be output module parameter 00068 int numberOfFileSystems_; 00069 std::string catalog_; 00070 std::string sourceId_; 00071 00072 // output module parameter 00073 std::string fileName_; 00074 std::string filePath_; 00075 int maxFileSizeInMB_; 00076 std::string setupLabel_; 00077 std::string streamLabel_; 00078 long long maxSize_; 00079 double highWaterMark_; 00080 double lumiSectionTimeOut_; 00081 00082 int ntotal_; //total number of files 00083 00084 //@@EM added lock to handle access to file list by monitoring loop 00085 boost::mutex list_lock_; 00086 00087 }; 00088 00089 } // edm namespace 00090 #endif