This class provides the interface to the ROOT software.
More...
#include <RootSvc.h>
This class provides the interface to the ROOT software.
Definition at line 39 of file RootSvc.h.
◆ ConnMap_t
◆ RootSvc() [1/3]
| Athena::RootSvc::RootSvc |
( |
const std::string & | name, |
|
|
ISvcLocator * | pSvcLocator ) |
Standard Service Constructor.
Definition at line 27 of file RootSvc.cxx.
27 :
28 base_class(name, pSvcLocator),
33}
ConnMap_t m_conns
Map of file name keys and connection values.
pool::IFileCatalog * m_catalog
Athena::RootConnection * m_wconn
ServiceHandle< ::IDictLoaderSvc > m_dictSvc
ServiceHandle to the dictionary service.
◆ ~RootSvc()
| Athena::RootSvc::~RootSvc |
( |
| ) |
|
|
virtual |
Destructor.
Definition at line 35 of file RootSvc.cxx.
35 {
36 for (ConnMap_t::iterator itr =
m_conns.begin(), iend =
m_conns.end(); itr != iend; ++itr) {
37 delete itr->second; itr->second = 0;
38 }
40}
◆ RootSvc() [2/3]
| Athena::RootSvc::RootSvc |
( |
| ) |
|
|
private |
◆ RootSvc() [3/3]
| Athena::RootSvc::RootSvc |
( |
const RootSvc & | | ) |
|
|
private |
◆ commitOutput()
| StatusCode Athena::RootSvc::commitOutput |
( |
| ) |
|
Commit data and flush buffer.
Definition at line 155 of file RootSvc.cxx.
155 {
159 return StatusCode::FAILURE;
160 }
161 if (!
m_wconn->commit().isSuccess()) {
163 return StatusCode::FAILURE;
164 }
165 return StatusCode::SUCCESS;
166}
#define ATH_MSG_VERBOSE(x)
◆ connect()
| StatusCode Athena::RootSvc::connect |
( |
const std::string & | fname | ) |
|
Connect the file fname to the service.
Definition at line 140 of file RootSvc.cxx.
140 {
143 if (conn == 0) {
145 return StatusCode::FAILURE;
146 }
147 if (!
conn->connectWrite(
"recreate").isSuccess()) {
149 return StatusCode::FAILURE;
150 }
152 return StatusCode::SUCCESS;
153}
Athena::RootConnection * connection(const std::string &fname)
Get the RootConnection associated with file fname
◆ connection()
Get the RootConnection associated with file fname
- Returns
- NULL if no such file is known to this service
Definition at line 188 of file RootSvc.cxx.
188 {
189
192 std::string fidString, ftype;
193 m_catalog->lookupFileByPFN(fname, fidString, ftype);
194 if( fidString.empty() ) {
195 m_catalog->registerPFN(fname,
"ROOT_All", fidString);
196 }
198 }
199 Athena::RootConnection*
conn = 0;
200 ConnMap_t::const_iterator fitr =
m_conns.find(fid);
203 }
205}
constexpr void fromString(std::string_view s)
Automatic conversion from string representation.
static const Guid & null() noexcept
NULL-Guid: static class method.
◆ createObject()
| void * Athena::RootSvc::createObject |
( |
const RootType & | type | ) |
const |
Create an object of a given RootType.
Definition at line 103 of file RootSvc.cxx.
103 {
104 void* pObj =
type.Construct();
105 return pObj;
106}
◆ destructObject()
| void Athena::RootSvc::destructObject |
( |
const RootType & | type, |
|
|
void * | pObj ) const |
◆ disconnect()
| StatusCode Athena::RootSvc::disconnect |
( |
const std::string & | fname | ) |
|
Disconnect the file fname from the service.
Definition at line 169 of file RootSvc.cxx.
169 {
172 if (conn == 0) {
174 return StatusCode::FAILURE;
175 }
176 if (!
conn->disconnect().isSuccess()) {
178 return StatusCode::FAILURE;
179 }
182 }
183 return StatusCode::SUCCESS;
184}
◆ finalize()
| StatusCode Athena::RootSvc::finalize |
( |
| ) |
|
Definition at line 60 of file RootSvc.cxx.
60 {
61 for (ConnMap_t::const_iterator itr =
m_conns.begin(), iend =
m_conns.end(); itr != iend; ++itr) {
62 if (!itr->second->disconnect().isSuccess()) {
64 }
65 }
69 }
70 return ::AthService::finalize();
71}
#define ATH_MSG_WARNING(x)
◆ getType()
| RootType Athena::RootSvc::getType |
( |
const std::type_info & | type | ) |
const |
Load the type (dictionary) from Root.
RootType-base interface Load the type (dictionary) from Root.
Definition at line 74 of file RootSvc.cxx.
◆ initialize()
| StatusCode Athena::RootSvc::initialize |
( |
| ) |
|
Gaudi Service Interface method implementations:
Definition at line 42 of file RootSvc.cxx.
42 {
44 if (!::AthService::initialize().isSuccess()) {
46 return StatusCode::FAILURE;
47 }
49 try {
50 m_catalog->setWriteCatalog(
"xmlcatalog_file:RootFileCatalog.xml");
52 } catch (std::exception& e) {
54 return StatusCode::FAILURE;
55 }
57 return StatusCode::SUCCESS;
58}
#define ATH_CHECK
Evaluate an expression and check for errors.
◆ open()
| StatusCode Athena::RootSvc::open |
( |
const std::string & | fname, |
|
|
const std::string & | mode ) |
Open the file fname with open mode mode
Definition at line 113 of file RootSvc.cxx.
113 {
114
117 std::string fidString, ftype;
118 m_catalog->lookupFileByPFN(fname, fidString, ftype);
119 if( fidString.empty() ) {
120 m_catalog->registerPFN(fname,
"ROOT_All", fidString);
121 }
123 }
124 Athena::RootConnection*
conn = 0;
125 ConnMap_t::const_iterator fitr =
m_conns.find(fid);
127 conn =
new Athena::RootConnection(
this, fname);
128 m_conns.insert(std::make_pair(fid, conn));
129 } else {
131 }
132 if (conn == 0) {
134 return StatusCode::FAILURE;
135 }
136 return StatusCode::SUCCESS;
137}
constexpr void toString(std::span< char, StrLen > buf, bool uppercase=true) const noexcept
Automatic conversion to string representation.
◆ operator=()
◆ readObject()
| void * Athena::RootSvc::readObject |
( |
const Token & | token, |
|
|
void *& | pObj ) |
◆ writeObject()
| const Token * Athena::RootSvc::writeObject |
( |
const Placement & | placement, |
|
|
const RootType & | type, |
|
|
const void * | pObj ) |
Write object of a given class to Root.
Definition at line 84 of file RootSvc.cxx.
84 {
88 return 0;
89 }
92 return 0;
93 }
94 unsigned long ientry = 0;
95 if (!
m_wconn->write(pObj, ientry).isSuccess()) {
97 return 0;
98 }
99 return new Token();
100}
const std::string & containerName() const
Access container name.
◆ m_catalog
◆ m_conns
Map of file name keys and connection values.
Definition at line 96 of file RootSvc.h.
◆ m_dictSvc
◆ m_wconn
The documentation for this class was generated from the following files: