| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
IoComponentMgr Class Reference

`#include <IoComponentMgr.h>`

Inheritance diagram for IoComponentMgr:
[legend]
Collaboration diagram for IoComponentMgr:
[legend]

## Classes
struct | IoComponentEntry

## Public Member Functions
| IoComponentMgr (const std::string &name, ISvcLocator *pSvcLocator)
| Constructor with parameters:
virtual | ~IoComponentMgr ()
| Destructor:
void | handle (const Incident &)
virtual bool | io_hasitem (IIoComponent *iocomponent) const
| : check if the registry contains a given `IIoComponent`
virtual bool | io_contains (IIoComponent *iocomponent, const std::string &fname) const
| : check if the registry contains a given `IIoComponent` and that component had
virtual StatusCode | io_register (IIoComponent *iocomponent)
| : allow a `IIoComponent` to register itself with this manager so appropriate actions can be taken when e.g.
virtual StatusCode | io_register (IIoComponent *iocomponent, IIoComponentMgr::IoMode::Type iomode, const std::string &fname, const std::string &pfn)
| : allow a `IIoComponent` to register itself with this manager so appropriate actions can be taken when e.g.
virtual StatusCode | io_update (IIoComponent *iocomponent, const std::string &old_fname, const std::string &new_fname)
| : allow a `IIoComponent` to update the contents of the registry with a new file name
virtual StatusCode | io_update (IIoComponent *iocomponent, const std::string &work_dir)
| : allow a `IIoComponent` to update the contents of the registry with a new work directory
virtual StatusCode | io_update_all (const std::string &work_dir)
| : Update all `IIoComponents` with a new work directory
virtual StatusCode | io_retrieve (IIoComponent *iocomponent, std::string &fname)
| : retrieve the new filename for a given `IIoComponent` and
virtual StatusCode | io_reinitialize ()
| : reinitialize the I/O subsystem.
virtual StatusCode | io_finalize ()
| : finalize the I/O subsystem.
virtual StatusCode | initialize ()
| Gaudi Service Implementation.
virtual StatusCode | finalize ()
Public Member Functions inherited from extends2< Service, IIoComponentMgr, IIncidentListener >
| extends2 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends2 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends2 (A1 a1)
| Templated constructor with 1 argument.
| extends2 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends2 ()
| Virtual destructor.
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
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.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, 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.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from extend_interfaces2< I1, I2 >
virtual | ~extend_interfaces2 ()
| Virtual destructor.

## Private Types
typedef std::map< std::string, IIoComponent * > | IoRegistry_t
typedef std::list< IIoComponent * > | IoStack_t
typedef std::multimap < IIoComponent *, IoComponentEntry > | IoDict_t
typedef IoDict_t::const_iterator | iodITR

## Private Member Functions
| IoComponentMgr ()
| Default constructor:
bool | findComp (IIoComponent *, const std::string &, iodITR &) const
bool | findComp (IIoComponent *, std::pair< iodITR, iodITR > &) const
bool | findComp (const std::string &, std::pair< iodITR, iodITR > &) const
std::string | list () const

## Private Attributes
MsgStream | m_log
IoRegistry_t | m_ioregistry
| Registry of `IIoComponents`.
IoStack_t | m_iostack
| Stack of `IIoComponents` to properly handle order of registration.
IoDict_t | m_cdict
std::string | m_dict_location
| location of the python dictionary

## Additional Inherited Members
Public Types inherited from extends2< Service, IIoComponentMgr, IIncidentListener >
typedef extends2 | base_class
| Typedef to this class.
typedef extend_interfaces2 < IIoComponentMgr, IIncidentListener > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Protected Member Functions inherited from Service
virtual | ~Service ()
| Standard Destructor.
int | outputLevel () const
| get the `Service's` output level
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel
| Service output level.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.

## Detailed Description

Definition at line 28 of file IoComponentMgr.h.

## Member Typedef Documentation

