Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
IOPool
Streamer
src
StreamerFileIO.cc
Go to the documentation of this file.
1
#include "
IOPool/Streamer/interface/StreamerFileIO.h
"
2
#include <fstream>
3
#include <iostream>
4
#include "
FWCore/Utilities/interface/Adler32Calculator.h
"
5
#include "
FWCore/Utilities/interface/Exception.h
"
6
7
OutputFile::OutputFile
(
const
std::string
&
name
):
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
22
OutputFile::~OutputFile
()
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_
)
33
cms::Adler32
(ptr,n,
adlera_
,
adlerb_
);
34
return
0;
35
}
36
return
1;
37
}
38
OutputFile::current_offset_
uint64 current_offset_
Definition:
StreamerFileIO.h:38
StreamerFileIO.h
OutputFile::do_adler_
bool do_adler_
Definition:
StreamerFileIO.h:40
OutputFile::~OutputFile
~OutputFile()
Definition:
StreamerFileIO.cc:22
uint64
ULong64_t uint64
Definition:
electronSelections.h:18
OutputFile::OutputFile
OutputFile(const std::string &name)
Definition:
StreamerFileIO.cc:7
mergeVDriftHistosByStation.name
string name
Definition:
mergeVDriftHistosByStation.py:77
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
OutputFile::write
bool write(const char *ptr, size_t n)
Definition:
StreamerFileIO.cc:27
dbtoconf.out
tuple out
Definition:
dbtoconf.py:99
cms::Adler32
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
Definition:
Adler32Calculator.cc:11
Exception.h
edm::hlt::Exception
error
Definition:
HLTenums.h:21
n
int n
Definition:
DTDataIntegrityTask.cc:30
Adler32Calculator.h
OutputFile::ost_
std::shared_ptr< std::ofstream > ost_
Definition:
StreamerFileIO.h:44
OutputFile::adlerb_
uint32 adlerb_
Definition:
StreamerFileIO.h:42
OutputFile::adlera_
uint32 adlera_
Definition:
StreamerFileIO.h:41
Generated for CMSSW Reference Manual by
1.8.5