| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
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
| MultiFileCatalog (const std::string &nam, ISvcLocator *svc)
| Create a catalog file, initialization of XercesC. More...
| ~MultiFileCatalog () override=default
| Destructor,. More...
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 | 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...
| ~extends () override=default
| Virtual destructor. 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
| ~PropertyHolder () override=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, TYPE &value, const std::string &doc="none") const
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
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
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...
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. 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 ()
| 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 (Details::PropertyBase &)
| 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, "[[deprecated]] 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 21 of file MultiFileCatalog.h.

## Member Typedef Documentation

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

Definition at line 30 of file MultiFileCatalog.h.

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

Definition at line 29 of file MultiFileCatalog.h.

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

Definition at line 28 of file MultiFileCatalog.h.

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

Definition at line 25 of file MultiFileCatalog.h.

## Constructor & Destructor Documentation

MultiFileCatalog::MultiFileCatalog | ( | const std::string & | nam,
|  | ISvcLocator * | svc
| ) |  |

Create a catalog file, initialization of XercesC.

Definition at line 25 of file MultiFileCatalog.cpp.

25 : base_class( nam, svc )
26 {
27 m_catalogNames.declareUpdateHandler( &Gaudi::MultiFileCatalog::propHandler, this );
28 }
extends< Service, IFileCatalog, IFileCatalogMgr >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:15
Gaudi::MultiFileCatalog::m_catalogNames
Gaudi::Property< CatalogNames > m_catalogNames
Definition: MultiFileCatalog.h:176
Gaudi::MultiFileCatalog::propHandler
void propHandler(Details::PropertyBase &)
simple property handle to allow interactive modification of list of the file catalogs ...
Definition: MultiFileCatalog.cpp:257

Gaudi::MultiFileCatalog::~MultiFileCatalog | ( |  | ) |
| override default

Destructor,.

## Member Function Documentation

template<class A1 , class F >

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

Definition at line 43 of file MultiFileCatalog.h.

44 {
45 A1 tmp;
46 for ( const auto& i : m_catalogs ) {
47 f( i, tmp ); // tmp = f(i)
48 arg1.insert( arg1.end(), tmp.begin(), tmp.end() );
49 tmp.clear();
50 }
51 }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
template<class A2 , class A1 , class F >

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

Definition at line 53 of file MultiFileCatalog.h.

54 {
55 A1 tmp;
56 for ( const auto& i : m_catalogs ) {
57 f( i, arg2, tmp ); // tmp = f(i,arg2)
58 arg1.insert( arg1.end(), tmp.begin(), tmp.end() );
59 tmp.clear();
60 }
61 }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
template<class A1 , class F >

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

Definition at line 33 of file MultiFileCatalog.h.

34 {
35 std::string result;
36 for ( const auto& i : m_catalogs ) {
37 result = ( i->*pmf )( arg1 );
38 if ( !result.empty() ) break;
39 }
40 return result;
41 }
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:174

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 108 of file MultiFileCatalog.cpp.

109 {
110 if ( !con.empty() ) {
111 if ( !findCatalog( con, false ) ) {
112 static const string xml_typ = "Gaudi::XMLFileCatalog";
113 auto id0 = con.find( "_" );
114 string typ = con.substr( 0, id0 );
115 string url = con.substr( id0 + 1 );
116 IInterface* cat = nullptr;
117 if ( strncasecmp( "xml", typ.c_str(), 3 ) == 0 ) {
118 cat = IFileCatalog::Factory::create( xml_typ, url, msgSvc().get() );
119 } else {
120 using Gaudi::PluginService::Details::Registry;
121 Registry& registry = Registry::instance();
122 if ( registry.getInfo( typ ).type == typeid( Service::Factory::FuncType ).name() ) {
123 cat = Service::Factory::create( typ, url, serviceLocator().get() );
124 } else if ( registry.getInfo( typ ).type == typeid( IFileCatalog::Factory::FuncType ).name() ) {
125 cat = IFileCatalog::Factory::create( typ, url, msgSvc().get() );
126 }
127 }
128 if ( cat ) {
129 auto fileCat = SmartIF<IFileCatalog>( cat );
130 if ( fileCat ) {
131 addCatalog( fileCat.get() ); // addCatalog will take care of the refCount of fileCat...
132 return;
133 }
134 }
135 printError( "Failed to create catalog connection:" + con, true );
136 }
138 return;
139 }
140 printError( "Got invalid (empty) catalog connection string.", true );
141 }
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:15
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:99
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
CommonMessagingBase::msgSvc
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:75
GaudiPluginService.cpluginsvc.registry
def registry()
Definition: cpluginsvc.py:70
Gaudi::MultiFileCatalog::findCatalog
IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const override
Catalog management.
Definition: MultiFileCatalog.cpp:82
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:108
Gaudi::PluginService::Details::Registry
In-memory database of the loaded factories.
Definition: PluginServiceDetails.h:112
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292

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

