CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FRDFileHandler.cc
Go to the documentation of this file.
1 // $Id: FRDFileHandler.cc,v 1.19 2012/04/04 12:17:02 mommsen Exp $
3 
8 
9 #include <iostream>
10 
11 
12 namespace stor {
13 
15  (
17  const DbFileHandlerPtr dbFileHandler,
18  const uint64_t& maxFileSize
19  ) :
20  FileHandler(fileRecord, dbFileHandler, maxFileSize),
21  writer_(new FRDEventFileWriter(fileRecord->completeFileName()))
22  {}
23 
24 
26  {
27  unsigned int fragCount = chain.fragmentCount();
28  for (unsigned int idx = 0; idx < fragCount; ++idx)
29  {
30  writer_->doOutputEventFragment(
31  chain.dataLocation(idx),
32  chain.dataSize(idx));
33  }
34  }
35 
36 
38  {
39  if ( ! fileRecord_->isOpen ) return;
40 
41  if (writer_)
42  {
43  // if writer was reset, we already closed the stream but failed to move the file to the closed position
44  writer_->stop();
45  fileRecord_->adler32 = writer_->adler32();
46  writer_.reset(); // Destruct the writer to flush the file stream
47  }
48  moveFileToClosed(reason);
50  }
51 
52 } // namespace stor
53 
void moveFileToClosed(const FilesMonitorCollection::FileRecord::ClosingReason &)
Definition: FileHandler.cc:190
unsigned int fragmentCount() const
Definition: I2OChain.cc:284
virtual void do_writeEvent(const I2OChain &)
string reason
Definition: Association.py:177
boost::shared_ptr< FileRecord > FileRecordPtr
boost::shared_ptr< DbFileHandler > DbFileHandlerPtr
Definition: DbFileHandler.h:71
void updateDatabase() const
Definition: FileHandler.cc:70
unsigned long long uint64_t
Definition: Time.h:15
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
FilesMonitorCollection::FileRecordPtr fileRecord_
Definition: FileHandler.h:181
FRDFileHandler(FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
boost::scoped_ptr< FRDEventFileWriter > writer_
unsigned long dataSize(int fragmentIndex) const
Definition: I2OChain.cc:438
virtual void closeFile(const FilesMonitorCollection::FileRecord::ClosingReason &)
unsigned char * dataLocation(int fragmentIndex) const
Definition: I2OChain.cc:444