ATLAS Offline Software
Loading...
Searching...
No Matches
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.
virtual ~PoolCollectionConverter ()
 Destructor.
StatusCode initialize ()
 Required by all Gaudi Services.
StatusCode disconnectDb ()
 Disconnect Database.
StatusCode isValid () const
 Check whether has valid pool::ICollection*.
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::ICollectionCursorm_collectionCursor

Detailed Description

This class provides an interface to POOL collections.

Definition at line 26 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").
svc[IN] pointer to the PoolSvc.
contextId[IN] id for PoolSvc persistency service to use for input.

Definition at line 28 of file PoolCollectionConverter.cxx.

31 :
32 m_collectionType(collectionType),
34 m_inputCollection(inputCollection),
35 m_contextId(contextId),
36 m_poolSvc(svc),
37 m_poolCollection(nullptr),
38 m_collectionCursor(nullptr) {
39}
pool::ICollectionCursor * m_collectionCursor
pool::ICollection * m_poolCollection

◆ ~PoolCollectionConverter()

PoolCollectionConverter::~PoolCollectionConverter ( )
virtual

Destructor.

Definition at line 41 of file PoolCollectionConverter.cxx.

41 {
42 if (m_poolCollection) {
43 m_poolCollection->close();
44 delete m_collectionCursor; m_collectionCursor = nullptr;
45 delete m_poolCollection; m_poolCollection = nullptr;
46 }
47}

◆ PoolCollectionConverter() [2/2]

PoolCollectionConverter::PoolCollectionConverter ( const PoolCollectionConverter & rhs)
private

Member Function Documentation

◆ disconnectDb()

StatusCode PoolCollectionConverter::disconnectDb ( )

Disconnect Database.

Definition at line 73 of file PoolCollectionConverter.cxx.

73 {
74 if (m_poolCollection == nullptr) {
75 return StatusCode::SUCCESS;
76 }
77 if (m_poolCollection->description().type() == pool::POOL_StorageType.type()) {
78 return m_poolSvc->disconnectDb(m_connection);
79 }
80 return StatusCode::SUCCESS;
81}
int type() const
Access to full type.
Definition DbType.h:65
static const DbType POOL_StorageType
Definition DbType.h:98

◆ initialize()

StatusCode PoolCollectionConverter::initialize ( )

Required by all Gaudi Services.

Definition at line 49 of file PoolCollectionConverter.cxx.

49 {
50 // Check if already prefixed
51 if (m_inputCollection.starts_with( "PFN:")
52 || m_inputCollection.starts_with( "LFN:")
53 || m_inputCollection.starts_with( "FID:")) {
54 // Already prefixed
56 } else {
57 // Prefix with PFN:
58 m_connection = std::format("PFN:{}", m_inputCollection);
59 }
60 try {
61 if (m_collectionType == "RootCollection") {
63 }
64 if (m_poolCollection == nullptr) { // Open as ImplicitCollection if technologies fail, or none was specified
66 }
67 } catch (std::exception &e) {
68 if (m_poolCollection == nullptr) return StatusCode::RECOVERABLE;
69 }
70 return StatusCode::SUCCESS;
71}
static const DbType ROOT_StorageType
Definition DbType.h:99

◆ isValid()

StatusCode PoolCollectionConverter::isValid ( ) const

Check whether has valid pool::ICollection*.

Definition at line 83 of file PoolCollectionConverter.cxx.

83 {
84 return m_poolCollection != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE;
85}

◆ operator=()

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

◆ selectAll()

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

Definition at line 87 of file PoolCollectionConverter.cxx.

87 {
88 delete m_collectionCursor; m_collectionCursor = nullptr;
90 return *m_collectionCursor;
91}

Member Data Documentation

◆ m_collectionCursor

pool::ICollectionCursor* PoolCollectionConverter::m_collectionCursor
private

Definition at line 61 of file PoolCollectionConverter.h.

◆ m_collectionType

std::string PoolCollectionConverter::m_collectionType
private

Definition at line 55 of file PoolCollectionConverter.h.

◆ m_connection

std::string PoolCollectionConverter::m_connection
private

Definition at line 56 of file PoolCollectionConverter.h.

◆ m_contextId

unsigned int PoolCollectionConverter::m_contextId
private

Definition at line 58 of file PoolCollectionConverter.h.

◆ m_inputCollection

std::string PoolCollectionConverter::m_inputCollection
private

Definition at line 57 of file PoolCollectionConverter.h.

◆ m_poolCollection

pool::ICollection* PoolCollectionConverter::m_poolCollection
private

Definition at line 60 of file PoolCollectionConverter.h.

◆ m_poolSvc

const IPoolSvc* PoolCollectionConverter::m_poolSvc
private

Definition at line 59 of file PoolCollectionConverter.h.


The documentation for this class was generated from the following files: