ATLAS Offline Software
Loading...
Searching...
No Matches
PoolCollectionConverter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
9
11#include "PoolSvc/IPoolSvc.h"
13
14// Pool
18#include "StorageSvc/DbType.h"
19
20// Gaudi
21#include "GaudiKernel/StatusCode.h"
22
23#include <exception>
24#include <format>
25
26//______________________________________________________________________________
27PoolCollectionConverter::PoolCollectionConverter(const std::string& collectionType,
28 const std::string& inputCollection,
29 unsigned int contextId,
30 const IPoolSvc* svc) :
31 m_collectionType(collectionType),
33 m_inputCollection(inputCollection),
34 m_contextId(contextId),
35 m_poolSvc(svc),
36 m_poolCollection(nullptr),
37 m_collectionCursor(nullptr) {
38}
39//______________________________________________________________________________
47//______________________________________________________________________________
49 // Check if already prefixed
50 if (m_inputCollection.starts_with( "PFN:")
51 || m_inputCollection.starts_with( "LFN:")
52 || m_inputCollection.starts_with( "FID:")) {
53 // Already prefixed
55 } else {
56 // Prefix with PFN:
57 m_connection = std::format("PFN:{}", m_inputCollection);
58 }
59 try {
60 if (m_collectionType == "RootCollection") {
62 }
63 if (m_poolCollection == nullptr) { // Open as ImplicitCollection if technologies fail, or none was specified
65 }
66 } catch (std::exception &e) {
67 if (m_poolCollection == nullptr) return StatusCode::RECOVERABLE;
68 }
69 return StatusCode::SUCCESS;
70}
71//______________________________________________________________________________
73 if (m_poolCollection == nullptr) {
74 return StatusCode::SUCCESS;
75 }
76 if (m_poolCollection->description().type() == pool::POOL_StorageType.type()) {
77 return m_poolSvc->disconnectDb(m_connection);
78 }
79 return StatusCode::SUCCESS;
80}
81//______________________________________________________________________________
83 return m_poolCollection != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE;
84}
85//______________________________________________________________________________
This file contains the class definition for the IPoolSvc interface class.
This file contains the class definition for the PoolCollectionConverter class.
This file contains the class definition for the Token class (migrated from POOL).
This class provides the interface to the LCG POOL persistency software.
Definition IPoolSvc.h:36
StatusCode disconnectDb()
Disconnect Database.
pool::ICollectionCursor * m_collectionCursor
pool::ICollection * m_poolCollection
StatusCode isValid() const
Check whether has valid pool::ICollection*.
PoolCollectionConverter(const std::string &collectionType, const std::string &inputCollection, unsigned int contextId, const IPoolSvc *svc)
Constructor.
pool::ICollectionCursor & selectAll()
virtual ~PoolCollectionConverter()
Destructor.
StatusCode initialize()
Required by all Gaudi Services.
An interface used to navigate the result of a query on a collection.
static const DbType ROOT_StorageType
Definition DbType.h:85
static const DbType POOL_StorageType
Definition DbType.h:84