|
ATLAS Offline Software
|
Go to the documentation of this file.
15 base_class(
name, pSvcLocator),
18 declareProperty(
"TextFileName",
m_textFileName,
"Text file name for overriding database.");
19 declareProperty(
"PrintParameters",
m_printParameters =
true,
"Print parameters read in from text file.");
20 declareProperty(
"PrintNotUsed",
m_printNotUsed =
true,
"Print parameters not used.");
21 declareProperty(
"Sections",
m_sections,
"Sections considered for logging. Empty list means all.");
32 msg(MSG::INFO) <<
"GeometryDBSvc Initialized" <<
endmsg;
39 msg(MSG::INFO) <<
"Parameters from text file:" <<
endmsg;
43 bool printedUnnamed =
false;
44 for (std::vector<std::string>::const_iterator iter =
m_sections.begin(); iter !=
m_sections.end(); ++iter) {
45 msg(MSG::INFO) <<
"Parameters from text file from section: " << *iter <<
endmsg;
52 msg(MSG::INFO) <<
" Section not present. Parameters from text file from unnamed section already printed above." <<
endmsg;
54 msg(MSG::INFO) <<
" Section not present. Parameters from text file from unnamed section will be printed." <<
endmsg;
56 printedUnnamed =
true;
62 return StatusCode::SUCCESS;
73 msg(MSG::INFO) <<
"The following parameters were not used:" <<
endmsg;
77 bool printedUnnamed =
false;
78 for (std::vector<std::string>::const_iterator iter =
m_sections.begin(); iter !=
m_sections.end(); ++iter) {
79 msg(MSG::INFO) <<
"The following parameters were not used from section: " << *iter <<
endmsg;
86 msg(MSG::INFO) <<
" Section not present. Parameters from text file from unnamed section already printed above." <<
endmsg;
88 msg(MSG::INFO) <<
" Section not present. Parameters from text file from unnamed section will be printed." <<
endmsg;
90 printedUnnamed =
true;
96 return StatusCode::SUCCESS;
105 msg(MSG::WARNING) <<
"Overriding from a text file is NOT recommended for production use." <<
endmsg;
119 std::ostringstream ostr;
120 if (!recordSetName.empty()) {
121 ostr << recordSetName <<
"#" <<
index <<
":" <<
name;
133 std::string recordSetName = recordSet->nodeName();
137 if (
index >= (
int)recordSet->size()) {
140 tmpPar = (*recordSet)[
index]->getDouble(
name);
165 std::string recordSetName = recordSet->nodeName();
169 if (
index >= (
int)recordSet->size()) {
172 tmpPar = (*recordSet)[
index]->getInt(
name);
197 std::string recordSetName = recordSet->nodeName();
201 if (
index >= (
int)recordSet->size()) {
204 tmpPar = (*recordSet)[
index]->getString(
name);
229 if (recordSetName.empty() &&
index) {
230 msg(MSG::WARNING) <<
"Non zero index for parameter with empry record set. Index will be ignored: " <<
index <<
endmsg;
236 if (!
result && !recordSetName.empty()) {
238 std::ostringstream keyalt;
239 keyalt << recordSetName <<
"#ALL:" <<
name;
253 std::istringstream istr(
result);
271 std::istringstream istr(
result);
285 std::string recordSetName = recordSet->nodeName();
292 std::string recordSetName = recordSet->nodeName();
298 if (
index < (
int)recordSet->size()) {
302 catch(std::runtime_error& ex) {
327 unsigned int tmpParUnsigned = 0;
328 std::string recordSetName = recordSet->nodeName();
332 msg(MSG::ERROR) <<
"Table " << recordSetName <<
" size from text file is negative: " << tmpPar <<
endmsg;
337 tmpParUnsigned =
static_cast<unsigned int>(tmpPar);
340 tmpParUnsigned = recordSet->size();
343 return tmpParUnsigned;
350 unsigned int tmpParUnsigned = 0;
354 msg(MSG::ERROR) <<
"Table " << recordSetName <<
" size from text file is negative: " << tmpPar <<
endmsg;
359 tmpParUnsigned =
static_cast<unsigned int>(tmpPar);
361 msg(MSG::ERROR) <<
"getTableSize: Table " << recordSetName <<
" does not exist in text file." <<
endmsg;
363 return tmpParUnsigned;
374 std::ostringstream
key;
375 key <<
"TableSize:" << recordSetName;
378 std::istringstream istr(
result);
381 msg(MSG::ERROR) <<
"Error retrieving parameter TableSize:" << recordSetName <<
" as an int: " <<
result <<
endmsg;
virtual bool testField(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
virtual std::string getString(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
virtual void printParameters(const std::string §ion="") const
Print paramaters read in from text file. If section is supplied only consider the parameters in that ...
bool getTableSizeFromTextFile(const std::string &recordSetName, int &var) const
void printNotUsed(const std::string §ion="") const
virtual StatusCode finalize()
Service finalize.
virtual StatusCode initialize()
Service init.
TextFileDBReader * m_textParameters
virtual bool testFieldTxt(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
virtual void printNotUsed(const std::string §ion="") const
Print paramaters from text file which are not used. If section is supplied only consider the paramete...
bool sectionPresent(const std::string §ion) const
bool getValue(const std::string &recordSetName, const std::string &name, int index, std::string &var) const
virtual double getDouble(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
Class to read in a text file and allow easy retrieval of parameters.
std::string parameterKey(const std::string &recordSetName, const std::string &name, int index) const
virtual int getInt(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
::StatusCode StatusCode
StatusCode definition for legacy code.
void setParameterFileName(const std::string &filename)
GeometryDBSvc(const std::string &name, ISvcLocator *sl)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
bool find(const std::string &key, std::string &result) const
std::string m_textFileName
std::vector< std::string > m_sections
Definition of the abstract IRDBRecord interface.
virtual unsigned int getTableSize(IRDBRecordset_ptr recordSet) const
Definition of the abstract IRDBRecordset interface.
bool readFile(const std::string &filename)
void printParameters(const std::string §ion="") const