| The Gaudi Framework v32r1 (f65d50dc)

Public Types | Public Member Functions | Protected Types | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Gaudi::MultiFileCatalog Class Reference

This class constitutes the core of the XML based FileCatalog API for using POOL within Gaudi. More...

`#include <src/component/MultiFileCatalog.h>`

Inheritance diagram for Gaudi::MultiFileCatalog:
[legend]
Collaboration diagram for Gaudi::MultiFileCatalog:
[legend]

## Public Types
typedef Service::Factory | Factory
Public Types inherited from extends< Service, IFileCatalog, IFileCatalogMgr >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
using | Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## Public Member Functions
StatusCode | initialize () override
| IService implementation. More...
StatusCode | finalize () override
| Finalize service object. More...
std::string | createFID () const override
| Catalog interface. More...
CSTR | connectInfo () const override
| Access to connect string. More...
void | init () override
| Parse the DOM tree of the XML catalog. More...
void | commit () override
| Save DOM catalog to file. More...
void | rollback () override
| Save DOM catalog to file. More...
bool | readOnly () const override
| Check if the catalog is read-only. More...
bool | dirty () const override
| Check if the catalog should be updated. More...
bool | existsPFN (CSTR pfn) const override
| Return the status of physical file name. More...
std::string | lookupPFN (CSTR pfn) const override
| Lookup file identifier by physical file name. More...
bool | existsLFN (CSTR lfn) const override
| Return the status of a logical file name. More...
std::string | lookupLFN (CSTR lfn) const override
| Lookup file identifier by logical file name. More...
bool | existsFID (CSTR fid) const override
| Return the status of a FileID. More...
void | getPFN (CSTR fid, Files &files) const override
| Dump all physical file names of the catalog and their attributes associate to the FileID. More...
void | getLFN (CSTR fid, Files &files) const override
| Dump all logical file names of the catalog associate to the FileID. More...
void | getFID (Strings &fids) const override
| Dump all file Identifiers. More...
void | deleteFID (CSTR fid) const override
| Delete FileID from the catalog. More...
void | registerPFN (CSTR fid, CSTR pfn, CSTR ftype) const override
| Create a FileID and DOM Node of the PFN with all the attributes. More...
void | registerLFN (CSTR fid, CSTR lfn) const override
| Create a FileID and DOM Node of the LFN with all the attributes. More...
void | registerFID (CSTR fid) const override
| Create a FileID and DOM Node. More...
void | renamePFN (CSTR pfn, CSTR newpfn) const override
| rename a PFN More...
void | deletePFN (CSTR pfn) const override
| remove a PFN More...
void | getMetaData (CSTR fid, Attributes &attr) const override
| Dump all MetaData of the catalog for a given file ID. More...
std::string | getMetaDataItem (CSTR fid, CSTR name) const override
| Access metadata item. More...
void | setMetaData (CSTR fid, CSTR attr, CSTR val) const override
| Insert/update metadata item. More...
void | dropMetaData (CSTR fid) const override
| Drop all metadata of one FID. More...
void | dropMetaData (CSTR fid, CSTR attr) const override
| Drop specified metadata item. More...
IFileCatalog * | findCatalog (CSTR connect, bool must_be_writable) const override
| Catalog management. More...
void | addCatalog (CSTR connect) override
| Add new catalog identified by name to the existing ones. More...
void | addCatalog (IFileCatalog *cat) override
| Add new catalog identified by reference to the existing ones. More...
void | removeCatalog (CSTR connect) override
| Remove catalog identified by name from the existing ones. More...
void | removeCatalog (const IFileCatalog *cat) override
| Remove catalog identified by reference from the existing ones. More...
Catalogs & | catalogs () override
| Access catalog container. More...
const Catalogs & | catalogs () const override
| Access catalog container (CONST) More...
IFileCatalog * | writeCatalog (CSTR fid="") const override
| Access to the (first) writable file catalog. More...
void | setWriteCatalog (IFileCatalog *cat) override
| Define the writable catalog identified by reference. More...
void | setWriteCatalog (CSTR connect) override
| Define the writable catalog identified by name. More...
Public Member Functions inherited from extends< Service, IFileCatalog, IFileCatalogMgr >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
StatusCode | declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
| Declare used tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const
| Backward compatibility function for getting the output level. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
const SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...

## Protected Types
typedef const std::string & | CSTR
typedef std::vector< IFileCatalog * > | Catalogs
typedef std::vector< std::string > | CatalogNames

