Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
CondCore
CondDB
src
FileUtils.cc
Go to the documentation of this file.
1
#include "
CondCore/CondDB/interface/FileUtils.h
"
2
#include "
CondCore/CondDB/interface/Exception.h
"
3
#include <fstream>
4
#include <sstream>
5
6
bool
cond::FileReader::read
(
const
std::string
&
fileName
) {
7
std::ifstream
inputFile
;
8
inputFile.open(fileName.c_str());
9
if
(!inputFile.good()) {
10
std::stringstream
msg
;
11
msg <<
"File \""
<< fileName <<
"\" cannot be open."
;
12
inputFile.close();
13
throw
cond::Exception
(msg.str());
14
}
15
// get pointer to associated buffer object
16
std::filebuf* pbuf = inputFile.rdbuf();
17
// get file size using buffer's members
18
long
size
= pbuf->pubseekoff(0,
std::ios::end
,
std::ios::in
);
19
pbuf->pubseekpos(0,
std::ios::in
);
20
// allocate memory to contain file data
21
char
*
buffer
=
new
char
[size + 1];
22
// get file data
23
pbuf->sgetn(buffer, size);
24
inputFile.close();
25
buffer[
size
] = 0;
26
m_content
+=
buffer
;
27
delete
[]
buffer
;
28
return
true
;
29
}
cond::Exception
persistency::Exception Exception
Definition:
Exception.h:25
writeEcalDQMStatus.inputFile
tuple inputFile
Definition:
writeEcalDQMStatus.py:50
recoMuon::in
Definition:
RecoMuonEnumerators.h:6
cond::FileReader::m_content
std::string m_content
Definition:
FileUtils.h:18
Exception.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
MillePedeFileConverter_cfg.fileName
tuple fileName
Definition:
MillePedeFileConverter_cfg.py:32
cond::FileReader::read
bool read(const std::string &fileName)
Definition:
FileUtils.cc:6
FileUtils.h
mps_check.msg
tuple msg
Definition:
mps_check.py:285
edmScanValgrind.buffer
list buffer
Definition:
edmScanValgrind.py:171
dataset.end
string end
Definition:
dataset.py:937
findQualityFiles.size
tuple size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.5