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
namespace
edm::streamer
{
8
OutputFile::OutputFile
(
const
std::string
&
name
)
9
: current_offset_(1),
10
do_adler_(
false
),
11
adlera_(1),
12
adlerb_(0),
13
ost_(new
std
::ofstream(
name
.c_str(),
std
::ios_base::binary |
std
::ios_base::
out
)),
14
filename_(
name
) {
15
if
(!
ost_
->is_open()) {
16
throw
cms::Exception
(
"OutputFile"
,
"OutputFile"
) <<
"Error Opening Output File: "
<<
name
<<
"\n"
;
17
}
18
ost_
->rdbuf()->pubsetbuf(
nullptr
, 0);
19
}
20
21
OutputFile::~OutputFile
() {
ost_
->close(); }
22
23
bool
OutputFile::write
(
const
char
* ptr,
size_t
n
) {
24
ost_
->write(ptr,
n
);
25
if
(!
ost_
->fail()) {
26
current_offset_
+= (
uint64
)(
n
);
27
if
(
do_adler_
)
28
cms::Adler32
(ptr,
n
,
adlera_
,
adlerb_
);
29
return
false
;
30
}
31
return
true
;
32
}
33
34
void
OutputFile::close
() {
ost_
->close(); }
35
}
// namespace edm::streamer
edm::streamer::OutputFile::~OutputFile
~OutputFile()
Definition:
StreamerFileIO.cc:21
funct::false
false
Definition:
Factorize.h:29
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
StreamerFileIO.h
edm::streamer::OutputFile::close
void close()
Definition:
StreamerFileIO.cc:34
edm::streamer::OutputFile::OutputFile
OutputFile(const std::string &name)
Definition:
StreamerFileIO.cc:8
cms::Adler32
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
Definition:
Adler32Calculator.cc:10
edm::streamer::OutputFile::ost_
edm::propagate_const< std::shared_ptr< std::ofstream > > ost_
Definition:
StreamerFileIO.h:46
edm::streamer::OutputFile::current_offset_
uint64 current_offset_
Definition:
StreamerFileIO.h:40
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::streamer::OutputFile::write
bool write(const char *ptr, size_t n)
Definition:
StreamerFileIO.cc:23
std
Definition:
JetResolutionObject.h:76
edm::streamer::OutputFile::adlera_
uint32 adlera_
Definition:
StreamerFileIO.h:43
edm::streamer
Definition:
StreamerFileIO.h:16
Exception
Definition:
hltDiff.cc:245
uint64
unsigned long long uint64
Definition:
MsgTools.h:14
edm::streamer::OutputFile::adlerb_
uint32 adlerb_
Definition:
StreamerFileIO.h:44
Adler32Calculator.h
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
Exception.h
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
edm::streamer::OutputFile::do_adler_
bool do_adler_
Definition:
StreamerFileIO.h:42
Generated for CMSSW Reference Manual by
1.8.16