ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PoolCollectionConverter Class Reference

This class provides an interface to POOL collections. More...

#include <PoolCollectionConverter.h>

Collaboration diagram for PoolCollectionConverter:

Public Member Functions

 PoolCollectionConverter (const std::string &collectionType, const std::string &inputCollection, unsigned int contextId, const IPoolSvc *svc)
 Constructor. More...
 
virtual ~PoolCollectionConverter ()
 Destructor. More...
 
StatusCode initialize ()
 Required by all Gaudi Services. More...
 
StatusCode disconnectDb ()
 Disconnect Database. More...
 
StatusCode isValid () const
 Check whether has valid pool::ICollection*. More...
 
pool::ICollectionCursorselectAll ()
 

Private Member Functions

 PoolCollectionConverter (const PoolCollectionConverter &rhs)
 
PoolCollectionConverteroperator= (const PoolCollectionConverter &rhs)
 

Private Attributes

std::string m_collectionType
 
std::string m_connection
 
std::string m_inputCollection
 
unsigned int m_contextId
 
const IPoolSvcm_poolSvc
 
pool::ICollectionm_poolCollection
 
pool::ICollectionQuerym_collectionQuery
 
std::string m_inputContainer
 

Detailed Description

This class provides an interface to POOL collections.

Definition at line 27 of file PoolCollectionConverter.h.

Constructor & Destructor Documentation

◆ PoolCollectionConverter() [1/2]

PoolCollectionConverter::PoolCollectionConverter ( const std::string &  collectionType,
const std::string &  inputCollection,
unsigned int  contextId,
const IPoolSvc svc 
)

Constructor.

Parameters
collectionType[IN] type of the collection ("RootCollection", or "ImplicitCollection").
inputCollection[IN] name of the collection.
svc[IN] pointer to the PoolSvc.
contextId[IN] id for PoolSvc persistency service to use for input.

Definition at line 31 of file PoolCollectionConverter.cxx.

34  :
35  m_collectionType(collectionType),
36  m_connection(),
37  m_inputCollection(inputCollection),
38  m_contextId(contextId),
39  m_poolSvc(svc),
40  m_poolCollection(nullptr),
41  m_collectionQuery(nullptr),
43 }

◆ ~PoolCollectionConverter()

PoolCollectionConverter::~PoolCollectionConverter ( )
virtual

Destructor.

Definition at line 45 of file PoolCollectionConverter.cxx.

45  {
46  if (m_poolCollection) {
48  delete m_collectionQuery; m_collectionQuery = nullptr;
49  delete m_poolCollection; m_poolCollection = nullptr;
50  }
51 }

◆ PoolCollectionConverter() [2/2]

PoolCollectionConverter::PoolCollectionConverter ( const PoolCollectionConverter rhs)
private

Member Function Documentation

◆ disconnectDb()

StatusCode PoolCollectionConverter::disconnectDb ( )

Disconnect Database.

Definition at line 96 of file PoolCollectionConverter.cxx.

96  {
97  if (m_poolCollection == nullptr) {
98  return StatusCode::SUCCESS;
99  }
100  if (m_poolCollection->description().type() == "ImplicitCollection") {
102  }
103  return StatusCode::SUCCESS;
104 }

◆ initialize()

StatusCode PoolCollectionConverter::initialize ( )

Required by all Gaudi Services.

Definition at line 53 of file PoolCollectionConverter.cxx.

53  {
54  // Find out if the user specified a container
55  const std::string collectionType = m_collectionType;
56  std::string::size_type p_colon = collectionType.rfind(':');
57  if (p_colon != std::string::npos) {
58  m_inputContainer = collectionType.substr(p_colon + 1);
59  m_collectionType = collectionType.substr(0, p_colon);
60  }
61  if (m_collectionType == "ImplicitCollection") {
62  // Check if already prefixed
63  if (m_inputCollection.starts_with( "PFN:")
64  || m_inputCollection.starts_with( "LFN:")
65  || m_inputCollection.starts_with( "FID:")) {
66  // Already prefixed
68  } else {
69  // Prefix with PFN:
71  }
72  try {
74  } catch (std::exception &e) {
75  m_poolCollection = nullptr;
76  }
77  if (m_poolCollection == nullptr) {
78  // Now set where to look in the implicit file
79  m_inputCollection = std::format("{}(DataHeader)", m_inputContainer);
80  }
81  }
82  try {
83  if (m_poolCollection == nullptr) {
85  }
86  if (m_poolCollection == nullptr && m_collectionType == "ImplicitCollection") {
89  }
90  } catch (std::exception &e) {
91  return StatusCode::RECOVERABLE;
92  }
93  return StatusCode::SUCCESS;
94 }

