CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/EventFilter/StorageManager/interface/DiskWriterResources.h

Go to the documentation of this file.
00001 // $Id: DiskWriterResources.h,v 1.9 2011/03/07 15:31:31 mommsen Exp $
00003 
00004 
00005 #ifndef EventFilter_StorageManager_DiskWriterResources_h
00006 #define EventFilter_StorageManager_DiskWriterResources_h
00007 
00008 #include "EventFilter/StorageManager/interface/Configuration.h"
00009 #include "EventFilter/StorageManager/interface/ErrorStreamConfigurationInfo.h"
00010 #include "EventFilter/StorageManager/interface/EventStreamConfigurationInfo.h"
00011 
00012 #include "boost/date_time/posix_time/posix_time_types.hpp"
00013 #include "boost/thread/condition.hpp"
00014 #include "boost/thread/mutex.hpp"
00015 
00016 #include <deque>
00017 #include <stdint.h>
00018 
00019 
00020 namespace stor
00021 {
00022 
00032   class DiskWriterResources
00033   {
00034   public:
00035 
00039     DiskWriterResources();
00040 
00044     virtual ~DiskWriterResources() {}
00045 
00052     void requestStreamConfiguration
00053     (
00054       EvtStrConfigListPtr const,
00055       ErrStrConfigListPtr const,
00056       DiskWritingParams const&,
00057       unsigned int const& runNumber,
00058       boost::posix_time::time_duration const& timeoutValue
00059     );
00060 
00065     void requestStreamDestruction();
00066 
00074     bool streamChangeRequested
00075     (
00076       bool& doConfig,
00077       EvtStrConfigListPtr&,
00078       ErrStrConfigListPtr&,
00079       DiskWritingParams& dwParams,
00080       unsigned int& runNumber,
00081       boost::posix_time::time_duration& timeoutValue
00082     );
00083 
00087     virtual void waitForStreamChange();
00088 
00092     virtual bool streamChangeOngoing();
00093 
00097     void streamChangeDone();
00098 
00102     void setBusy(bool isBusyFlag);
00103 
00107     bool isBusy();
00108 
00109   private:
00110 
00111     bool configurationIsNeeded_;
00112     bool streamChangeIsNeeded_;
00113     bool fileClosingTestIsNeeded_;
00114     bool diskWriterIsBusy_;
00115 
00116     EvtStrConfigListPtr requestedEventStreamConfig_;
00117     ErrStrConfigListPtr requestedErrorStreamConfig_;
00118     DiskWritingParams requestedDiskWritingParams_;
00119     unsigned int requestedRunNumber_;
00120     boost::posix_time::time_duration requestedTimeout_;
00121 
00122     bool streamChangeInProgress_;
00123     boost::condition streamChangeCondition_;
00124     
00125     mutable boost::mutex streamChangeMutex_;
00126   };
00127   
00128   typedef boost::shared_ptr<DiskWriterResources> DiskWriterResourcesPtr;
00129 
00130 } // namespace stor
00131 
00132 #endif // EventFilter_StorageManager_DiskWriterResources_h
00133