ATLAS Offline Software
GeometryDBSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef GeometryDBSvc_h
6 #define GeometryDBSvc_h
7 
9 
10 #include "GaudiKernel/IInterface.h"
12 
13 #include <vector>
14 #include <string>
15 
16 class TextFileDBReader;
17 class IRDBRecordset;
18 
25 class GeometryDBSvc: public AthService, virtual public IGeometryDBSvc
26 {
27 public:
28  GeometryDBSvc(const std::string& name, ISvcLocator* sl);
29  virtual ~GeometryDBSvc();
30 
31  virtual StatusCode initialize();
32  virtual StatusCode finalize();
33  virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
34 
35  static const InterfaceID & interfaceID();
36 
37  virtual double getDouble(IRDBRecordset_ptr recordSet, const std::string & name, int index=0) const;
38  virtual int getInt(IRDBRecordset_ptr recordSet, const std::string & name, int index=0) const;
39  virtual std::string getString(IRDBRecordset_ptr recordSet, const std::string & name, int index=0) const;
40  virtual bool testField(IRDBRecordset_ptr recordSet, const std::string & name, int index=0) const;
41  virtual bool testFieldTxt(IRDBRecordset_ptr recordSet, const std::string & name, int index=0) const;
42  virtual unsigned int getTableSize(IRDBRecordset_ptr recordSet) const;
43 
44  virtual double getDouble(const std::string & recordSetName, const std::string & name, int index=0) const;
45  virtual int getInt(const std::string & recordSetName, const std::string & name, int index=0) const;
46  virtual std::string getString(const std::string & recordSetName, const std::string & name, int index=0) const;
47  virtual bool testField(const std::string & recordSetName, const std::string & name, int index=0) const;
48  virtual unsigned int getTableSize(const std::string & recordSetName) const;
49 
51  virtual void printParameters(const std::string & section = "") const;
52 
54  virtual void printNotUsed(const std::string & section = "") const;
55 
56 
57 private:
58 
59  void setParameterFileName(const std::string & filename);
60  std::string parameterKey(const std::string & recordSetName, const std::string & name, int index) const;
61  bool getValue(const std::string & recordSetName, const std::string & name, int index, std::string & var) const;
62  bool getValue(const std::string & recordSetName, const std::string & name, int index, double & var) const;
63  bool getValue(const std::string & recordSetName, const std::string & name, int index, int & var) const;
64  bool getTableSizeFromTextFile(const std::string & recordSetName, int & var) const;
65 
66  // Pointer to text file interface
68 
69  // Properties
70  std::string m_textFileName;
73  std::vector<std::string> m_sections;
74 
75 
76 };
77 
78 inline const InterfaceID & GeometryDBSvc::interfaceID(){
80 }
81 
82 #endif
GeometryDBSvc::testField
virtual bool testField(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
Definition: GeometryDBSvc.cxx:307
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
GeometryDBSvc::m_printNotUsed
bool m_printNotUsed
Definition: GeometryDBSvc.h:72
GeometryDBSvc::getString
virtual std::string getString(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
Definition: GeometryDBSvc.cxx:210
GeometryDBSvc::printParameters
virtual void printParameters(const std::string &section="") const
Print paramaters read in from text file. If section is supplied only consider the parameters in that ...
Definition: GeometryDBSvc.cxx:407
IGeometryDBSvc.h
GeometryDBSvc::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Definition: GeometryDBSvc.cxx:105
GeometryDBSvc::getTableSizeFromTextFile
bool getTableSizeFromTextFile(const std::string &recordSetName, int &var) const
Definition: GeometryDBSvc.cxx:385
index
Definition: index.py:1
GeometryDBSvc::finalize
virtual StatusCode finalize()
Service finalize.
Definition: GeometryDBSvc.cxx:67
GeometryDBSvc::initialize
virtual StatusCode initialize()
Service init.
Definition: GeometryDBSvc.cxx:30
GeometryDBSvc::m_textParameters
TextFileDBReader * m_textParameters
Definition: GeometryDBSvc.h:67
GeometryDBSvc::testFieldTxt
virtual bool testFieldTxt(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
Definition: GeometryDBSvc.cxx:300
GeometryDBSvc::printNotUsed
virtual void printNotUsed(const std::string &section="") const
Print paramaters from text file which are not used. If section is supplied only consider the paramete...
Definition: GeometryDBSvc.cxx:413
GeometryDBSvc::getValue
bool getValue(const std::string &recordSetName, const std::string &name, int index, std::string &var) const
Definition: GeometryDBSvc.cxx:243
GeometryDBSvc::getDouble
virtual double getDouble(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
The following methods will first look in the text file if provided and then look in the database.
Definition: GeometryDBSvc.cxx:146
TextFileDBReader
Class to read in a text file and allow easy retrieval of parameters.
Definition: TextFileDBReader.h:18
IRDBRecordset
IRDBRecordset is an abstract interface to the RDB Recordsets, which represent a snapshot of HVS-tagge...
Definition: IRDBRecordset.h:35
GeometryDBSvc::parameterKey
std::string parameterKey(const std::string &recordSetName, const std::string &name, int index) const
Definition: GeometryDBSvc.cxx:134
GeometryDBSvc::~GeometryDBSvc
virtual ~GeometryDBSvc()
Definition: GeometryDBSvc.cxx:24
GeometryDBSvc::getInt
virtual int getInt(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const
Definition: GeometryDBSvc.cxx:178
GeometryDBSvc::interfaceID
static const InterfaceID & interfaceID()
Definition: GeometryDBSvc.h:78
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthService
Definition: AthService.h:32
GeometryDBSvc::setParameterFileName
void setParameterFileName(const std::string &filename)
Definition: GeometryDBSvc.cxx:118
IGeometryDBSvc
Definition: IGeometryDBSvc.h:21
IGeometryDBSvc::interfaceID
static const InterfaceID & interfaceID()
reimplemented from IInterface
Definition: IGeometryDBSvc.h:52
GeometryDBSvc
Definition: GeometryDBSvc.h:26
GeometryDBSvc::GeometryDBSvc
GeometryDBSvc(const std::string &name, ISvcLocator *sl)
Definition: GeometryDBSvc.cxx:14
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
GeometryDBSvc::m_textFileName
std::string m_textFileName
Definition: GeometryDBSvc.h:70
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
GeometryDBSvc::m_sections
std::vector< std::string > m_sections
Definition: GeometryDBSvc.h:73
GeometryDBSvc::getTableSize
virtual unsigned int getTableSize(IRDBRecordset_ptr recordSet) const
Definition: GeometryDBSvc.cxx:341
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
GeometryDBSvc::m_printParameters
bool m_printParameters
Definition: GeometryDBSvc.h:71
AthService.h
section
void section(const std::string &sec)
Definition: TestTriggerMenuAccess.cxx:22