typedef std::multimap<IIoComponent*, IoComponentEntry > IoComponentMgr::IoDict_t
| private

Definition at line 194 of file IoComponentMgr.h.

typedef IoDict_t::const_iterator IoComponentMgr::iodITR
| private

Definition at line 195 of file IoComponentMgr.h.

typedef std::map<std::string, IIoComponent*> IoComponentMgr::IoRegistry_t
| private

Definition at line 184 of file IoComponentMgr.h.

typedef std::list<IIoComponent*> IoComponentMgr::IoStack_t
| private

Definition at line 188 of file IoComponentMgr.h.

## Constructor & Destructor Documentation

IoComponentMgr::IoComponentMgr | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator
| ) |  |

Constructor with parameters:

Definition at line 49 of file IoComponentMgr.cpp.

: base_class(name,svc), m_log(msgSvc(), name )
{
//
// Property declaration
//
//declareProperty( "Property", m_nProperty );
// declareProperty ("Registry",
// m_dict_location = "GaudiMP.IoRegistry.registry",
// "Location of the python dictionary holding the "
// "associations: \n"
// " {component-name:{ 'old-fname' : ['io','new-fname'] }}\n"
// "\nSyntax: <python-module>.<python-module>.<fct-name> \n"
// " where fct-name is a function returning the wanted "
// " dictionary.");
}

IoComponentMgr::~IoComponentMgr | ( |  | ) |
| virtual

Destructor:

Definition at line 70 of file IoComponentMgr.cpp.

{
}

IoComponentMgr::IoComponentMgr | ( |  | ) |
| private

Default constructor:

## Member Function Documentation

StatusCode IoComponentMgr::finalize | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 102 of file IoComponentMgr.cpp.

{
m_log << MSG::DEBUG << "--> finalize()" << endmsg;
return StatusCode::SUCCESS;
}

bool IoComponentMgr::findComp | ( | IIoComponent * | c,
|  | const std::string & | f,
|  | iodITR & | itr
| ) |  | const
| private

Definition at line 483 of file IoComponentMgr.cpp.

{
pair<iodITR,iodITR> pit;
if (!findComp(c,pit)) {
itr = pit.first;
return false;
}
for (itr = pit.first; itr != pit.second; ++itr) {
if (itr->second.m_oldfname == f) {
return true;
}
}
return false;
}

bool IoComponentMgr::findComp | ( | IIoComponent * | c,
|  | std::pair< iodITR, iodITR > & | pit
| ) |  | const
| private

Definition at line 505 of file IoComponentMgr.cpp.

{
pit = m_cdict.equal_range(c);
if (pit.first == pit.second) {
return false;
} else {
return true;
}
}

bool IoComponentMgr::findComp | ( | const std::string & | c,
|  | std::pair< iodITR, iodITR > & | pit
| ) |  | const
| private

Definition at line 520 of file IoComponentMgr.cpp.

{
pit.first = m_cdict.end();
pit.second = m_cdict.end();
IoRegistry_t::const_iterator itr = m_ioregistry.find(c);
if (itr == m_ioregistry.end()) {
return false;
}
return findComp(itr->second, pit);
}

void IoComponentMgr::handle | ( | const Incident & | i | ) |

Definition at line 553 of file IoComponentMgr.cpp.

