ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
APR
APRTests
PoolTestBase.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef POOLTESTBASE_H
5
#define POOLTESTBASE_H
6
7
#include <string>
8
#include <iostream>
9
10
#include "GaudiKernel/System.h"
11
#include "GaudiKernel/ISvcLocator.h"
12
#include "
DataModelRoot/RootType.h
"
13
#include "
PoolSvc/ISessionTool.h
"
14
15
17
class
PoolTestBase
{
18
public
:
19
PoolTestBase
() =
default
;
20
PoolTestBase
(
const
PoolTestBase
&) =
delete
;
21
PoolTestBase
&
operator=
(
const
PoolTestBase
&) =
delete
;
22
virtual
~PoolTestBase
() =
default
;
23
25
static
void
loadLibraries
(
const
std::vector<std::string>& libraries );
27
ToolHandle<ISessionTool>
createSession
( Gaudi::IFileCatalog& fileCatalog,
const
std::string& sessionName );
28
};
29
30
31
inline
32
void
PoolTestBase::loadLibraries
(
const
std::vector<std::string>& libraries )
33
{
34
for
( std::vector<std::string>::const_iterator iLibrary = libraries.begin();
35
iLibrary != libraries.end(); ++iLibrary ) {
36
const
std::string& library = *iLibrary;
37
std::cout <<
"Loading library "
<< library << std::endl;
38
39
System::ImageHandle libhandle;
40
if
( System::loadDynamicLib(library, &libhandle) != 1 ) {
41
std::cout <<
"Error! library loading failed"
<< std::endl;
42
}
43
}
44
}
45
46
47
// Sessions created here as Tools (and managed by the ToolSvc) need to be closed by hand with closeSession() to cleanup everything
48
inline
ToolHandle<ISessionTool>
49
PoolTestBase::createSession
( Gaudi::IFileCatalog& catalog,
const
std::string& sessionName )
50
{
51
std::cout <<
"Creating the persistency service"
<< std::endl;
52
auto
dbsession = ToolHandle<ISessionTool>(
"SessionTool/"
+ sessionName, Gaudi::svcLocator()->service(
"ToolSvc"
));
53
if
( !dbsession.retrieve().isSuccess() ) {
54
throw
std::runtime_error(
"Could not create DB Session"
);
55
}
56
dbsession->setupFC( catalog );
57
return
dbsession;
58
}
59
60
#endif
ISessionTool.h
RootType.h
PoolTestBase::~PoolTestBase
virtual ~PoolTestBase()=default
PoolTestBase::loadLibraries
static void loadLibraries(const std::vector< std::string > &libraries)
load local dictionary libraries for the test
Definition
PoolTestBase.h:32
PoolTestBase::operator=
PoolTestBase & operator=(const PoolTestBase &)=delete
PoolTestBase::PoolTestBase
PoolTestBase(const PoolTestBase &)=delete
PoolTestBase::PoolTestBase
PoolTestBase()=default
PoolTestBase::createSession
ToolHandle< ISessionTool > createSession(Gaudi::IFileCatalog &fileCatalog, const std::string &sessionName)
create a session tool for the test with @sessionName, attach the catalog to it
Definition
PoolTestBase.h:49
Generated on
for ATLAS Offline Software by
1.17.0