CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
stor::FRDFileHandler Class Reference

#include <FRDFileHandler.h>

Inheritance diagram for stor::FRDFileHandler:
stor::FileHandler

Public Member Functions

virtual void closeFile (const FilesMonitorCollection::FileRecord::ClosingReason &)
 
 FRDFileHandler (FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
 
- Public Member Functions inherited from stor::FileHandler
uint32_t events () const
 
 FileHandler (FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
 
uint64_t fileSize () const
 
bool isFromLumiSection (const uint32_t lumiSection)
 
uint32_t lumiSection () const
 
bool tooLarge (const uint64_t &dataSize)
 
bool tooOld (const utils::TimePoint_t currentTime=utils::getCurrentTime())
 
void writeEvent (const I2OChain &)
 
virtual ~FileHandler ()
 

Private Member Functions

virtual void do_writeEvent (const I2OChain &)
 

Private Attributes

boost::scoped_ptr
< FRDEventFileWriter
writer_
 

Additional Inherited Members

- Protected Member Functions inherited from stor::FileHandler
void insertFileInDatabase () const
 
void moveFileToClosed (const FilesMonitorCollection::FileRecord::ClosingReason &)
 
void updateDatabase () const
 
- Protected Attributes inherited from stor::FileHandler
const DbFileHandlerPtr dbFileHandler_
 
const DiskWritingParamsdiskWritingParams_
 
FilesMonitorCollection::FileRecordPtr fileRecord_
 
utils::TimePoint_t firstEntry_
 
utils::TimePoint_t lastEntry_
 

Detailed Description

Represents a file holding HLT error events in the FED Raw Data (FRD) format.

Author:
mommsen
Revision:
1.14
Date:
2012/04/04 12:16:57

Definition at line 28 of file FRDFileHandler.h.

Constructor & Destructor Documentation

stor::FRDFileHandler::FRDFileHandler ( FilesMonitorCollection::FileRecordPtr  fileRecord,
const DbFileHandlerPtr  dbFileHandler,
const uint64_t &  maxFileSize 
)

Definition at line 15 of file FRDFileHandler.cc.

19  :
20  FileHandler(fileRecord, dbFileHandler, maxFileSize),
21  writer_(new FRDEventFileWriter(fileRecord->completeFileName()))
22  {}
FileHandler(FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
Definition: FileHandler.cc:26
boost::scoped_ptr< FRDEventFileWriter > writer_

Member Function Documentation

void stor::FRDFileHandler::closeFile ( const FilesMonitorCollection::FileRecord::ClosingReason reason)
virtual

Close the file

Implements stor::FileHandler.

Definition at line 37 of file FRDFileHandler.cc.

References stor::FileHandler::fileRecord_, stor::FileHandler::moveFileToClosed(), stor::FileHandler::updateDatabase(), and writer_.

Referenced by Vispa.Main.Application.Application::tabCloseRequest().

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  }
50  }
void moveFileToClosed(const FilesMonitorCollection::FileRecord::ClosingReason &)
Definition: FileHandler.cc:190
string reason
Definition: Association.py:177
void updateDatabase() const
Definition: FileHandler.cc:70
FilesMonitorCollection::FileRecordPtr fileRecord_
Definition: FileHandler.h:181
boost::scoped_ptr< FRDEventFileWriter > writer_
void stor::FRDFileHandler::do_writeEvent ( const I2OChain chain)
privatevirtual

Write the I2OChain to the file

Implements stor::FileHandler.

Definition at line 25 of file FRDFileHandler.cc.

References stor::I2OChain::dataLocation(), stor::I2OChain::dataSize(), stor::I2OChain::fragmentCount(), and writer_.

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  }
boost::scoped_ptr< FRDEventFileWriter > writer_

Member Data Documentation

boost::scoped_ptr<FRDEventFileWriter> stor::FRDFileHandler::writer_
private

Definition at line 51 of file FRDFileHandler.h.

Referenced by closeFile(), and do_writeEvent().