Add new catalog identified by reference to the existing ones.

Definition at line 143 of file MultiFileCatalog.cpp.

144 {
145 if ( cat ) {
146 cat->addRef();
147 m_catalogs.push_back( cat );
148 return;
149 }
150 printError( "Got invalid catalog to be added to multi catalog.", true );
151 }
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:99
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:174
IInterface::addRef
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.

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

Access catalog container.

Definition at line 150 of file MultiFileCatalog.h.

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

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

Access catalog container (CONST)

Definition at line 152 of file MultiFileCatalog.h.

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

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

Save DOM catalog to file.

Definition at line 247 of file MultiFileCatalog.cpp.

248 {
249 for_each( m_catalogs, []( IFileCatalog* i ) { i->commit(); } );
250 }
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:174
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
std::for_each
T for_each(T...args)

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

Access to connect string.

Definition at line 62 of file MultiFileCatalog.cpp.

63 {
64 static const string s( "MultiCatalog" );
65 return s;
66 }
gaudirun.s
string s
Definition: gaudirun.py:253

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

Catalog interface.

Create file identifier using UUID mechanism.

Create file identifier using UUID mechanism

Definition at line 60 of file MultiFileCatalog.cpp.

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

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

Delete FileID from the catalog.

Definition at line 114 of file MultiFileCatalog.h.

