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 Attributes
OutputFile Class Reference

#include <StreamerFileIO.h>

Public Member Functions

uint32 adler32 () const
 
uint64 current_offset () const
 
uint64 events () const
 
std::string fileName () const
 
uint64 first_event_offset () const
 
void inc_events ()
 
uint64 last_event_offset () const
 
 OutputFile (const std::string &name)
 
uint64 run () const
 
void set_current_offset (uint64 v)
 
void set_do_adler (bool v)
 
void set_events (uint64 v)
 
void set_first_event_offset (uint64 v)
 
void set_last_event_offset (uint64 v)
 
void set_run (uint64 v)
 
bool write (const char *ptr, size_t n)
 
 ~OutputFile ()
 

Private Attributes

uint32 adlera_
 
uint32 adlerb_
 
uint64 current_offset_
 
bool do_adler_
 
uint32 events_
 
std::string filename_
 
uint64 first_event_offset_
 
uint64 last_event_offset_
 
boost::shared_ptr< std::ofstream > ost_
 
uint32 run_
 

Detailed Description

This file contains Class definitions for the Class representing Output (Streamer) file. Class representing Output (Streamer) file.

Definition at line 16 of file StreamerFileIO.h.

Constructor & Destructor Documentation

OutputFile::OutputFile ( const std::string &  name)
explicit

Definition at line 7 of file StreamerFileIO.cc.

References edm::hlt::Exception, and ost_.

7  :
8  current_offset_(1),
11  events_(0),
12  run_(0),
13  do_adler_(0),
14  adlera_(1),
15  adlerb_(0),
16  ost_(new std::ofstream(name.c_str(), std::ios_base::binary | std::ios_base::out)),
18  {
19  if(!ost_->is_open()) {
20  throw cms::Exception("OutputFile","OutputFile")
21  << "Error Opening Output File: "<<name<<"\n";
22  }
23  ost_->rdbuf()->pubsetbuf(0,0);
24  }
uint64 current_offset_
uint32 events_
boost::shared_ptr< std::ofstream > ost_
std::string filename_
uint64 first_event_offset_
uint64 last_event_offset_
tuple out
Definition: dbtoconf.py:99
uint32 adlerb_
uint32 adlera_
OutputFile::~OutputFile ( )

CTOR, takes file path name as argument

Definition at line 26 of file StreamerFileIO.cc.

References ost_.

27  {
28  ost_->close();
29  }
boost::shared_ptr< std::ofstream > ost_

Member Function Documentation

uint32 OutputFile::adler32 ( ) const
inline

Definition at line 36 of file StreamerFileIO.h.

References adlera_, and adlerb_.

36 { return (adlerb_ << 16) | adlera_; }
uint32 adlerb_
uint32 adlera_
uint64 OutputFile::current_offset ( ) const
inline

Definition at line 31 of file StreamerFileIO.h.

References current_offset_.

31 { return current_offset_; }
uint64 current_offset_
uint64 OutputFile::events ( ) const
inline

Definition at line 34 of file StreamerFileIO.h.

References events_.

34 { return events_; }
uint32 events_
std::string OutputFile::fileName ( ) const
inline

Definition at line 30 of file StreamerFileIO.h.

References filename_.

30 { return filename_; }
std::string filename_
uint64 OutputFile::first_event_offset ( ) const
inline

Definition at line 32 of file StreamerFileIO.h.

References first_event_offset_.

32 { return first_event_offset_; }
uint64 first_event_offset_
void OutputFile::inc_events ( )
inline

Definition at line 43 of file StreamerFileIO.h.

References events_.

43 { ++events_; }
uint32 events_
uint64 OutputFile::last_event_offset ( ) const
inline

Definition at line 33 of file StreamerFileIO.h.

References last_event_offset_.

33 { return last_event_offset_; }
uint64 last_event_offset_
uint64 OutputFile::run ( void  ) const
inline

Definition at line 35 of file StreamerFileIO.h.

References run_.

35 { return run_; }
void OutputFile::set_current_offset ( uint64  v)
inline

Definition at line 39 of file StreamerFileIO.h.

References current_offset_, and findQualityFiles::v.

void OutputFile::set_do_adler ( bool  v)
inline

Definition at line 38 of file StreamerFileIO.h.

References do_adler_, and findQualityFiles::v.

void OutputFile::set_events ( uint64  v)
inline

Definition at line 42 of file StreamerFileIO.h.

References events_, and findQualityFiles::v.

void OutputFile::set_first_event_offset ( uint64  v)
inline

Definition at line 40 of file StreamerFileIO.h.

References first_event_offset_, and findQualityFiles::v.

void OutputFile::set_last_event_offset ( uint64  v)
inline

Definition at line 41 of file StreamerFileIO.h.

References last_event_offset_, and findQualityFiles::v.

void OutputFile::set_run ( uint64  v)
inline

Definition at line 44 of file StreamerFileIO.h.

References run_, and findQualityFiles::v.

bool OutputFile::write ( const char *  ptr,
size_t  n 
)

Definition at line 31 of file StreamerFileIO.cc.

References cms::Adler32(), adlera_, adlerb_, current_offset_, do_adler_, and ost_.

32  {
33  ost_->write(ptr,n);
34  if(!ost_->fail()) {
35  current_offset_ += (uint64)(n);
36  if (do_adler_)
38  return 0;
39  }
40  return 1;
41  }
uint64 current_offset_
ULong64_t uint64
boost::shared_ptr< std::ofstream > ost_
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
uint32 adlerb_
uint32 adlera_

Member Data Documentation

uint32 OutputFile::adlera_
private

Definition at line 54 of file StreamerFileIO.h.

Referenced by adler32(), and write().

uint32 OutputFile::adlerb_
private

Definition at line 55 of file StreamerFileIO.h.

Referenced by adler32(), and write().

uint64 OutputFile::current_offset_
private

Definition at line 47 of file StreamerFileIO.h.

Referenced by current_offset(), set_current_offset(), and write().

bool OutputFile::do_adler_
private

Definition at line 53 of file StreamerFileIO.h.

Referenced by set_do_adler(), and write().

uint32 OutputFile::events_
private

Definition at line 50 of file StreamerFileIO.h.

Referenced by events(), inc_events(), and set_events().

std::string OutputFile::filename_
private

Definition at line 58 of file StreamerFileIO.h.

Referenced by fileName().

uint64 OutputFile::first_event_offset_
private

Location of current ioptr

Definition at line 48 of file StreamerFileIO.h.

Referenced by first_event_offset(), and set_first_event_offset().

uint64 OutputFile::last_event_offset_
private

Definition at line 49 of file StreamerFileIO.h.

Referenced by last_event_offset(), and set_last_event_offset().

boost::shared_ptr<std::ofstream> OutputFile::ost_
private

Definition at line 57 of file StreamerFileIO.h.

Referenced by OutputFile(), write(), and ~OutputFile().

uint32 OutputFile::run_
private

Definition at line 51 of file StreamerFileIO.h.

Referenced by run(), and set_run().