ATLAS Offline Software
Loading...
Searching...
No Matches
PoolCollectionConverter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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 <stdexcept>
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),
33 m_inputCollection(inputCollection),
34 m_contextId(contextId),
35 m_poolSvc(svc),
36 m_poolCollection(nullptr) {
37}
38//______________________________________________________________________________
45//______________________________________________________________________________
47 // Check if already prefixed
48 if (!m_inputCollection.starts_with( "PFN:")
49 && !m_inputCollection.starts_with( "LFN:")
50 && !m_inputCollection.starts_with( "FID:")) {
51 // Prefix with PFN:
52 m_inputCollection = std::format("PFN:{}", m_inputCollection);
53 }
54 try {
55 if (m_collectionType == "RootCollection") {
57 }
58 if (m_poolCollection == nullptr) { // Open as ImplicitCollection if technologies fail, or none was specified
60 }
61 } catch (std::exception &e) {
62 if (m_poolCollection == nullptr) return StatusCode::RECOVERABLE;
63 }
64 return StatusCode::SUCCESS;
65}
66//______________________________________________________________________________
68 if (m_poolCollection == nullptr) {
69 return StatusCode::SUCCESS;
70 }
71 if (m_poolCollection->description().type() == pool::POOL_StorageType.type()) {
72 return m_poolSvc->disconnectDb(m_inputCollection);
73 }
74 return StatusCode::SUCCESS;
75}
76//______________________________________________________________________________
78 return m_poolCollection != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE;
79}
80//______________________________________________________________________________
82 if (m_poolCollection == nullptr)[[unlikely]] {
83 throw std::runtime_error("PoolCollectionConverter::selectAll: m_poolCollection is nullptr.");
84 }
86 return *m_collectionCursor;
87}
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::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.
std::unique_ptr< pool::ICollectionCursor > m_collectionCursor
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
#define unlikely(x)