{
pair<iodITR,iodITR> pit;
if ( i.type() == IncidentType::BeginInputFile ) {
const FileIncident *fi = dynamic_cast<const FileIncident*> ( &i );
DEBMSG << "BeginInputFile: s: " << fi->source() << " t: " << fi->type()
<< " n: " << fi->fileName() << " g: " << fi->fileGuid()
<< endmsg;
if (findComp(fi->source(),pit)) {
DEBMSG << " found component: " << endmsg;
while (pit.first != pit.second) {
IIoComponent* c = pit.first->first;
IoComponentEntry e = pit.first->second;
DEBMSG << " c: " << c->name() << " " << e << endmsg;
++pit.first;
}
} else {
DEBMSG << " could not find component \"" << fi->source()
<< "\"!" << endmsg;
}
} else if ( i.type() == IncidentType::BeginOutputFile ) {
const FileIncident *fi = dynamic_cast<const FileIncident*> ( &i );
DEBMSG << "BeginOutputFile: s: " << fi->source() << " t: " << fi->type()
<< " n: " << fi->fileName() << " g: " << fi->fileGuid()
<< endmsg;
if (findComp(fi->source(),pit)) {
DEBMSG << " found component: " << endmsg;
while (pit.first != pit.second) {
IIoComponent* c = pit.first->first;
IoComponentEntry e = pit.first->second;
DEBMSG << " c: " << c->name() << " " << e << endmsg;
++pit.first;
}
} else {
DEBMSG << " could not find component \"" << fi->source()
<< "\"!" << endmsg;
}
}
}

StatusCode IoComponentMgr::initialize | ( |  | ) |
| virtual

Gaudi Service Implementation.

Reimplemented from Service.

Definition at line 77 of file IoComponentMgr.cpp.

{
m_log << MSG::DEBUG << "--> initialize()" << endmsg;
if ( Service::initialize().isFailure() ) {
m_log << MSG::ERROR << "Unable to initialize Service base class" << endmsg;
return StatusCode::FAILURE;
}
m_log.setLevel( m_outputLevel.value() );
IIncidentSvc* p_incSvc(0);
if (service("IncidentSvc", p_incSvc, true).isFailure()) {
m_log << MSG::ERROR << "unable to get the IncidentSvc" << endmsg;
return StatusCode::FAILURE;
} else {
p_incSvc->addListener( this, IncidentType::BeginOutputFile, 100, true);
p_incSvc->addListener( this, IncidentType::BeginInputFile, 100, true);
}
return StatusCode::SUCCESS;
}

bool IoComponentMgr::io_contains | ( | IIoComponent * | iocomponent,
|  | const std::string & | fname
| ) |  | const
| virtual

: check if the registry contains a given `IIoComponent` and that component had

Parameters

  <tt>fname</tt> | as a filename

Definition at line 129 of file IoComponentMgr.cpp.

{
m_log << MSG::DEBUG << "--> io_contains()" << endmsg;
if ( 0 == iocomponent ) {
return false;
}
const std::string& ioname = iocomponent->name();
DEBMSG << "io_contains: c: " << ioname << " f: " << fname << endmsg;
pair<iodITR,iodITR> fit = m_cdict.equal_range(iocomponent);
if (fit.first == fit.second) {
return false;
} else {
iodITR it;
for (it=fit.first; it != fit.second; ++it) {
IoComponentEntry ioe = it->second;
DEBMSG << " " << ioe << endmsg;
if (ioe.m_oldfname == "") {
m_log << MSG::ERROR << "IIoComponent " << ioname
<< " has empty old filename" << endmsg;
return false;
} else if (ioe.m_oldfname == fname) {
return true;
}
}
}
return false;
}

StatusCode IoComponentMgr::io_finalize | ( |  | ) |
| virtual

: finalize the I/O subsystem.

Hook to allow to e.g. give a chance to I/O subsystems to merge output files. Not sure how to do this correctly though...

Definition at line 451 of file IoComponentMgr.cpp.

{
m_log << MSG::DEBUG << "--> io_finalize()" << endmsg;
m_log << MSG::DEBUG << "finalizing I/O subsystem..." << endmsg;
if (m_log.level() <= MSG::DEBUG) {
m_log << MSG::DEBUG << "Listing all monitored entries: " << std::endl;
DEBMSG << list() << endmsg;
}
bool allgood = true;
for ( IoStack_t::iterator io = m_iostack.begin(), ioEnd = m_iostack.end();
io != ioEnd;
++io ) {
m_log << MSG::DEBUG << " [" << (*io)->name() << "]->io_finalize()..."
<< endmsg;
if ( !(*io)->io_finalize().isSuccess() ) {
allgood = false;
m_log << MSG::ERROR << "problem in [" << (*io)->name()
<< "]->io_finalize() !" << endmsg;
}
}
return allgood
? StatusCode::SUCCESS
: StatusCode::FAILURE;
}

