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
 
std::string fileName () const
 
 OutputFile (const std::string &name)
 
void set_current_offset (uint64 v)
 
void set_do_adler (bool v)
 
bool write (const char *ptr, size_t n)
 
 ~OutputFile ()
 

Private Attributes

uint32 adlera_
 
uint32 adlerb_
 
uint64 current_offset_
 
bool do_adler_
 
std::string filename_
 
std::shared_ptr< std::ofstream > ost_
 

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 Exception, and ost_.

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

CTOR, takes file path name as argument

Definition at line 22 of file StreamerFileIO.cc.

References ost_.

23  {
24  ost_->close();
25  }
std::shared_ptr< std::ofstream > ost_

Member Function Documentation

uint32 OutputFile::adler32 ( ) const
inline

Definition at line 32 of file StreamerFileIO.h.

References adlera_, and adlerb_.

32 { 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_
std::string OutputFile::fileName ( ) const
inline

Definition at line 30 of file StreamerFileIO.h.

References filename_.

30 { return filename_; }
std::string filename_
void OutputFile::set_current_offset ( uint64  v)
inline

Definition at line 35 of file StreamerFileIO.h.

References current_offset_, and findQualityFiles::v.

void OutputFile::set_do_adler ( bool  v)
inline

Definition at line 34 of file StreamerFileIO.h.

References do_adler_, and findQualityFiles::v.

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

Definition at line 27 of file StreamerFileIO.cc.

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

28  {
29  ost_->write(ptr,n);
30  if(!ost_->fail()) {
31  current_offset_ += (uint64)(n);
32  if (do_adler_)
34  return 0;
35  }
36  return 1;
37  }
uint64 current_offset_
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
unsigned long long uint64
Definition: MsgTools.h:14
std::shared_ptr< std::ofstream > ost_
uint32 adlerb_
uint32 adlera_

Member Data Documentation

uint32 OutputFile::adlera_
private

Definition at line 41 of file StreamerFileIO.h.

Referenced by adler32(), and write().

uint32 OutputFile::adlerb_
private

Definition at line 42 of file StreamerFileIO.h.

Referenced by adler32(), and write().

uint64 OutputFile::current_offset_
private

Definition at line 38 of file StreamerFileIO.h.

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

bool OutputFile::do_adler_
private

Location of current ioptr

Definition at line 40 of file StreamerFileIO.h.

Referenced by set_do_adler(), and write().

std::string OutputFile::filename_
private

Definition at line 45 of file StreamerFileIO.h.

Referenced by fileName().

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

Definition at line 44 of file StreamerFileIO.h.

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