## Protected Member Functions
template<class A1 , class F >
std::string | _find (A1 &arg1, F pmf) const
template<class A1 , class F >
void | _collect (A1 &arg1, F f) const
template<class A2 , class A1 , class F >
void | _collect (const A2 &arg2, A1 &arg1, F f) const
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level | setUpMessaging () const
| Set up local caches. More...
MSG::Level | resetMessaging ()
| Reinitialize internal states. More...
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Private Member Functions
IFileCatalog * | getCatalog (CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
| Find catalog containing a given file identifier. More...
Catalogs::iterator | i_findCatalog (CSTR connect, bool must_be_writable)
| Find catalog by connect string. More...
void | propHandler ()
| simple property handle to allow interactive modification of list of the file catalogs More...
void | printError (CSTR msg, bool throw_exc=true) const
std::string | lookupFID (CSTR lfn) const

## Private Attributes
Catalogs | m_catalogs
| Container with references to known catalogs. More...
Gaudi::Property< CatalogNames > | m_catalogNames
bool | m_started = false
| Flag to indicate if catalog is started. More...
CatalogNames | m_oldNames
| BACKUP:: Container with catalog names. More...

## Additional Inherited Members
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, " unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## Detailed Description

This class constitutes the core of the XML based FileCatalog API for using POOL within Gaudi.

This class manages multiple file catalogs.

Definition at line 20 of file MultiFileCatalog.h.

## Member Typedef Documentation

## ◆ CatalogNames

typedef std::vector<std::string> Gaudi::MultiFileCatalog::CatalogNames
| protected

Definition at line 28 of file MultiFileCatalog.h.

## ◆ Catalogs

typedef std::vector<IFileCatalog*> Gaudi::MultiFileCatalog::Catalogs
| protected

Definition at line 27 of file MultiFileCatalog.h.

## ◆ CSTR

typedef const std::string& Gaudi::MultiFileCatalog::CSTR
| protected

Definition at line 26 of file MultiFileCatalog.h.

## ◆ Factory

typedef Service::Factory Gaudi::MultiFileCatalog::Factory

Definition at line 23 of file MultiFileCatalog.h.

## Member Function Documentation

## ◆ _collect() [1/2]

template<class A1 , class F >

void Gaudi::MultiFileCatalog::_collect | ( | A1 & | arg1,
|  | F | f
| ) |  | const
| inline protected

Definition at line 40 of file MultiFileCatalog.h.

40 {
41 A1 tmp;
42 for ( const auto& i : m_catalogs ) {
43 f( i, tmp ); // tmp = f(i)
44 arg1.insert( arg1.end(), tmp.begin(), tmp.end() );
45 tmp.clear();
46 }
47 }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167

## ◆ _collect() [2/2]

template<class A2 , class A1 , class F >

void Gaudi::MultiFileCatalog::_collect | ( | const A2 & | arg2,
|  | A1 & | arg1,
|  | F | f
| ) |  | const
| inline protected

Definition at line 49 of file MultiFileCatalog.h.

49 {
50 A1 tmp;
51 for ( const auto& i : m_catalogs ) {
52 f( i, arg2, tmp ); // tmp = f(i,arg2)
53 arg1.insert( arg1.end(), tmp.begin(), tmp.end() );
54 tmp.clear();
55 }
56 }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167

## ◆ _find()

template<class A1 , class F >

std::string Gaudi::MultiFileCatalog::_find | ( | A1 & | arg1,
|  | F | pmf
| ) |  | const
| inline protected

Definition at line 31 of file MultiFileCatalog.h.

31 {
32 std::string result;
33 for ( const auto& i : m_catalogs ) {
34 result = ( i->*pmf )( arg1 );
35 if ( !result.empty() ) break;
36 }
37 return result;
38 }
std::string::empty
T empty(T... args)
std::string
STL class.
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167

## ◆ addCatalog() [1/2]

void MultiFileCatalog::addCatalog | ( | CSTR | connect | ) |
| override

Add new catalog identified by name to the existing ones.

Catalog is already present ... silently ignore request

Definition at line 90 of file MultiFileCatalog.cpp.

90 {
91 if ( !con.empty() ) {
92 if ( !findCatalog( con, false ) ) {
93 static const string xml_typ = "Gaudi::XMLFileCatalog";
94 auto id0 = con.find( "_" );
95 string typ = con.substr( 0, id0 );
96 string url = con.substr( id0 + 1 );
97 IInterface* cat = nullptr;
98 if ( strncasecmp( "xml", typ.c_str(), 3 ) == 0 ) {
99 cat = IFileCatalog::Factory::create( xml_typ, url, msgSvc().get() ).release();
100 } else {
101 using Gaudi::PluginService::Details::Registry;
102 Registry& registry = Registry::instance();
103 if ( registry.getInfo( typ ).factory.type() == typeid( Service::Factory::FactoryType ) ) {
104 cat = Service::Factory::create( typ, url, serviceLocator().get() ).release();
105 } else if ( registry.getInfo( typ ).factory.type() == typeid( IFileCatalog::Factory::FactoryType ) ) {
106 cat = IFileCatalog::Factory::create( typ, url, msgSvc().get() ).release();
107 }
108 }
109 if ( cat ) {
110 auto fileCat = SmartIF<IFileCatalog>( cat );
111 if ( fileCat ) {
112 addCatalog( fileCat.get() ); // addCatalog will take care of the refCount of fileCat...
113 return;
114 }
115 }
116 printError( "Failed to create catalog connection:" + con, true );
117 }
119 return;
120 }
121 printError( "Got invalid (empty) catalog connection string.", true );
122 }
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:15
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
Gaudi::MultiFileCatalog::findCatalog
IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const override
Catalog management.
Definition: MultiFileCatalog.cpp:69
CommonMessagingBase::msgSvc
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:68
IInterface
Definition of the basic interface.
Definition: IInterface.h:244
GaudiPluginService.cpluginsvc.registry
def registry()
Definition: cpluginsvc.py:71
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:82
Gaudi::Functional::details::get
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Definition: FunctionalDetails.h:332
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
std::string::c_str
T c_str(T... args)
Gaudi::MultiFileCatalog::addCatalog
void addCatalog(CSTR connect) override
Add new catalog identified by name to the existing ones.
Definition: MultiFileCatalog.cpp:90

## ◆ addCatalog() [2/2]

void MultiFileCatalog::addCatalog | ( | IFileCatalog * | cat | ) |
| override

Add new catalog identified by reference to the existing ones.

Definition at line 124 of file MultiFileCatalog.cpp.

124 {
125 if ( cat ) {
126 cat->addRef();
127 m_catalogs.push_back( cat );
128 return;
129 }
130 printError( "Got invalid catalog to be added to multi catalog.", true );
131 }
std::vector::push_back
T push_back(T... args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:82
IInterface::addRef
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.

## ◆ catalogs() [1/2]

Catalogs& Gaudi::MultiFileCatalog::catalogs | ( |  | ) |
| inline override

Access catalog container.

Definition at line 143 of file MultiFileCatalog.h.

143 { return m_catalogs; }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167

## ◆ catalogs() [2/2]

const Catalogs& Gaudi::MultiFileCatalog::catalogs | ( |  | ) | const
| inline override

Access catalog container (CONST)

Definition at line 145 of file MultiFileCatalog.h.

145 { return m_catalogs; }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167

## ◆ commit()

void MultiFileCatalog::commit | ( |  | ) |
| override

Save DOM catalog to file.

Definition at line 217 of file MultiFileCatalog.cpp.

217 {
218 for_each( m_catalogs, []( IFileCatalog* i ) { i->commit(); } );
219 }
Gaudi::IFileCatalog::commit
virtual void commit()=0
Save catalog to file.
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
std::for_each
T for_each(T... args)

## ◆ connectInfo()

MultiFileCatalog::CSTR MultiFileCatalog::connectInfo | ( |  | ) | const
| override

Access to connect string.

Definition at line 51 of file MultiFileCatalog.cpp.

51 {
52 static const string s( "MultiCatalog" );
53 return s;
54 }
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ createFID()

std::string MultiFileCatalog::createFID | ( |  | ) | const
| override

Catalog interface.

Create file identifier using UUID mechanism.

Create file identifier using UUID mechanism

Definition at line 49 of file MultiFileCatalog.cpp.

49 { return createGuidAsString(); }
Gaudi::createGuidAsString
std::string createGuidAsString()
Helper function creating file identifier using the UUID mechanism.

## ◆ deleteFID()

void Gaudi::MultiFileCatalog::deleteFID | ( | CSTR | fid | ) | const
| inline override

Delete FileID from the catalog.

Definition at line 105 of file MultiFileCatalog.h.

105 { writeCatalog( fid )->deleteFID( fid ); }
Gaudi::IFileCatalog::deleteFID
virtual void deleteFID(const std::string &FileID) const =0
Delete FileID Node from the catalog.
Gaudi::MultiFileCatalog::writeCatalog
IFileCatalog * writeCatalog(CSTR fid="") const override
Access to the (first) writable file catalog.
Definition: MultiFileCatalog.h:147

## ◆ deletePFN()

void Gaudi::MultiFileCatalog::deletePFN | ( | CSTR | pfn | ) | const
| inline override

remove a PFN

Definition at line 115 of file MultiFileCatalog.h.

115 { writeCatalog()->deletePFN( pfn ); }
Gaudi::IFileCatalog::deletePFN
virtual void deletePFN(const std::string &pfn) const =0
remove a PFN
Gaudi::MultiFileCatalog::writeCatalog
IFileCatalog * writeCatalog(CSTR fid="") const override
Access to the (first) writable file catalog.
Definition: MultiFileCatalog.h:147

## ◆ dirty()

bool MultiFileCatalog::dirty | ( |  | ) | const
| override

Check if the catalog should be updated.

Definition at line 207 of file MultiFileCatalog.cpp.

207 {
208 return std::any_of( std::begin( m_catalogs ), std::end( m_catalogs ),
209 []( const IFileCatalog* i ) { return i->dirty(); } );
210 }
std::end
T end(T... args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
std::begin
T begin(T... args)
std::any_of
T any_of(T... args)
Gaudi::IFileCatalog::dirty
virtual bool dirty() const =0
Check if the catalog should be updated.

## ◆ dropMetaData() [1/2]

void Gaudi::MultiFileCatalog::dropMetaData | ( | CSTR | fid | ) | const
| inline override

Drop all metadata of one FID.

Definition at line 127 of file MultiFileCatalog.h.

127 { writeCatalog( fid )->dropMetaData( fid ); }
Gaudi::IFileCatalog::dropMetaData
virtual void dropMetaData(const std::string &fid) const =0
Drop all metadata of one FID.
Gaudi::MultiFileCatalog::writeCatalog
IFileCatalog * writeCatalog(CSTR fid="") const override
Access to the (first) writable file catalog.
Definition: MultiFileCatalog.h:147

## ◆ dropMetaData() [2/2]

void Gaudi::MultiFileCatalog::dropMetaData | ( | CSTR | fid,
|  | CSTR | attr
| ) |  | const
| inline override

Drop specified metadata item.

Definition at line 129 of file MultiFileCatalog.h.

129 { writeCatalog( fid )->dropMetaData( fid, attr ); }
Gaudi::IFileCatalog::dropMetaData
virtual void dropMetaData(const std::string &fid) const =0
Drop all metadata of one FID.
Gaudi::MultiFileCatalog::writeCatalog
IFileCatalog * writeCatalog(CSTR fid="") const override
Access to the (first) writable file catalog.
Definition: MultiFileCatalog.h:147

## ◆ existsFID()

bool Gaudi::MultiFileCatalog::existsFID | ( | CSTR | fid | ) | const
| inline override

Return the status of a FileID.

Definition at line 92 of file MultiFileCatalog.h.

92 { return 0 != getCatalog( fid, false, false, false ); }
Gaudi::MultiFileCatalog::getCatalog
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
Definition: MultiFileCatalog.cpp:56

## ◆ existsLFN()

bool Gaudi::MultiFileCatalog::existsLFN | ( | CSTR | lfn | ) | const
| inline override

Return the status of a logical file name.

Definition at line 88 of file MultiFileCatalog.h.

88 { return !lookupLFN( lfn ).empty(); }
std::string::empty
T empty(T... args)
Gaudi::MultiFileCatalog::lookupLFN
std::string lookupLFN(CSTR lfn) const override
Lookup file identifier by logical file name.
Definition: MultiFileCatalog.h:90

## ◆ existsPFN()

bool Gaudi::MultiFileCatalog::existsPFN | ( | CSTR | pfn | ) | const
| inline override

Return the status of physical file name.

Definition at line 84 of file MultiFileCatalog.h.

84 { return !lookupPFN( pfn ).empty(); }
std::string::empty
T empty(T... args)
Gaudi::MultiFileCatalog::lookupPFN
std::string lookupPFN(CSTR pfn) const override
Lookup file identifier by physical file name.
Definition: MultiFileCatalog.h:86

## ◆ finalize()

StatusCode MultiFileCatalog::finalize | ( |  | ) |
| override

Finalize service object.

Definition at line 40 of file MultiFileCatalog.cpp.

40 {
41 commit();
42 for_each( m_catalogs, []( IFileCatalog* i ) { i->release(); } );
43 m_catalogs.clear();
44 m_started = false;
45 return Service::finalize();
46 }
Gaudi::MultiFileCatalog::m_started
bool m_started
Flag to indicate if catalog is started.
Definition: MultiFileCatalog.h:173
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:164
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
std::vector::clear
T clear(T... args)
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
std::for_each
T for_each(T... args)
Gaudi::MultiFileCatalog::commit
void commit() override
Save DOM catalog to file.
Definition: MultiFileCatalog.cpp:217

## ◆ findCatalog()

IFileCatalog * MultiFileCatalog::findCatalog | ( | CSTR | connect,
|  | bool | must_be_writable
| ) |  | const
| override

Catalog management.

Find catalog by connect string

Definition at line 69 of file MultiFileCatalog.cpp.

69 {
70 auto i = std::find_if( m_catalogs.begin(), m_catalogs.end(),
71 [&]( const IFileCatalog* f ) { return connect == f->connectInfo(); } );
72 return ( i != m_catalogs.end() && ( !must_be_writable || !( *i )->readOnly() ) ) ? *i : nullptr;
73 }
std::vector::end
T end(T... args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
std::find_if
T find_if(T... args)
std::vector::begin
T begin(T... args)

## ◆ getCatalog()

IFileCatalog * MultiFileCatalog::getCatalog | ( | CSTR | fid,
|  | bool | throw_if_not,
|  | bool | writable = `true`,
|  | bool | prt = `true`
| ) |  | const
| private

Find catalog containing a given file identifier.

Definition at line 56 of file MultiFileCatalog.cpp.

56 {
57 for ( const auto& c : m_catalogs ) {
58 if ( !c || ( writable && c->readOnly() ) ) continue;
59 if ( fid.empty() || ( !fid.empty() && c->existsFID( fid ) ) ) return c;
60 }
61 if ( prt ) {
62 printError( "No writable file catalog found which contains FID:" + fid, throw_if_not );
63 } else {
64 debug() << "No writable file catalog found which contains FID:" << fid << endmsg;
65 }
66 return nullptr;
67 }
std::string::empty
T empty(T... args)
gaudirun.c
c
Definition: gaudirun.py:487
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:107
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:82
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ getFID()

void Gaudi::MultiFileCatalog::getFID | ( | Strings & | fids | ) | const
| inline override

Dump all file Identifiers.

Definition at line 103 of file MultiFileCatalog.h.

103 { _collect( fids, std::mem_fn( &IFileCatalog::getFID ) ); }
Gaudi::IFileCatalog::getFID
virtual void getFID(Strings &fids) const =0
Dump all file Identifiers.
Gaudi::MultiFileCatalog::_collect
void _collect(A1 &arg1, F f) const
Definition: MultiFileCatalog.h:40
std::mem_fn
T mem_fn(T... args)

## ◆ getLFN()

void Gaudi::MultiFileCatalog::getLFN | ( | CSTR | fid,
|  | Files & | files
| ) |  | const
| inline override

Dump all logical file names of the catalog associate to the FileID.

Definition at line 98 of file MultiFileCatalog.h.

98 {
99 _collect( fid, files, std::mem_fn( &IFileCatalog::getLFN ) );
100 }
Gaudi::IFileCatalog::getLFN
virtual void getLFN(const std::string &fid, Files &files) const =0
Dump all LFNames of the catalog associate to the FileID.
Gaudi::MultiFileCatalog::_collect
void _collect(A1 &arg1, F f) const
Definition: MultiFileCatalog.h:40
std::mem_fn
T mem_fn(T... args)

## ◆ getMetaData()

void Gaudi::MultiFileCatalog::getMetaData | ( | CSTR | fid,
|  | Attributes & | attr
| ) |  | const
| inline override

Dump all MetaData of the catalog for a given file ID.

Definition at line 117 of file MultiFileCatalog.h.

117 {
118 _collect( fid, attr, std::mem_fn( &IFileCatalog::getMetaData ) );
119 }
Gaudi::IFileCatalog::getMetaData
virtual void getMetaData(const std::string &fid, Attributes &attr) const =0
Dump all MetaData of the catalog for a given file ID.
Gaudi::MultiFileCatalog::_collect
void _collect(A1 &arg1, F f) const
Definition: MultiFileCatalog.h:40
std::mem_fn
T mem_fn(T... args)

## ◆ getMetaDataItem()

string MultiFileCatalog::getMetaDataItem | ( | CSTR | fid,
|  | CSTR | name
| ) |  | const
| override

Access metadata item.

Definition at line 181 of file MultiFileCatalog.cpp.

181 {
182 std::string result;
183 for ( const auto& i : m_catalogs ) {
184 result = i->getMetaDataItem( fid, attr );
185 if ( !result.empty() ) break;
186 }
187 return result;
188 }
std::string::empty
T empty(T... args)
std::string
STL class.
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167

## ◆ getPFN()

void Gaudi::MultiFileCatalog::getPFN | ( | CSTR | fid,
|  | Files & | files
| ) |  | const
| inline override

Dump all physical file names of the catalog and their attributes associate to the FileID.

Definition at line 94 of file MultiFileCatalog.h.

94 {
95 _collect( fid, files, std::mem_fn( &IFileCatalog::getPFN ) );
96 }
Gaudi::IFileCatalog::getPFN
virtual void getPFN(const std::string &fid, Files &files) const =0
Dump all PFNames of the catalog and their attributes associate to the FileID.
Gaudi::MultiFileCatalog::_collect
void _collect(A1 &arg1, F f) const
Definition: MultiFileCatalog.h:40
std::mem_fn
T mem_fn(T... args)

## ◆ i_findCatalog()

MultiFileCatalog::Catalogs::iterator MultiFileCatalog::i_findCatalog | ( | CSTR | connect,
|  | bool | must_be_writable
| ) |  |
| private

Find catalog by connect string.

Definition at line 75 of file MultiFileCatalog.cpp.

75 {
76 auto i = std::find_if( m_catalogs.begin(), m_catalogs.end(),
77 [&]( const IFileCatalog* f ) { return connect == f->connectInfo(); } );
78 if ( i != m_catalogs.end() && must_be_writable && ( *i )->readOnly() ) { i = m_catalogs.end(); }
79 return i;
80 }
std::vector::end
T end(T... args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
std::find_if
T find_if(T... args)
std::vector::begin
T begin(T... args)
Gaudi::IFileCatalog::readOnly
virtual bool readOnly() const =0
Check if the catalog is read-only.

## ◆ init()

void MultiFileCatalog::init | ( |  | ) |
| override

Parse the DOM tree of the XML catalog.

Definition at line 212 of file MultiFileCatalog.cpp.

212 {
213 for_each( m_catalogs, []( IFileCatalog* i ) { i->init(); } );
214 m_started = true;
215 }
Gaudi::MultiFileCatalog::m_started
bool m_started
Flag to indicate if catalog is started.
Definition: MultiFileCatalog.h:173
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
Gaudi::IFileCatalog::init
virtual void init()=0
Parse the DOM tree of the XML catalog.
std::for_each
T for_each(T... args)

## ◆ initialize()

StatusCode MultiFileCatalog::initialize | ( |  | ) |
| override

IService implementation.

Finalize service object

Definition at line 23 of file MultiFileCatalog.cpp.

23 {
24 if ( !Service::initialize().isSuccess() ) {
25 printError( "Failed to initialize service base class.", false );
26 return StatusCode::SUCCESS;
27 }
28 std::string current;
29 try {
30 for ( const auto& i : m_catalogNames ) {
31 current = i;
32 addCatalog( i );
33 }
34 init();
35 return StatusCode::SUCCESS;
36 } catch ( const std::exception& /* e */ ) { printError( "Cannot add file catalog:" + current, false ); }
37 return StatusCode::FAILURE;
38 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:60
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::string
STL class.
Gaudi::MultiFileCatalog::m_catalogNames
Gaudi::Property< CatalogNames > m_catalogNames
Definition: MultiFileCatalog.h:169
std::exception
STL class.
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:82
Gaudi::MultiFileCatalog::init
void init() override
Parse the DOM tree of the XML catalog.
Definition: MultiFileCatalog.cpp:212
Gaudi::MultiFileCatalog::addCatalog
void addCatalog(CSTR connect) override
Add new catalog identified by name to the existing ones.
Definition: MultiFileCatalog.cpp:90
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86

## ◆ lookupFID()

std::string Gaudi::MultiFileCatalog::lookupFID | ( | CSTR | lfn | ) | const
| private

## ◆ lookupLFN()

std::string Gaudi::MultiFileCatalog::lookupLFN | ( | CSTR | lfn | ) | const
| inline override

Lookup file identifier by logical file name.

Definition at line 90 of file MultiFileCatalog.h.

90 { return _find( lfn, &IFileCatalog::lookupLFN ); }
Gaudi::IFileCatalog::lookupLFN
virtual std::string lookupLFN(const std::string &lfn) const =0
Lookup file identifier by physical file name.
Gaudi::MultiFileCatalog::_find
std::string _find(A1 &arg1, F pmf) const
Definition: MultiFileCatalog.h:31

## ◆ lookupPFN()

std::string Gaudi::MultiFileCatalog::lookupPFN | ( | CSTR | pfn | ) | const
| inline override

Lookup file identifier by physical file name.

Definition at line 86 of file MultiFileCatalog.h.

86 { return _find( pfn, &IFileCatalog::lookupPFN ); }
Gaudi::MultiFileCatalog::_find
std::string _find(A1 &arg1, F pmf) const
Definition: MultiFileCatalog.h:31
Gaudi::IFileCatalog::lookupPFN
virtual std::string lookupPFN(const std::string &lfn) const =0
Lookup file identifier by physical file name.

## ◆ printError()

void MultiFileCatalog::printError | ( | CSTR | msg,
|  | bool | throw_exc = `true`
| ) |  | const
| private

Definition at line 82 of file MultiFileCatalog.cpp.

82 {
83 if ( rethrow ) {
84 fatal() << msg << endmsg;
85 throw runtime_error( "Catalog> " + msg );
86 }
87 error() << msg << endmsg;
88 }
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
std::runtime_error
STL class.
CommonMessagingBase::msg
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:113
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:92
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ propHandler()

void MultiFileCatalog::propHandler | ( |  | ) |
| private

simple property handle to allow interactive modification of list of the file catalogs

Definition at line 225 of file MultiFileCatalog.cpp.

225 {
226 // not yet initialized
227 if ( !m_started ) {
228 m_oldNames = m_catalogNames;
229 return;
230 } // RETURN
231 // no real change - no action
232 if ( m_catalogNames == m_oldNames ) { return; }
233 m_oldNames = m_catalogNames;
234 // remove ALL catalogs
235 removeCatalog( "" );
236 // add new catalogs
237 for ( const auto& inew : m_catalogNames ) addCatalog( inew );
238 // start
239 init();
240 //
241 debug() << "New catalogs to be used: " << Gaudi::Utils::toString( m_catalogNames ) << endmsg;
242 }
Gaudi::MultiFileCatalog::m_started
bool m_started
Flag to indicate if catalog is started.
Definition: MultiFileCatalog.h:173
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:334
Gaudi::MultiFileCatalog::m_catalogNames
Gaudi::Property< CatalogNames > m_catalogNames
Definition: MultiFileCatalog.h:169
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:107
Gaudi::MultiFileCatalog::m_oldNames
CatalogNames m_oldNames
BACKUP:: Container with catalog names.
Definition: MultiFileCatalog.h:175
Gaudi::MultiFileCatalog::init
void init() override
Parse the DOM tree of the XML catalog.
Definition: MultiFileCatalog.cpp:212
Gaudi::MultiFileCatalog::addCatalog
void addCatalog(CSTR connect) override
Add new catalog identified by name to the existing ones.
Definition: MultiFileCatalog.cpp:90
Gaudi::MultiFileCatalog::removeCatalog
void removeCatalog(CSTR connect) override
Remove catalog identified by name from the existing ones.
Definition: MultiFileCatalog.cpp:133
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ readOnly()

bool MultiFileCatalog::readOnly | ( |  | ) | const
| override

Check if the catalog is read-only.

Definition at line 202 of file MultiFileCatalog.cpp.

202 {
203 return std::all_of( std::begin( m_catalogs ), std::end( m_catalogs ),
204 []( const IFileCatalog* i ) { return i->readOnly(); } );
205 }
std::end
T end(T... args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
std::begin
T begin(T... args)
std::all_of
T all_of(T... args)
Gaudi::IFileCatalog::readOnly
virtual bool readOnly() const =0
Check if the catalog is read-only.

## ◆ registerFID()

void Gaudi::MultiFileCatalog::registerFID | ( | CSTR | fid | ) | const
| inline override

Create a FileID and DOM Node.

Definition at line 111 of file MultiFileCatalog.h.

111 { writeCatalog()->registerFID( fid ); }
Gaudi::IFileCatalog::registerFID
virtual void registerFID(const std::string &fid) const =0
Create a Node for a FileID and DOM Node.
Gaudi::MultiFileCatalog::writeCatalog
IFileCatalog * writeCatalog(CSTR fid="") const override
Access to the (first) writable file catalog.
Definition: MultiFileCatalog.h:147

## ◆ registerLFN()

void MultiFileCatalog::registerLFN | ( | CSTR | fid,
|  | CSTR | lfn
| ) |  | const
| override

Create a FileID and DOM Node of the LFN with all the attributes.

Definition at line 196 of file MultiFileCatalog.cpp.

196 {
197 IFileCatalog* c = getCatalog( fid, false, true, false );
198 if ( !c ) c = getCatalog( "", true, true, true );
199 c->registerLFN( fid, lfn );
200 }
Gaudi::MultiFileCatalog::getCatalog
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
Definition: MultiFileCatalog.cpp:56
gaudirun.c
c
Definition: gaudirun.py:487
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26

## ◆ registerPFN()

void MultiFileCatalog::registerPFN | ( | CSTR | fid,
|  | CSTR | pfn,
|  | CSTR | ftype
| ) |  | const
| override

Create a FileID and DOM Node of the PFN with all the attributes.

Definition at line 190 of file MultiFileCatalog.cpp.

190 {
191 IFileCatalog* c = getCatalog( fid, false, true, false );
192 if ( !c ) c = getCatalog( "", true, true, true );
193 c->registerPFN( fid, pfn, ftype );
194 }
Gaudi::MultiFileCatalog::getCatalog
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
Definition: MultiFileCatalog.cpp:56
gaudirun.c
c
Definition: gaudirun.py:487
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26

## ◆ removeCatalog() [1/2]

void MultiFileCatalog::removeCatalog | ( | CSTR | connect | ) |
| override

Remove catalog identified by name from the existing ones.

Definition at line 133 of file MultiFileCatalog.cpp.

133 {
134 if ( con.empty() || con == "*" ) {
135 for_each( m_catalogs, []( IFileCatalog* i ) { i->release(); } );
136 m_catalogs.clear();
137 return;
138 }
139 removeCatalog( findCatalog( con, false ) );
140 }
Gaudi::MultiFileCatalog::findCatalog
IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const override
Catalog management.
Definition: MultiFileCatalog.cpp:69
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
std::vector::clear
T clear(T... args)
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
std::for_each
T for_each(T... args)
Gaudi::MultiFileCatalog::removeCatalog
void removeCatalog(CSTR connect) override
Remove catalog identified by name from the existing ones.
Definition: MultiFileCatalog.cpp:133

## ◆ removeCatalog() [2/2]

void MultiFileCatalog::removeCatalog | ( | const IFileCatalog * | cat | ) |
| override

Remove catalog identified by reference from the existing ones.

Definition at line 142 of file MultiFileCatalog.cpp.

142 {
143 if ( cat ) {
144 auto i = find( m_catalogs.begin(), m_catalogs.end(), cat );
145 if ( i != m_catalogs.end() ) {
146 ( *i )->release();
147 m_catalogs.erase( i );
148 return;
149 }
150 printError( "Unknown file catalog -- cannot be removed.", true );
151 }
152 printError( "Invalid file catalog.", true );
153 }
std::vector::end
T end(T... args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
std::vector::erase
T erase(T... args)
std::find
T find(T... args)
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:82
std::vector::begin
T begin(T... args)

## ◆ renamePFN()

void Gaudi::MultiFileCatalog::renamePFN | ( | CSTR | pfn,
|  | CSTR | newpfn
| ) |  | const
| inline override

rename a PFN

Definition at line 113 of file MultiFileCatalog.h.

113 { writeCatalog()->renamePFN( pfn, newpfn ); }
Gaudi::IFileCatalog::renamePFN
virtual void renamePFN(const std::string &pfn, const std::string &new_pfn) const =0
rename a PFN
Gaudi::MultiFileCatalog::writeCatalog
IFileCatalog * writeCatalog(CSTR fid="") const override
Access to the (first) writable file catalog.
Definition: MultiFileCatalog.h:147

## ◆ rollback()

void MultiFileCatalog::rollback | ( |  | ) |
| override

Save DOM catalog to file.

Definition at line 221 of file MultiFileCatalog.cpp.

221 {
222 for_each( m_catalogs, []( IFileCatalog* i ) { i->rollback(); } );
223 }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:26
Gaudi::IFileCatalog::rollback
virtual void rollback()=0
Save catalog to file.
std::for_each
T for_each(T... args)

## ◆ setMetaData()

void Gaudi::MultiFileCatalog::setMetaData | ( | CSTR | fid,
|  | CSTR | attr,
|  | CSTR | val
| ) |  | const
| inline override

Insert/update metadata item.

Definition at line 123 of file MultiFileCatalog.h.

123 {
124 writeCatalog( fid )->setMetaData( fid, attr, val );
125 }
Gaudi::IFileCatalog::setMetaData
virtual void setMetaData(const std::string &fid, const std::string &name, const std::string &value) const =0
Insert/update metadata item.
Gaudi::MultiFileCatalog::writeCatalog
IFileCatalog * writeCatalog(CSTR fid="") const override
Access to the (first) writable file catalog.
Definition: MultiFileCatalog.h:147

## ◆ setWriteCatalog() [1/2]

void MultiFileCatalog::setWriteCatalog | ( | IFileCatalog * | cat | ) |
| override

Define the writable catalog identified by reference.

Definition at line 155 of file MultiFileCatalog.cpp.

155 {
156 if ( cat ) {
157 if ( !cat->readOnly() ) {
158 auto i = find( m_catalogs.begin(), m_catalogs.end(), cat );
159 if ( i != m_catalogs.end() ) {
160 m_catalogs.erase( i );
161 m_catalogs.insert( m_catalogs.begin(), cat );
162 return;
163 }
164 printError( "The catalog " + cat->connectInfo() + " is not known.", true );
165 }
166 printError( "The catalog " + cat->connectInfo() + " is not writable.", true );
167 }
168 printError( "Invalid file catalog.", true );
169 }
std::vector::end
T end(T... args)
Gaudi::IFileCatalog::connectInfo
virtual const std::string & connectInfo() const =0
Access to connect string.
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
std::vector::erase
T erase(T... args)
std::vector::insert
T insert(T... args)
std::find
T find(T... args)
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:82
std::vector::begin
T begin(T... args)
Gaudi::IFileCatalog::readOnly
virtual bool readOnly() const =0
Check if the catalog is read-only.

## ◆ setWriteCatalog() [2/2]

void MultiFileCatalog::setWriteCatalog | ( | CSTR | connect | ) |
| override

Define the writable catalog identified by name.

Definition at line 171 of file MultiFileCatalog.cpp.

171 {
172 auto i = i_findCatalog( connect, true );
173 if ( i == m_catalogs.end() ) {
174 addCatalog( connect );
175 setWriteCatalog( findCatalog( connect, true ) );
176 return;
177 }
178 setWriteCatalog( *i );
179 }
Gaudi::MultiFileCatalog::findCatalog
IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const override
Catalog management.
Definition: MultiFileCatalog.cpp:69
Gaudi::MultiFileCatalog::setWriteCatalog
void setWriteCatalog(IFileCatalog *cat) override
Define the writable catalog identified by reference.
Definition: MultiFileCatalog.cpp:155
std::vector::end
T end(T... args)
Gaudi::MultiFileCatalog::i_findCatalog
Catalogs::iterator i_findCatalog(CSTR connect, bool must_be_writable)
Find catalog by connect string.
Definition: MultiFileCatalog.cpp:75
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:167
Gaudi::MultiFileCatalog::addCatalog
void addCatalog(CSTR connect) override
Add new catalog identified by name to the existing ones.
Definition: MultiFileCatalog.cpp:90

## ◆ writeCatalog()

IFileCatalog* Gaudi::MultiFileCatalog::writeCatalog | ( | CSTR | fid = `""` | ) | const
| inline override

Access to the (first) writable file catalog.

Definition at line 147 of file MultiFileCatalog.h.

147 { return getCatalog( fid, true, true, false ); }
Gaudi::MultiFileCatalog::getCatalog
IFileCatalog * getCatalog(CSTR fid, bool throw_if_not, bool writable=true, bool prt=true) const
Find catalog containing a given file identifier.
Definition: MultiFileCatalog.cpp:56

## Member Data Documentation

## ◆ m_catalogNames

Gaudi::Property<CatalogNames> Gaudi::MultiFileCatalog::m_catalogNames
| private

Initial value:
{
this, "Catalogs", {{"xmlcatalog_file:test_catalog.xml"}}, &MultiFileCatalog::propHandler, "catalog names"}

Definition at line 169 of file MultiFileCatalog.h.

## ◆ m_catalogs

Catalogs Gaudi::MultiFileCatalog::m_catalogs
| private

Container with references to known catalogs.

Definition at line 167 of file MultiFileCatalog.h.

## ◆ m_oldNames

CatalogNames Gaudi::MultiFileCatalog::m_oldNames
| private

BACKUP:: Container with catalog names.

Definition at line 175 of file MultiFileCatalog.h.

## ◆ m_started

bool Gaudi::MultiFileCatalog::m_started = false
| private

Flag to indicate if catalog is started.

Definition at line 173 of file MultiFileCatalog.h.

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

- GaudiUtils/src/component/MultiFileCatalog.h
- GaudiUtils/src/component/MultiFileCatalog.cpp