bool IoComponentMgr::io_hasitem | ( | IIoComponent * | iocomponent | ) | const
| virtual

: check if the registry contains a given `IIoComponent`

Definition at line 113 of file IoComponentMgr.cpp.

{
DEBMSG << "--> io_hasitem()" << endmsg;
if ( 0 == iocomponent ) {
return false;
}
const std::string& ioname = iocomponent->name();
IoRegistry_t::const_iterator io = m_ioregistry.find (ioname);
return io != m_ioregistry.end();
}

StatusCode IoComponentMgr::io_register | ( | IIoComponent * | iocomponent | ) |
| virtual

: allow a `IIoComponent` to register itself with this manager so appropriate actions can be taken when e.g.

a `fork(2)` has been issued (this is usually handled by calling `IIoComponent::io_reinit` on every registered component)

Definition at line 170 of file IoComponentMgr.cpp.

{
if ( 0 == iocomponent ) {
m_log << MSG::ERROR
<< "io_register (component) received a NULL pointer !" << endmsg;
return StatusCode::FAILURE;
}
const std::string& ioname = iocomponent->name();
DEBMSG << "--> io_register(" << ioname << ")" << endmsg;
IoRegistry_t::iterator itr = m_ioregistry.find (ioname);
if ( itr == m_ioregistry.end() ) {
DEBMSG << " registering IoComponent \"" << ioname << "\"" << endmsg;
iocomponent->addRef(); // ownership...
m_ioregistry[ioname] = iocomponent;
m_iostack.push_back (iocomponent);
} else {
m_log << MSG::INFO << "IoComponent[" << iocomponent->name()
<<"] already registered @" << (void*)itr->second << endmsg;
}
return StatusCode::SUCCESS;
}

StatusCode IoComponentMgr::io_register | ( | IIoComponent * | iocomponent,
|  | IIoComponentMgr::IoMode::Type | iomode,
|  | const std::string & | fname,
|  | const std::string & | pfn
| ) |  |
| virtual

: allow a `IIoComponent` to register itself with this manager so appropriate actions can be taken when e.g.

a `fork(2)` has been issued (this is usually handled by calling `IIoComponent::io_reinit` on every registered component)

Definition at line 201 of file IoComponentMgr.cpp.

{
if ( 0 == iocomponent ) {
return StatusCode::FAILURE;
}
const std::string& ioname = iocomponent->name();
DEBMSG << "--> io_register(" << ioname << ","
<< ( (iomode== IIoComponentMgr::IoMode::READ) ? "R" : "W" )
<< "," << fname << ")" << endmsg;
if ( !io_hasitem (iocomponent) ) {
if ( !io_register (iocomponent).isSuccess() ) {
m_log << MSG::ERROR
<< "could not register component [" << iocomponent->name() << "] "
<< "with the I/O component manager !"
<< endmsg;
return StatusCode::FAILURE;
}
}
pair<iodITR,iodITR> fit = m_cdict.equal_range(iocomponent);
if (fit.first != fit.second) {
for (iodITR it=fit.first; it != fit.second; ++it) {
IoComponentEntry ioe = it->second;
if (ioe.m_oldfname == fname) {
if (ioe.m_iomode == iomode) {
m_log << MSG::INFO << "IoComponent " << ioname
<< " has already had file " << fname
<< " registered with i/o mode " << iomode << endmsg;
return StatusCode::SUCCESS;
} else {
m_log << MSG::WARNING << "IoComponent " << ioname
<< " has already had file " << fname
<< " registered with a different i/o mode " << ioe.m_iomode
<< " - now trying " << iomode << endmsg;
}
}
}
}
// We need to take into account that boost::filesystem::absolute() does not
// work for files read from eos, i.e. starting with "root:"
std::string tmp_name = pfn.empty()?fname:pfn;
bool from_eos = tmp_name.find("root:")==0;
IoComponentEntry ioc(fname,(from_eos?tmp_name:boost::filesystem::absolute(tmp_name).string()),iomode);
m_cdict.insert( pair<IIoComponent*, IoComponentEntry>(iocomponent, ioc) );
return StatusCode::SUCCESS;
}

