CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

stor::FRDFileHandler Class Reference

#include <FRDFileHandler.h>

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

List of all members.

Public Member Functions

virtual void closeFile (const FilesMonitorCollection::FileRecord::ClosingReason &)
 FRDFileHandler (FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)

Private Member Functions

virtual void do_writeEvent (const I2OChain &)

Private Attributes

boost::scoped_ptr
< FRDEventFileWriter
writer_

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.

    :
  FileHandler(fileRecord, dbFileHandler, maxFileSize),
  writer_(new FRDEventFileWriter(fileRecord->completeFileName()))
  {}

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_.

  {
    if ( ! fileRecord_->isOpen ) return;
    
    if (writer_)
    {
      // if writer was reset, we already closed the stream but failed to move the file to the closed position
      writer_->stop();
      fileRecord_->adler32 = writer_->adler32();
      writer_.reset(); // Destruct the writer to flush the file stream
    }
    moveFileToClosed(reason);
    updateDatabase();
  }
void stor::FRDFileHandler::do_writeEvent ( const I2OChain chain) [private, virtual]

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(), UserOptions_cff::idx, and writer_.

  {
    unsigned int fragCount = chain.fragmentCount();
    for (unsigned int idx = 0; idx < fragCount; ++idx)
    {
      writer_->doOutputEventFragment(
        chain.dataLocation(idx),
        chain.dataSize(idx));
    }
  }

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().