CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamerFileIO.cc
Go to the documentation of this file.
2 #include <fstream>
3 #include <iostream>
6 
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)),
13  filename_(name)
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  }
21 
23  {
24  ost_->close();
25  }
26 
27  bool OutputFile::write(const char *ptr, size_t n)
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  }
38 
uint64 current_offset_
OutputFile(const std::string &name)
bool write(const char *ptr, size_t n)
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
unsigned long long uint64
Definition: MsgTools.h:14
edm::propagate_const< std::shared_ptr< std::ofstream > > ost_
uint32 adlerb_
uint32 adlera_