StatusCode IoComponentMgr::io_reinitialize | ( |  | ) |
| virtual

: reinitialize the I/O subsystem.

This effectively calls `IIoComponent::io_reinit` on all the registered `IIoComponent`.

Definition at line 306 of file IoComponentMgr.cpp.

{
m_log << MSG::DEBUG << "--> io_reinitialize()" << endmsg;
m_log << MSG::DEBUG << "reinitializing I/O subsystem..." << endmsg;
if (m_log.level() <= MSG::DEBUG) {
m_log << MSG::DEBUG << "Listing all monitored entries: " << std::endl;
DEBMSG << list() << endmsg;
}
bool allgood = true;
for ( IoStack_t::iterator io = m_iostack.begin(), ioEnd = m_iostack.end();
io != ioEnd;
++io ) {
m_log << MSG::DEBUG << " [" << (*io)->name() << "]->io_reinit()..."
<< endmsg;
if ( !(*io)->io_reinit().isSuccess() ) {
allgood = false;
m_log << MSG::ERROR << "problem in [" << (*io)->name()
<< "]->io_reinit() !" << endmsg;
}
// we are done with this guy... release it
(*io)->release();
}
// we are done.
// FIXME: shall we allow for multiple io_reinitialize ?
// m_iostack.clear();
// m_ioregistry.clear();
// m_cdict.clear();
return allgood
? StatusCode::SUCCESS
: StatusCode::FAILURE;
}

StatusCode IoComponentMgr::io_retrieve | ( | IIoComponent * | iocomponent,
|  | std::string & | fname
| ) |  |
| virtual

: retrieve the new filename for a given `IIoComponent` and

Parameters

  <tt>fname</tt> | filename
  <tt>oldfname</tt> | filename

Definition at line 261 of file IoComponentMgr.cpp.

{
if ( 0 == iocomponent ) {
return StatusCode::FAILURE;
}
std::string ofname = fname;
const std::string& ioname = iocomponent->name();
m_log << MSG::DEBUG << "--> io_retrieve(" << ioname << "," << fname << ")"
<< endmsg;
iodITR it;
if (!findComp(iocomponent,ofname,it)) {
DEBMSG << "could not find c: " << ioname << " old_f: " << ofname << endmsg;
return StatusCode::FAILURE;
} else {
IoDict_t::iterator it;
for (it = m_cdict.equal_range(iocomponent).first;
it != m_cdict.equal_range(iocomponent).second;
++it) {
if (it->second.m_oldfname == ofname) {
DEBMSG << "retrieving new name for the component " << iocomponent->name()
<< " old name: " << ofname
<< ", new name: " << it->second.m_newfname << endmsg;
fname = it->second.m_newfname;
return StatusCode::SUCCESS;
}
}
}
DEBMSG << "Unexpected error! Unable to find entry in the dictionary corresponding to old filename: " << ofname << endmsg;
return StatusCode::FAILURE;
}

StatusCode IoComponentMgr::io_update | ( | IIoComponent * | iocomponent,
|  | const std::string & | old_fname,
|  | const std::string & | new_fname
| ) |  |
| virtual

: allow a `IIoComponent` to update the contents of the registry with a new file name

Definition at line 345 of file IoComponentMgr.cpp.

{
DEBMSG << "--> io_update(" << ioc->name() << ","
<< old_fname << "," << new_fname << ")" << endmsg;
IoDict_t::iterator it;
for (it = m_cdict.equal_range(ioc).first;
it != m_cdict.equal_range(ioc).second;
++it) {
if (it->second.m_oldfname == old_fname) {
DEBMSG << "updating " << ioc->name() << " f: " << old_fname << " -> "
<< new_fname << endmsg;
it->second.m_newfname = new_fname;
return StatusCode::SUCCESS;
}
}
return StatusCode::FAILURE;
}

