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"
20
21// Gaudi
22#include "GaudiKernel/StatusCode.h"
23
24#include <exception>
25#include <format>
26
27//______________________________________________________________________________
28PoolCollectionConverter::PoolCollectionConverter(const std::string& collectionType,
29 const std::string& inputCollection,
30 unsigned int contextId,
31 const IPoolSvc* svc) :
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}
40//______________________________________________________________________________
48//______________________________________________________________________________
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}
72//______________________________________________________________________________
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}
82//______________________________________________________________________________
84 return m_poolCollection != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE;
85}
86//______________________________________________________________________________
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:99
static const DbType POOL_StorageType
Definition DbType.h:98