◆ isValid()

StatusCode PoolCollectionConverter::isValid ( ) const

Check whether has valid pool::ICollection*.

Definition at line 106 of file PoolCollectionConverter.cxx.

106  {
107  return m_poolCollection != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE;
108 }

◆ operator=()

PoolCollectionConverter& PoolCollectionConverter::operator= ( const PoolCollectionConverter rhs)
private

◆ selectAll()

pool::ICollectionCursor & PoolCollectionConverter::selectAll ( )
Returns
ICollectionCursor over all entries

Definition at line 110 of file PoolCollectionConverter.cxx.

110  {
111  delete m_collectionQuery; m_collectionQuery = nullptr;
114  return m_collectionQuery->execute();
115 }

Member Data Documentation

◆ m_collectionQuery

pool::ICollectionQuery* PoolCollectionConverter::m_collectionQuery
private

Definition at line 63 of file PoolCollectionConverter.h.

◆ m_collectionType

std::string PoolCollectionConverter::m_collectionType
private

Definition at line 57 of file PoolCollectionConverter.h.

◆ m_connection

std::string PoolCollectionConverter::m_connection
private

Definition at line 58 of file PoolCollectionConverter.h.

◆ m_contextId

unsigned int PoolCollectionConverter::m_contextId
private

Definition at line 60 of file PoolCollectionConverter.h.

◆ m_inputCollection

std::string PoolCollectionConverter::m_inputCollection
private

Definition at line 59 of file PoolCollectionConverter.h.

◆ m_inputContainer

std::string PoolCollectionConverter::m_inputContainer
private

Definition at line 64 of file PoolCollectionConverter.h.

◆ m_poolCollection

pool::ICollection* PoolCollectionConverter::m_poolCollection
private

Definition at line 62 of file PoolCollectionConverter.h.

◆ m_poolSvc

const IPoolSvc* PoolCollectionConverter::m_poolSvc
private

Definition at line 61 of file PoolCollectionConverter.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
PoolCollectionConverter::m_contextId
unsigned int m_contextId
Definition: PoolCollectionConverter.h:60
vtune_athena.format
format
Definition: vtune_athena.py:14
PoolCollectionConverter::m_connection
std::string m_connection
Definition: PoolCollectionConverter.h:58
pool::ICollectionQuery::execute
virtual pool::ICollectionCursor & execute()=0
Processes the query and returns a cursor over the query result.
pool::ICollection::close
virtual void close()=0
Closes the collection and terminates any database connections.
PoolCollectionConverter::m_collectionType
std::string m_collectionType
Definition: PoolCollectionConverter.h:57
pool::ICollectionDescription::type
virtual const std::string & type() const =0
Returns the storage technology type of the collection.
pool::ICollectionQuery::selectAll
virtual void selectAll()=0
Adds all Token and Attribute columns to the query select list.
PoolCollectionConverter::m_inputCollection
std::string m_inputCollection
Definition: PoolCollectionConverter.h:59
PoolCollectionConverter::m_inputContainer
std::string m_inputContainer
Definition: PoolCollectionConverter.h:64
pool::ICollection::newQuery
virtual ICollectionQuery * newQuery()=0
Returns an object used to query the collection.
PoolCollectionConverter::m_poolSvc
const IPoolSvc * m_poolSvc
Definition: PoolCollectionConverter.h:61
calibdata.exception
exception
Definition: calibdata.py:495
pool::ICollection::description
virtual const ICollectionDescription & description() const =0
Returns an object used to describe the collection properties.
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
PoolCollectionConverter::m_collectionQuery
pool::ICollectionQuery * m_collectionQuery
Definition: PoolCollectionConverter.h:63
PoolCollectionConverter::m_poolCollection
pool::ICollection * m_poolCollection
Definition: PoolCollectionConverter.h:62
IPoolSvc::disconnectDb
virtual StatusCode disconnectDb(const std::string &connection, unsigned int contextId=IPoolSvc::kInputStream) const =0
Disconnect single Database.
IPoolSvc::createCollection
virtual pool::ICollection * createCollection(const std::string &collectionType, const std::string &connection, const std::string &collectionName, unsigned int contextId=IPoolSvc::kInputStream) const =0