114 { 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:154

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

Check if the catalog should be updated.

Definition at line 235 of file MultiFileCatalog.cpp.

236 {
237 return std::any_of( std::begin( m_catalogs ), std::end( m_catalogs ),
238 []( const IFileCatalog* i ) { return i->dirty(); } );
239 }
std::end
T end(T...args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
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.

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

Drop all metadata of one FID.

Definition at line 134 of file MultiFileCatalog.h.

134 { 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:154

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

Drop specified metadata item.

Definition at line 136 of file MultiFileCatalog.h.

136 { 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:154

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

Return the status of a FileID.

Definition at line 99 of file MultiFileCatalog.h.

99 { 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:68

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

Return the status of a logical file name.

Definition at line 95 of file MultiFileCatalog.h.

95 { 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:97

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

Return the status of physical file name.

Definition at line 91 of file MultiFileCatalog.h.

91 { 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:93

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

Finalize service object.

Definition at line 50 of file MultiFileCatalog.cpp.

51 {
52 commit();
53 for_each( m_catalogs, []( IFileCatalog* i ) { i->release(); } );
54 m_catalogs.clear();
55 m_started = false;
56 return Service::finalize();
57 }
Gaudi::MultiFileCatalog::m_started
bool m_started
Flag to indicate if catalog is started.
Definition: MultiFileCatalog.h:180
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
std::vector::clear
T clear(T...args)
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
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:247

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

Catalog management.

Find catalog by connect string

Definition at line 82 of file MultiFileCatalog.cpp.

83 {
84 auto i = std::find_if( m_catalogs.begin(), m_catalogs.end(),
85 [&]( const IFileCatalog* f ) { return connect == f->connectInfo(); } );
86 return ( i != m_catalogs.end() && ( !must_be_writable || !( *i )->readOnly() ) ) ? *i : nullptr;
87 }
std::vector::end
T end(T...args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
std::find_if
T find_if(T...args)
std::vector::begin
T begin(T...args)

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 68 of file MultiFileCatalog.cpp.

69 {
70 for ( const auto& c : m_catalogs ) {
71 if ( !c || ( writable && c->readOnly() ) ) continue;
72 if ( fid.empty() || ( !fid.empty() && c->existsFID( fid ) ) ) return c;
73 }
74 if ( prt ) {
75 printError( "No writable file catalog found which contains FID:" + fid, throw_if_not );
76 } else {
77 debug() << "No writable file catalog found which contains FID:" << fid << endmsg;
78 }
79 return nullptr;
80 }
std::string::empty
T empty(T...args)
gaudirun.c
c
Definition: gaudirun.py:407
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:99
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:115
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

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

Dump all file Identifiers.

Definition at line 112 of file MultiFileCatalog.h.

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

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 106 of file MultiFileCatalog.h.

107 {
108 _collect( fid, files, std::mem_fn( &IFileCatalog::getLFN ) );
109 }
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:43
std::mem_fn
T mem_fn(T...args)

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 122 of file MultiFileCatalog.h.

123 {
124 _collect( fid, attr, std::mem_fn( &IFileCatalog::getMetaData ) );
125 }
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:43
std::mem_fn
T mem_fn(T...args)

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

Access metadata item.

Definition at line 205 of file MultiFileCatalog.cpp.

206 {
207 std::string result;
208 for ( const auto& i : m_catalogs ) {
209 result = i->getMetaDataItem( fid, attr );
210 if ( !result.empty() ) break;
211 }
212 return result;
213 }
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:174

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 101 of file MultiFileCatalog.h.

102 {
103 _collect( fid, files, std::mem_fn( &IFileCatalog::getPFN ) );
104 }
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:43
std::mem_fn
T mem_fn(T...args)

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

Find catalog by connect string.

Definition at line 89 of file MultiFileCatalog.cpp.

90 {
91 auto i = std::find_if( m_catalogs.begin(), m_catalogs.end(),
92 [&]( const IFileCatalog* f ) { return connect == f->connectInfo(); } );
93 if ( i != m_catalogs.end() && must_be_writable && ( *i )->readOnly() ) {
94 i = m_catalogs.end();
95 }
96 return i;
97 }
std::vector::end
T end(T...args)
Gaudi::IFileCatalog::readOnly
virtual bool readOnly() const =0
Check if the catalog is read-only.
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
std::find_if
T find_if(T...args)
std::vector::begin
T begin(T...args)

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

Parse the DOM tree of the XML catalog.

Definition at line 241 of file MultiFileCatalog.cpp.

242 {
243 for_each( m_catalogs, []( IFileCatalog* i ) { i->init(); } );
244 m_started = true;
245 }
Gaudi::MultiFileCatalog::m_started
bool m_started
Flag to indicate if catalog is started.
Definition: MultiFileCatalog.h:180
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
Gaudi::IFileCatalog::init
virtual void init()=0
Parse the DOM tree of the XML catalog.
std::for_each
T for_each(T...args)

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

IService implementation.

Finalize service object

Definition at line 30 of file MultiFileCatalog.cpp.

31 {
32 if ( !Service::initialize().isSuccess() ) {
33 printError( "Failed to initialize service base class.", false );
34 return StatusCode::SUCCESS;
35 }
36 std::string current;
37 try {
38 for ( const auto& i : m_catalogNames ) {
39 current = i;
40 addCatalog( i );
41 }
42 init();
43 return StatusCode::SUCCESS;
44 } catch ( const std::exception& /* e */ ) {
45 printError( "Cannot add file catalog:" + current, false );
46 }
47 return StatusCode::FAILURE;
48 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:99
std::string
STL class.
Gaudi::MultiFileCatalog::m_catalogNames
Gaudi::Property< CatalogNames > m_catalogNames
Definition: MultiFileCatalog.h:176
std::exception
STL class.
Gaudi::MultiFileCatalog::init
void init() override
Parse the DOM tree of the XML catalog.
Definition: MultiFileCatalog.cpp:241
Gaudi::MultiFileCatalog::addCatalog
void addCatalog(CSTR connect) override
Add new catalog identified by name to the existing ones.
Definition: MultiFileCatalog.cpp:108

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

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

Lookup file identifier by logical file name.

Definition at line 97 of file MultiFileCatalog.h.

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

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

Lookup file identifier by physical file name.

Definition at line 93 of file MultiFileCatalog.h.

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

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

Definition at line 99 of file MultiFileCatalog.cpp.

100 {
101 if ( rethrow ) {
102 fatal() << msg << endmsg;
103 throw runtime_error( "Catalog> " + msg );
104 }
105 error() << msg << endmsg;
106 }
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
std::runtime_error
STL class.
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:100
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

void MultiFileCatalog::propHandler | ( | Details::PropertyBase & |  | ) |
| private

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

Definition at line 257 of file MultiFileCatalog.cpp.

258 {
259 // not yet initialized
260 if ( !m_started ) {
261 m_oldNames = m_catalogNames;
262 return;
263 } // RETURN
264 // no real change - no action
265 if ( m_catalogNames == m_oldNames ) {
266 return;
267 }
268 m_oldNames = m_catalogNames;
269 // remove ALL catalogs
270 removeCatalog( "" );
271 // add new catalogs
272 for ( const auto& inew : m_catalogNames ) addCatalog( inew );
273 // start
274 init();
275 //
276 debug() << "New catalogs to be used: " << Gaudi::Utils::toString( m_catalogNames ) << endmsg;
277 }
Gaudi::MultiFileCatalog::m_started
bool m_started
Flag to indicate if catalog is started.
Definition: MultiFileCatalog.h:180
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:346
Gaudi::MultiFileCatalog::m_catalogNames
Gaudi::Property< CatalogNames > m_catalogNames
Definition: MultiFileCatalog.h:176
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:115
Gaudi::MultiFileCatalog::m_oldNames
CatalogNames m_oldNames
BACKUP:: Container with catalog names.
Definition: MultiFileCatalog.h:182
Gaudi::MultiFileCatalog::init
void init() override
Parse the DOM tree of the XML catalog.
Definition: MultiFileCatalog.cpp:241
Gaudi::MultiFileCatalog::addCatalog
void addCatalog(CSTR connect) override
Add new catalog identified by name to the existing ones.
Definition: MultiFileCatalog.cpp:108
Gaudi::MultiFileCatalog::removeCatalog
void removeCatalog(CSTR connect) override
Remove catalog identified by name from the existing ones.
Definition: MultiFileCatalog.cpp:153
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

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

Check if the catalog is read-only.

Definition at line 229 of file MultiFileCatalog.cpp.

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

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

Create a FileID and DOM Node.

Definition at line 120 of file MultiFileCatalog.h.

120 { 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:154

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 222 of file MultiFileCatalog.cpp.

223 {
224 IFileCatalog* c = getCatalog( fid, false, true, false );
225 if ( !c ) c = getCatalog( "", true, true, true );
226 c->registerLFN( fid, lfn );
227 }
gaudirun.c
c
Definition: gaudirun.py:407
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:68
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
Gaudi::IFileCatalog::registerLFN
virtual void registerLFN(const std::string &fid, const std::string &lfn) const =0
Create a Node for a FileID and DOM Node of the LFN with all the attributes.

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 215 of file MultiFileCatalog.cpp.

216 {
217 IFileCatalog* c = getCatalog( fid, false, true, false );
218 if ( !c ) c = getCatalog( "", true, true, true );
219 c->registerPFN( fid, pfn, ftype );
220 }
gaudirun.c
c
Definition: gaudirun.py:407
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:68
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
Gaudi::IFileCatalog::registerPFN
virtual void registerPFN(const std::string &fid, const std::string &pfn, const std::string &ftype) const =0
Create a Node for a FileID and DOM Node of the PFN with all the attributes.

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

Remove catalog identified by name from the existing ones.

Definition at line 153 of file MultiFileCatalog.cpp.

154 {
155 if ( con.empty() || con == "*" ) {
156 for_each( m_catalogs, []( IFileCatalog* i ) { i->release(); } );
157 m_catalogs.clear();
158 return;
159 }
160 removeCatalog( findCatalog( con, false ) );
161 }
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
std::vector::clear
T clear(T...args)
Gaudi::IFileCatalog
File catalog interface.
Definition: IFileCatalog.h:25
Gaudi::MultiFileCatalog::findCatalog
IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const override
Catalog management.
Definition: MultiFileCatalog.cpp:82
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:153

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

Remove catalog identified by reference from the existing ones.

Definition at line 163 of file MultiFileCatalog.cpp.

164 {
165 if ( cat ) {
166 auto i = find( m_catalogs.begin(), m_catalogs.end(), cat );
167 if ( i != m_catalogs.end() ) {
168 ( *i )->release();
169 m_catalogs.erase( i );
170 return;
171 }
172 printError( "Unknown file catalog -- cannot be removed.", true );
173 }
174 printError( "Invalid file catalog.", true );
175 }
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:99
std::vector::end
T end(T...args)
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
std::vector::erase
T erase(T...args)
std::find
T find(T...args)
std::vector::begin
T begin(T...args)

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

Save DOM catalog to file.

Definition at line 252 of file MultiFileCatalog.cpp.

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

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

Insert/update metadata item.

Definition at line 129 of file MultiFileCatalog.h.

130 {
131 writeCatalog( fid )->setMetaData( fid, attr, val );
132 }
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:154

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

Define the writable catalog identified by reference.

Definition at line 177 of file MultiFileCatalog.cpp.

178 {
179 if ( cat ) {
180 if ( !cat->readOnly() ) {
181 auto i = find( m_catalogs.begin(), m_catalogs.end(), cat );
182 if ( i != m_catalogs.end() ) {
183 m_catalogs.erase( i );
184 m_catalogs.insert( m_catalogs.begin(), cat );
185 return;
186 }
187 printError( "The catalog " + cat->connectInfo() + " is not known.", true );
188 }
189 printError( "The catalog " + cat->connectInfo() + " is not writable.", true );
190 }
191 printError( "Invalid file catalog.", true );
192 }
Gaudi::MultiFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: MultiFileCatalog.cpp:99
Gaudi::IFileCatalog::connectInfo
virtual const std::string & connectInfo() const =0
Access to connect string.
std::vector::end
T end(T...args)
Gaudi::IFileCatalog::readOnly
virtual bool readOnly() const =0
Check if the catalog is read-only.
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
std::vector::erase
T erase(T...args)
std::vector::insert
T insert(T...args)
std::find
T find(T...args)
std::vector::begin
T begin(T...args)

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

Define the writable catalog identified by name.

Definition at line 194 of file MultiFileCatalog.cpp.

195 {
196 auto i = i_findCatalog( connect, true );
197 if ( i == m_catalogs.end() ) {
198 addCatalog( connect );
199 setWriteCatalog( findCatalog( connect, true ) );
200 return;
201 }
202 setWriteCatalog( *i );
203 }
Gaudi::MultiFileCatalog::setWriteCatalog
void setWriteCatalog(IFileCatalog *cat) override
Define the writable catalog identified by reference.
Definition: MultiFileCatalog.cpp:177
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:89
Gaudi::MultiFileCatalog::m_catalogs
Catalogs m_catalogs
Container with references to known catalogs.
Definition: MultiFileCatalog.h:174
Gaudi::MultiFileCatalog::findCatalog
IFileCatalog * findCatalog(CSTR connect, bool must_be_writable) const override
Catalog management.
Definition: MultiFileCatalog.cpp:82
Gaudi::MultiFileCatalog::addCatalog
void addCatalog(CSTR connect) override
Add new catalog identified by name to the existing ones.
Definition: MultiFileCatalog.cpp:108

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

Access to the (first) writable file catalog.

Definition at line 154 of file MultiFileCatalog.h.

154 { 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:68

## Member Data Documentation

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

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

Definition at line 176 of file MultiFileCatalog.h.

Catalogs Gaudi::MultiFileCatalog::m_catalogs
| private

Container with references to known catalogs.

Definition at line 174 of file MultiFileCatalog.h.

CatalogNames Gaudi::MultiFileCatalog::m_oldNames
| private

BACKUP:: Container with catalog names.

Definition at line 182 of file MultiFileCatalog.h.

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

Flag to indicate if catalog is started.

Definition at line 180 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