StatusCode IoComponentMgr::io_update | ( | IIoComponent * | iocomponent,
|  | const std::string & | work_dir
| ) |  |
| virtual

: allow a `IIoComponent` to update the contents of the registry with a new work directory

Definition at line 371 of file IoComponentMgr.cpp.

{
DEBMSG << "--> io_update(" << ioc->name() << ","
<< work_dir << ")" << endmsg;
IoDict_t::iterator it;
for (it = m_cdict.equal_range(ioc).first;
it != m_cdict.equal_range(ioc).second;
++it) {
switch(it->second.m_iomode) {
case IIoComponentMgr::IoMode::READ:
{
it->second.m_newfname = it->second.m_oldabspath;
break;
}
case IIoComponentMgr::IoMode::WRITE:
{
boost::filesystem::path oldPath(it->second.m_oldfname);
if(oldPath.is_relative() &&
oldPath.filename()==oldPath.relative_path()) {
// Only file name was provided for writing. This is the usual mode of operation
// ***
// NB. In such cases it would make sense to set newfname=oldfname, however this will break
// existing client codes, which assume that newfname contains "/"
// Thus we set newfname=workdir/oldfname
// ***
boost::filesystem::path newfname(work_dir);
newfname /= oldPath;
it->second.m_newfname = newfname.string();
}
else {
// New name should be the old absolute path
it->second.m_newfname = it->second.m_oldabspath;
}
break;
}
default:
{
// Don't know how to deal with either RW or INVALID
m_log << MSG::ERROR << "Unable to update IoComponent for the mode " << it->second.m_iomode << endmsg;
return StatusCode::FAILURE;
}
}
} // for
return StatusCode::SUCCESS;
}

StatusCode IoComponentMgr::io_update_all | ( | const std::string & | work_dir | ) |
| virtual

: Update all `IIoComponents` with a new work directory

Definition at line 428 of file IoComponentMgr.cpp.

{
DEBMSG << "-->io_update_all for the directory " << work_dir << endmsg;
bool allgood = true;
for ( IoStack_t::iterator io = m_iostack.begin(), ioEnd = m_iostack.end();
io != ioEnd;
++io ) {
if ( !io_update(*io,work_dir).isSuccess() ) {
allgood = false;
m_log << MSG::ERROR << "problem in [" << (*io)->name()
<< "]->io_update() !" << endmsg;
}
}
return allgood ? StatusCode::SUCCESS : StatusCode::FAILURE;
}

std::string IoComponentMgr::list | ( |  | ) | const
| private

Definition at line 537 of file IoComponentMgr.cpp.

{
ostringstream ost;
ost << "Listing all IoComponents (" << m_cdict.size() << "): " << endl;
for (iodITR it = m_cdict.begin(); it != m_cdict.end(); ++it) {
ost << " " << it->first->name() << " " << it->second
<< endl;
}
return ost.str();
}

## Member Data Documentation

IoDict_t IoComponentMgr::m_cdict
| private

Definition at line 197 of file IoComponentMgr.h.

std::string IoComponentMgr::m_dict_location
| private

location of the python dictionary

Definition at line 200 of file IoComponentMgr.h.

IoRegistry_t IoComponentMgr::m_ioregistry
| private

Registry of `IIoComponents`.

Definition at line 186 of file IoComponentMgr.h.

IoStack_t IoComponentMgr::m_iostack
| private

Stack of `IIoComponents` to properly handle order of registration.

Definition at line 190 of file IoComponentMgr.h.

MsgStream IoComponentMgr::m_log
| mutable private

Definition at line 182 of file IoComponentMgr.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMP/src/component/IoComponentMgr.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMP/src/component/IoComponentMgr.cpp