| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# DataOnDemandSvc Class Reference

`#include <IncidentSvc/DataOnDemandSvc.h>`

Inheritance diagram for DataOnDemandSvc:

[legend]
Collaboration diagram for DataOnDemandSvc:

[legend]
List of all members.

## Detailed Description

The DataOnDemandSvc listens to incidents typically triggered by the data service of the configurable name "IncidentName".

In the job options handlers can be declared, which allow to configure this service. Such handlers are either:

- Node handlers, if objects other than the default object type have to be instantiated. DataOnDemandSvc.Nodes = { "DATA='/Event/Rec' TYPE='DataObject'", "DATA='/Event/Rec/Muon' TYPE='DataObject'" };

- Leaf handlers (Algorithms), which get instantiated and executed on demand. DataOnDemandSvc.Algorithms = { "DATA='/Event/Rec/Muon/Digits' TYPE='MuonDigitAlg/MyMuonDigits'" }; If the algorithm name is omitted the class name will be the instance name.

The handlers only get called if the exact path mathes. In the event already the partial path to any handler is missing a leaf handler may be triggered, which includes the partal pathes ( DataOnDemandSvc.UsePreceedingPath = true )

2006-10-15: New options (using map-like semantics:)

        DataOnDemandSvc.AlgMap  +=
       { "Phys/StdLoosePions/Particles" : "PreLoadParticles/StdLoosePions" ,
         "Phys/StdLoosePions/Vertioces" : "PreLoadParticles/StdLoosePions" } ;

        DataOnDemandSvc.NodeMap +=
       { "Phys" : "DataObject" ,
         "MC"   : "DataObject" } ;

New treatment of preceeding paths. for each registered leaf or node the all parent nodes are added into the node-map with default directory type 'DataObject'

The major properties are equipped with handlers (more or less mandatory for interactive work in python)

From now the default prefix ( "/Event/" ) coudl be omitted from any data-item. It will be added automatically.

Author:
  M.Frank

Version:
  1.0

Definition at line 92 of file DataOnDemandSvc.h.

## Public Types
typedef std::vector< std::string > | Setup
typedef ROOT::Reflex::Type | ClassH
typedef std::map< std::string, Node > | NodeMap
typedef std::map< std::string, Leaf > | AlgMap
## Public Member Functions
virtual StatusCode | initialize ()
| Inherited Service overrides: Service initialization.
virtual StatusCode | finalize ()
| Inherited Service overrides: Service finalization.
virtual StatusCode | reinitialize ()
| Inherited Service overrides: Service reinitialization.
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)
| Inherited Service overrides: query existing interfaces.
virtual void | handle (const Incident &incident)
| IIncidentListener interfaces overrides: incident handling.
| DataOnDemandSvc (const std::string &name, ISvcLocator *svc)
| Standard initializing service constructor.
virtual | ~DataOnDemandSvc ()
| Standard destructor.
void | update_1 (Property &p)
| Update handler.
void | update_2 (Property &p)
| Update handler.
void | update_3 (Property &p)
| Update handler.
## Protected Member Functions
StatusCode | configureHandler (Leaf &leaf)
| Configure handler for leaf.
StatusCode | execHandler (const std::string &tag, Leaf &leaf)
| Execute leaf handler (algorithm).
StatusCode | execHandler (const std::string &tag, Node &node)
| Execute node handler (simple object creation using seal reflection).
StatusCode | setupNodeHandlers ()
| Initialize node handlers.
StatusCode | setupAlgHandlers ()
| Initialize leaf handlers.
StatusCode | setup ()
| Setup routine (called by (re-) initialize.
StatusCode | update ()
| update the handlers
MsgStream & | stream () const
| get the message stream
StatusCode | dump (MSG::Level level=MSG::DEBUG) const
| dump the content of DataOnDemand service
## Private Types
typedef std::map< std::string, std::string > | Map
typedef SimplePropertyRef< Map > | MapRef
## Private Attributes
IIncidentSvc * | m_incSvc
| Incident service.
IAlgManager * | m_algMgr
| Algorithm manager.
IDataProviderSvc * | m_dataSvc
| Data provider reference.
std::string | m_trapType
| Trap name.
std::string | m_dataSvcName
| Data service name.
bool | m_partialPath
| Flag to allow for the creation of partial leaves.
SimpleProperty< Setup > | m_algMapping
| Mapping to algorithms.
SimpleProperty< Setup > | m_nodeMapping
| Mapping to nodes.
AlgMap | m_algs
| List of algorithms to handle incidents.
NodeMap | m_nodes
| Map of "empty" objects to be placed as intermediate nodes.
Map | m_algMap
Map | m_nodeMap
MapRef * | m_algMap_
MapRef * | m_nodeMap_
bool | m_updateRequired
std::string | m_prefix
MsgStream * | m_log
ChronoEntity | m_total
ulonglong | m_statAlg
ulonglong | m_statNode
ulonglong | m_stat
## Classes
struct | Leaf
struct | Node
| Helper class of the DataOnDemandSvc. More...
struct | Protection
| Helper class of the DataOnDemandSvc. More...
struct | Timer

## Member Typedef Documentation

typedef std::vector<std::string> DataOnDemandSvc::Setup

Definition at line 98 of file DataOnDemandSvc.h.

typedef ROOT::Reflex::Type DataOnDemandSvc::ClassH

Definition at line 99 of file DataOnDemandSvc.h.

typedef std::map<std::string, Node> DataOnDemandSvc::NodeMap

Definition at line 153 of file DataOnDemandSvc.h.

typedef std::map<std::string, Leaf> DataOnDemandSvc::AlgMap

Definition at line 154 of file DataOnDemandSvc.h.

typedef std::map<std::string,std::string> DataOnDemandSvc::Map`[private]`

Definition at line 234 of file DataOnDemandSvc.h.

typedef SimplePropertyRef<Map> DataOnDemandSvc::MapRef`[private]`

Definition at line 235 of file DataOnDemandSvc.h.

## Constructor & Destructor Documentation

DataOnDemandSvc::DataOnDemandSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc |
| ) |  |  |

Standard initializing service constructor.

Parameters:

  | name | [IN] Service name
  | svc | [IN] Pointer to service locator

Returns:
  Reference to DataOnDemandSvc object.

Definition at line 40 of file DataOnDemandSvc.cpp.

References update_1(), update_2(), and update_3().

    00041   : Service(name, svc)
    00042   , m_incSvc   ( 0 )
    00043   , m_algMgr   ( 0 )
    00044   , m_dataSvc  ( 0 )
    00045   //
    00046   , m_algMap   (   )
    00047   , m_nodeMap  (   )
    00048   , m_algMap_  ( 0 )
    00049   , m_nodeMap_ ( 0 )
    00050   //
    00051   , m_updateRequired ( true )
    00052   , m_prefix         ( "/Event/" )
    00053   , m_log      ( 0 )
    00054   , m_total    (   )
    00055   , m_statAlg  ( 0 )
    00056   , m_statNode ( 0 )
    00057   , m_stat     ( 0 )
    00058 {
    00059   declareProperty ( "Algorithms"         , m_algMapping                   ) ;
    00060   declareProperty ( "Nodes"              , m_nodeMapping                  ) ;
    00061   declareProperty ( "UsePreceedingPath"  , m_partialPath = true           ) ;
    00062   declareProperty ( "IncidentName"       , m_trapType    = "DataFault"    ) ;
    00063   declareProperty ( "DataSvc"            , m_dataSvcName = "EventDataSvc" ) ;
    00064   declareProperty ( "Prefix"             , m_prefix                       ) ;
    00065   //
    00066   m_algMap_  = new MapRef ( "AlgMap"  , m_algMap  ) ;
    00067   m_nodeMap_ = new MapRef ( "NodeMap" , m_nodeMap ) ;
    00068   declareProperty ( m_algMap_  -> name () , *m_algMap_  ) ;
    00069   declareProperty ( m_nodeMap_ -> name () , *m_nodeMap_ ) ;
    00070   m_algMap_  ->  declareUpdateHandler ( &DataOnDemandSvc::update_1 , this ) ;
    00071   m_nodeMap_ ->  declareUpdateHandler ( &DataOnDemandSvc::update_1 , this ) ;
    00072   //
    00073   m_algMapping  .declareUpdateHandler ( &DataOnDemandSvc::update_2 , this ) ;
    00074   m_nodeMapping .declareUpdateHandler ( &DataOnDemandSvc::update_3 , this ) ;
    00075 }

DataOnDemandSvc::~DataOnDemandSvc | ( |  | ) | `[virtual]`

Standard destructor.

Definition at line 247 of file DataOnDemandSvc.cpp.

References m_algMap_, m_log, and m_nodeMap_.

    00248 {
    00249   if ( 0 != m_algMap_  ) { delete m_algMap_  ; m_algMap_  = 0 ; }
    00250   if ( 0 != m_nodeMap_ ) { delete m_nodeMap_ ; m_nodeMap_ = 0 ; }
    00251   if ( 0 != m_log      ) { delete m_log      ; m_log      = 0 ; }
    00252 }

## Member Function Documentation

StatusCode DataOnDemandSvc::initialize | ( |  | ) | `[virtual]`

Inherited Service overrides: Service initialization.

Reimplemented from Service.

Definition at line 256 of file DataOnDemandSvc.cpp.

References dump(), Service::initialize(), StatusCode::isFailure(), and setup().

    00257 {
    00258   // initialize the Service Base class
    00259   StatusCode sc = Service::initialize();
    00260   if ( sc.isFailure() )  { return sc; }
    00261   sc = setup();
    00262   if ( sc.isFailure() )  { return sc; }
    00263   return dump( ) ;
    00264 }

StatusCode DataOnDemandSvc::finalize | ( |  | ) | `[virtual]`

Inherited Service overrides: Service finalization.

Reimplemented from Service.

Definition at line 318 of file DataOnDemandSvc.cpp.

References MSG::DEBUG, dump(), endreq(), Service::finalize(), StatusCode::ignore(), MSG::INFO, m_algMgr, m_dataSvc, m_incSvc, m_log, m_stat, m_statAlg, m_statNode, m_total, m_trapType, ChronoEntity::outputUserTime(), Service::release(), IInterface::release(), IIncidentSvc::removeListener(), and stream().

    00319 {
    00320   stream() << MSG::INFO
    00321            <<  " #Incidents: Alg/Node/All:"
    00322            << " " << m_statAlg << "/" << m_statNode << "/" << m_stat
    00323            << " Algorithms: " << m_total.outputUserTime () << endreq ;
    00324
    00325   // dump it!
    00326   dump ( MSG::DEBUG ).ignore() ;
    00327   //
    00328   if ( m_incSvc )
    00329   {
    00330     m_incSvc->removeListener(this, m_trapType);
    00331     m_incSvc->release();
    00332     m_incSvc = 0;
    00333   }
    00334   if ( 0 != m_algMgr  ) { m_algMgr   -> release () ; m_algMgr  = 0 ; }
    00335   if ( 0 != m_dataSvc ) { m_dataSvc  -> release () ; m_dataSvc = 0 ; }
    00336   if ( 0 != m_log     ) { delete m_log ; m_log = 0 ; }
    00337   //
    00338   return Service::finalize();
    00339 }

StatusCode DataOnDemandSvc::reinitialize | ( |  | ) | `[virtual]`

Inherited Service overrides: Service reinitialization.

Reimplemented from Service.

Definition at line 343 of file DataOnDemandSvc.cpp.

References dump(), StatusCode::isFailure(), m_algMgr, m_dataSvc, m_incSvc, m_trapType, Service::reinitialize(), Service::release(), IInterface::release(), IIncidentSvc::removeListener(), and setup().

    00344 {
    00345   // reinitialize the Service Base class
    00346   if ( 0 != m_incSvc )
    00347   {
    00348     m_incSvc->removeListener(this, m_trapType);
    00349     m_incSvc->release();
    00350     m_incSvc = 0;
    00351   }
    00352   if ( 0 != m_algMgr  ) { m_algMgr   -> release() ; m_algMgr  = 0 ; }
    00353   if ( 0 != m_dataSvc ) { m_dataSvc  -> release() ; m_dataSvc = 0 ; }
    00354   //
    00355   StatusCode sc = Service::reinitialize();
    00356   if ( sc.isFailure() )  { return sc; }
    00357   //
    00358   sc = setup() ;
    00359   if ( sc.isFailure() )  { return sc; }
    00360   //
    00361   return dump() ;
    00362 }

StatusCode DataOnDemandSvc::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvInterface |
| ) |  |  | `[virtual]`

Inherited Service overrides: query existing interfaces.

Reimplemented from Service.

Definition at line 367 of file DataOnDemandSvc.cpp.

References IID_IIncidentListener, Service::queryInterface(), and StatusCode::SUCCESS.

    00369 {
    00370   if ( IID_IIncidentListener == riid )
    00371   {
    00372     *ppvInterface = static_cast<IIncidentListener*>(this);
    00373     addRef();
    00374     return StatusCode::SUCCESS;
    00375   }
    00376   // Interface is not directly available: try out a base class
    00377   return Service::queryInterface(riid, ppvInterface);
    00378 }

void DataOnDemandSvc::handle | ( | const Incident & | incident | ) | `[virtual]`

IIncidentListener interfaces overrides: incident handling.

Implements IIncidentListener.

Definition at line 512 of file DataOnDemandSvc.cpp.

References MSG::DEBUG, endmsg(), execHandler(), m_algs, m_nodes, m_stat, m_statAlg, m_statNode, m_trapType, m_updateRequired, return, Incident::source(), stream(), DataIncident::tag(), Incident::type(), and update().

    00513 {
    00514   ++m_stat ;
    00515   // proper incident type?
    00516   if ( incident.type() != m_trapType ) { return ; }             // RETURN
    00517   const DataIncident* inc = dynamic_cast<const DataIncident*>(&incident);
    00518   if ( 0 == inc                      ) { return ; }             // RETURN
    00519   // update if needed!
    00520   if ( m_updateRequired ) { update() ; }
    00521   const std::string& tag = inc->tag();
    00522   stream()
    00523     << MSG::DEBUG
    00524     << "Incident: [" << incident.type   () << "] "
    00525     << " = "         << incident.source ()
    00526     << " Location:"  << tag  << endmsg;
    00527   NodeMap::iterator icl = m_nodes.find ( tag ) ;
    00528   if ( icl != m_nodes.end() )
    00529   {
    00530     StatusCode sc = execHandler ( tag , icl->second ) ;
    00531     if ( sc.isSuccess() ) { ++m_statNode ; }
    00532     return ;                                                        // RETURN
    00533   }
    00534   AlgMap::iterator ialg = m_algs.find ( tag ) ;
    00535   if ( ialg != m_algs.end() )
    00536   {
    00537     StatusCode sc = execHandler ( tag , ialg->second ) ;
    00538     if ( sc.isSuccess() ) { ++m_statAlg ; }
    00539     return ;                                                        // RETURN
    00540   }
    00541 }

StatusCode DataOnDemandSvc::configureHandler | ( | Leaf & | leaf | ) | `[protected]`

Configure handler for leaf.

Parameters:

  | leaf | [IN] Reference to leaf handler

Returns:
  StatusCode indicating success or failure

Definition at line 492 of file DataOnDemandSvc.cpp.

References DataOnDemandSvc::Leaf::algorithm, IAlgManager::createAlgorithm(), endmsg(), MSG::ERROR, StatusCode::FAILURE, IAlgManager::getAlgorithm(), StatusCode::isFailure(), m_algMgr, DataOnDemandSvc::Leaf::name, stream(), and DataOnDemandSvc::Leaf::type.

Referenced by execHandler().

    00493 {
    00494   if ( 0 == m_algMgr  ) { return StatusCode::FAILURE ; }
    00495   StatusCode sc = m_algMgr->getAlgorithm(l.name, l.algorithm);
    00496   if ( sc.isFailure() )
    00497   {
    00498     sc = m_algMgr->createAlgorithm(l.type, l.name, l.algorithm, true );
    00499     if ( sc.isFailure() )
    00500     {
    00501       stream()
    00502         << MSG::ERROR
    00503         << "Failed to create algorithm of type:"
    00504         << l.name << "[" << l.type << "] " << endmsg;
    00505     }
    00506   }
    00507   return sc;
    00508 }

StatusCode DataOnDemandSvc::execHandler | ( | const std::string & | tag,
|  | Leaf & | leaf |
| ) |  |  | `[protected]`

Execute leaf handler (algorithm).

Parameters:

  | tag | [IN] Path to requested leaf
  | leaf | [IN] Reference to leaf handler

Returns:
  StatusCode indicating success or failure

Definition at line 591 of file DataOnDemandSvc.cpp.

References DataOnDemandSvc::Leaf::algorithm, configureHandler(), endmsg(), MSG::ERROR, DataOnDemandSvc::Leaf::executing, StatusCode::FAILURE, StatusCode::isFailure(), m_total, INamedInterface::name(), DataOnDemandSvc::Leaf::name, stream(), StatusCode::SUCCESS, IAlgorithm::sysExecute(), and DataOnDemandSvc::Leaf::type.

Referenced by handle().

    00592 {
    00593   //
    00594   if ( l.executing ) { return StatusCode::FAILURE ; }             // RETURN
    00595   //
    00596   if ( 0 == l.algorithm )
    00597   {
    00598     StatusCode sc = configureHandler ( l ) ;
    00599     if ( sc.isFailure() )
    00600     {
    00601       stream()
    00602         << MSG::ERROR
    00603         << "Failed to configure handler for: "
    00604         << l.name << "[" << l.type << "] " << tag << endmsg;
    00605       return sc ;                                                 // RETURN
    00606     }
    00607   }
    00608   //
    00609   Timer timer ( m_total ) ;
    00610   //
    00611   Protection p(l.executing);
    00612   StatusCode sc = l.algorithm->sysExecute();
    00613   if ( sc.isFailure() )
    00614   {
    00615     stream() << MSG::ERROR
    00616              << "Failed to execute the algorithm:"
    00617              << l.algorithm->name() << " for location:" << tag << endmsg;
    00618     return sc ;                                                       // RETURN
    00619   }
    00620   //
    00621   return StatusCode::SUCCESS ;
    00622 }

StatusCode DataOnDemandSvc::execHandler | ( | const std::string & | tag,
|  | Node & | node |
| ) |  |  | `[protected]`

Execute node handler (simple object creation using seal reflection).

Parameters:

  | tag | [IN] Path to requested leaf
  | node | [IN] Reference to node handler

Returns:
  StatusCode indicating success or failure

Definition at line 546 of file DataOnDemandSvc.cpp.

References DataOnDemandSvc::Node::clazz, endmsg(), MSG::ERROR, DataOnDemandSvc::Node::executing, StatusCode::FAILURE, StatusCode::isFailure(), m_dataSvc, DataOnDemandSvc::Node::name, Object, IDataProviderSvc::registerObject(), stream(), and StatusCode::SUCCESS.

    00547 {
    00548   if ( n.executing ) { return StatusCode::FAILURE ; }            // RETURN
    00549
    00550   // try to recover the handler
    00551   if ( !n.clazz  ) { n.clazz = ROOT::Reflex::Type::ByName(n.name) ; }
    00552   if ( !n.clazz  )
    00553   {
    00554     stream()
    00555       << MSG::ERROR
    00556       << "Failed to get dictionary for class '"
    00557       << n.name
    00558       << "' for location:" << tag << endmsg;
    00559     return StatusCode::FAILURE ;                               // RETURN
    00560   }
    00561
    00562   ROOT::Reflex::Object obj = n.clazz.Construct();
    00563   DataObject* pO = (DataObject*)obj.Address();
    00564   if ( !pO )
    00565   {
    00566     stream()
    00567       << MSG::ERROR
    00568       << "Failed to create an object of type:"
    00569       << n.clazz.Name(ROOT::Reflex::SCOPED) << " for location:" << tag
    00570       << endmsg;
    00571     return StatusCode::FAILURE  ;                               // RETURN
    00572   }
    00573   //
    00574   Protection p(n.executing);
    00575   StatusCode sc = m_dataSvc->registerObject(tag, pO);
    00576   if ( sc.isFailure() )
    00577   {
    00578     stream()
    00579       << MSG::ERROR << "Failed to register an object of type:"
    00580       << n.clazz.Name(ROOT::Reflex::SCOPED) << " at location:" << tag
    00581       << endmsg;
    00582     return sc ;                                                  // RETURN
    00583   }
    00584   //
    00585   return StatusCode::SUCCESS ;
    00586 }

StatusCode DataOnDemandSvc::setupNodeHandlers | ( |  | ) | `[protected]`

Initialize node handlers.

Definition at line 429 of file DataOnDemandSvc.cpp.

References m_nodeMap, m_nodeMapping, m_updateRequired, StatusCode::SUCCESS, and toupper().

Referenced by setup(), and update_3().

    00430 {
    00431   Setup::const_iterator j;
    00432   std::string nam, typ, tag;
    00433   StatusCode sc = StatusCode::SUCCESS;
    00434   // Setup for node leafs, where simply a constructor is called...
    00435   for ( j=m_nodeMapping.value().begin(); j != m_nodeMapping.value().end(); ++j)
    00436   {
    00437     Tokenizer tok(true);
    00438     tok.analyse(*j, " ", "", "", "=", "'", "'");
    00439     for ( Tokenizer::Items::iterator i = tok.items().begin();
    00440           i != tok.items().end(); i++ )   {
    00441       const std::string& t = (*i).tag();
    00442       const std::string& v = (*i).value();
    00443       switch( ::toupper(t[0]) )    {
    00444       case 'D':
    00445         tag = v;
    00446         break;
    00447       case 'T':
    00448         nam = v;
    00449         break;
    00450       }
    00451     }
    00452     m_nodeMap[tag] = nam ;
    00453   }
    00454   //
    00455   m_updateRequired = true ;
    00456   //
    00457   return sc;
    00458 }

StatusCode DataOnDemandSvc::setupAlgHandlers | ( |  | ) | `[protected]`

Initialize leaf handlers.

Definition at line 462 of file DataOnDemandSvc.cpp.

References m_algMap, m_algMapping, m_algs, m_updateRequired, ListItem::name(), StatusCode::SUCCESS, toupper(), and ListItem::type().

Referenced by setup(), and update_2().

    00463 {
    00464   Setup::const_iterator j;
    00465   std::string typ, tag;
    00466   m_algs.clear();
    00467   for(j=m_algMapping.value().begin(); j != m_algMapping.value().end(); ++j)
    00468   {
    00469     Tokenizer tok(true);
    00470     tok.analyse(*j, " ", "", "", "=", "'", "'");
    00471     for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++ )   {
    00472       const std::string& t = (*i).tag();
    00473       const std::string& v = (*i).value();
    00474       switch( ::toupper(t[0]) )    {
    00475       case 'D':
    00476         tag = v;
    00477         break;
    00478       case 'T':
    00479         typ = v;
    00480         break;
    00481       }
    00482     }
    00483     ListItem item(typ);
    00484     m_algMap[tag] = item.type() + "/" + item.name() ;
    00485   }
    00486   m_updateRequired = true ;
    00487   return StatusCode::SUCCESS;
    00488 }

StatusCode DataOnDemandSvc::setup | ( |  | ) | `[protected]`

Setup routine (called by (re-) initialize.

Definition at line 382 of file DataOnDemandSvc.cpp.

References IIncidentSvc::addListener(), endmsg(), endreq(), MSG::ERROR, IID_IAlgManager, StatusCode::isFailure(), m_algMgr, m_dataSvc, m_dataSvcName, m_incSvc, m_trapType, IInterface::queryInterface(), Service::service(), Service::serviceLocator(), setupAlgHandlers(), setupNodeHandlers(), stream(), and update().

Referenced by initialize(), and reinitialize().

    00383 {
    00384   m_algMgr = 0;
    00385   StatusCode sc =
    00386     serviceLocator()->queryInterface(IID_IAlgManager, pp_cast<void>(&m_algMgr));
    00387   if ( sc.isFailure () )
    00388   {
    00389     stream()
    00390       << MSG::ERROR
    00391       << "Failed to retrieve the IAlgManager interface." << endmsg;
    00392     return sc;
    00393   }
    00394   sc = service("IncidentSvc", m_incSvc, true);
    00395   if ( sc.isFailure () )
    00396   {
    00397     stream()
    00398       << MSG::ERROR << "Failed to retrieve Incident service." << endmsg;
    00399     return sc;
    00400   }
    00401   m_incSvc->addListener(this, m_trapType);
    00402   sc = service(m_dataSvcName, m_dataSvc, true);
    00403   if ( sc.isFailure () )
    00404   {
    00405     stream()
    00406       << MSG::ERROR
    00407       << "Failed to retrieve the data provider interface of "
    00408       << m_dataSvcName << endmsg;
    00409     return sc;
    00410   }
    00411   sc = setupNodeHandlers() ;
    00412   if ( sc.isFailure() )
    00413   {
    00414     stream() << MSG::ERROR << "Failed to setup nodes " << endreq ;
    00415     return sc ;
    00416   }
    00417   sc = setupAlgHandlers();
    00418   if ( sc.isFailure() )
    00419   {
    00420     stream() << MSG::ERROR << "Failed to setup algorithms " << endreq ;
    00421     return sc ;
    00422   }
    00423   //
    00424   return update() ;
    00425 }

void DataOnDemandSvc::update_1 | ( | Property & | p | ) |

Update handler.

Definition at line 79 of file DataOnDemandSvc.cpp.

References endreq(), m_updateRequired, stream(), and MSG::VERBOSE.

Referenced by DataOnDemandSvc().

    00080 {
    00081   stream()
    00082     << MSG::VERBOSE << " I am update handler for property " << p << endreq ;
    00083   // force update
    00084   m_updateRequired = true ;
    00085 }

void DataOnDemandSvc::update_2 | ( | Property & | p | ) |

Update handler.

Definition at line 104 of file DataOnDemandSvc.cpp.

References endreq(), MSG::ERROR, m_updateRequired, setupAlgHandlers(), stream(), and MSG::VERBOSE.

Referenced by DataOnDemandSvc().

    00105 {
    00106   stream()
    00107     << MSG::VERBOSE << " I am update handler for property " << p << endreq ;
    00108   if ( setupAlgHandlers().isFailure() )
    00109   {
    00110     stream()
    00111       << MSG::ERROR << " Error from setupAlgHandlers " << endreq ;
    00112   }
    00113   // force update
    00114   m_updateRequired = true ;
    00115 }

void DataOnDemandSvc::update_3 | ( | Property & | p | ) |

Update handler.

Definition at line 89 of file DataOnDemandSvc.cpp.

References endreq(), MSG::ERROR, m_updateRequired, setupNodeHandlers(), stream(), and MSG::VERBOSE.

Referenced by DataOnDemandSvc().

    00090 {
    00091   stream()
    00092     << MSG::VERBOSE << " I am update handler for property " << p << endreq ;
    00093   if ( setupNodeHandlers().isFailure() )
    00094   {
    00095     stream()
    00096       << MSG::ERROR << " Error from setupNodeHandlers " << endreq ;
    00097   }
    00098   // force update
    00099   m_updateRequired = true ;
    00100 }

StatusCode DataOnDemandSvc::update | ( |  | ) | `[protected]`

update the handlers

add the default prefix

add the default prefix

get all directories

setup algorithms

setup nodes

Definition at line 194 of file DataOnDemandSvc.cpp.

References add_prefix(), endmsg(), find(), get_dirs(), m_algMap, m_algs, m_nodeMap, m_nodes, m_partialPath, m_prefix, m_updateRequired, ListItem::name(), stream(), StatusCode::SUCCESS, ListItem::type(), and MSG::WARNING.

Referenced by handle(), and setup().

    00195 {
    00197   add_prefix ( m_algMap  , m_prefix ) ;
    00199   add_prefix ( m_nodeMap , m_prefix ) ;
    00201   typedef std::set<std::string> Set ;
    00202   Set dirs ;
    00203   if ( m_partialPath ){ get_dirs ( m_algMap  , dirs ) ; }
    00204   if ( m_partialPath ){ get_dirs ( m_nodeMap , dirs ) ; }
    00205   //
    00206   Set::iterator _e = dirs.find("/Event") ;
    00207   if ( dirs.end() != _e ) { dirs.erase( _e ) ; }
    00208   // add all directories as nodes
    00209   for ( Set::const_iterator dir = dirs.begin() ; dirs.end() != dir ; ++dir )
    00210   {
    00211     if ( m_algMap  .end () != m_algMap  .find ( *dir ) ) { continue ; }
    00212     if ( m_nodeMap .end () != m_nodeMap .find ( *dir ) ) { continue ; }
    00213     m_nodeMap [*dir] = "DataObject" ;
    00214   }
    00215   //
    00216   m_algs  .clear  () ;
    00217   m_nodes .clear () ;
    00218   //
    00220   for ( Map::const_iterator ialg = m_algMap.begin() ;
    00221         m_algMap.end() != ialg ; ++ialg )
    00222   {
    00223     ListItem alg ( ialg->second ) ;
    00224     m_algs[ialg->first] =  Leaf( alg.type() , alg.name() ) ;
    00225   }
    00227   for ( Map::const_iterator inode = m_nodeMap.begin() ;
    00228         m_nodeMap.end() != inode ; ++inode )
    00229   {
    00230     ClassH cl = ROOT::Reflex::Type::ByName( inode->second ) ;
    00231     if ( !cl )
    00232     {
    00233       stream() << MSG::WARNING
    00234                << "Failed to access dictionary class for "
    00235                << inode->first << " of type:" << inode->second << endmsg;
    00236     }
    00237     m_nodes[inode->first] = Node ( cl , false , inode->second ) ;
    00238   }
    00240   m_updateRequired = false ;
    00241   //
    00242   return StatusCode::SUCCESS ;
    00243 }

MsgStream& DataOnDemandSvc::stream | ( |  | ) | const`[inline, protected]`

get the message stream

Definition at line 205 of file DataOnDemandSvc.h.

References m_log, Service::msgSvc(), and Service::name().

Referenced by configureHandler(), dump(), execHandler(), finalize(), handle(), setup(), update(), update_1(), update_2(), and update_3().

    00206   {
    00207     if ( 0 == m_log ) { m_log = new MsgStream( msgSvc() , name() ) ; }
    00208     return *m_log;
    00209   }

StatusCode DataOnDemandSvc::dump | ( | MSG::Level | level = `MSG::DEBUG` | ) | const`[protected]`

dump the content of DataOnDemand service

Definition at line 268 of file DataOnDemandSvc.cpp.

References DataOnDemandSvc::Leaf::algorithm, DataOnDemandSvc::Node::clazz, endmsg(), endreq(), format(), m_algs, m_nodes, m_prefix, DataOnDemandSvc::Node::name, DataOnDemandSvc::Leaf::name, no_prefix(), stream(), StatusCode::SUCCESS, DataOnDemandSvc::Leaf::type, and MSG::WARNING.

Referenced by finalize(), initialize(), and reinitialize().

    00269 {
    00270   if ( !m_algs.empty()  || m_nodes.empty() )
    00271   {
    00272     stream() << level << "DataOnDemand Actions enabled for:" << endmsg;
    00273     Map _m ;
    00274     for ( AlgMap::const_iterator alg = m_algs.begin() ;
    00275           m_algs.end() != alg ; ++alg )
    00276     {
    00277       Map::const_iterator check = _m.find(alg->first) ;
    00278       if ( _m.end() != check )
    00279       {
    00280         stream() << MSG::WARNING
    00281                  << " The data item is activated for '"
    00282                  << check->first << "' as '" << check->second << "'" << endreq ;
    00283       }
    00284       boost::format fmt ("%1% %|40t|%2%") ;
    00285       const Leaf& l = alg->second ;
    00286       fmt
    00287         % ( l.name == l.type ? l.type  : (l.type+"/"+l.name) )
    00288         % ( 0 == l.algorithm ? "F"     : "T"                 ) ;
    00289       _m[alg->first] = boost::str( fmt ) ;
    00290     }
    00291     for ( NodeMap::const_iterator node = m_nodes.begin() ;
    00292           m_nodes.end() != node ; ++node )
    00293     {
    00294       Map::const_iterator check = _m.find(node->first) ;
    00295       if ( _m.end() != check )
    00296       {
    00297         stream() << MSG::WARNING
    00298                  << " The data item is already activated for '"
    00299                  << check->first << "' as '" << check->second << "'" << endreq ;
    00300       }
    00301       boost::format fmt ("%1% %|40t|%2%") ;
    00302       const Node& n = node->second ;
    00303       fmt % ( "'" + n.name + "'" ) % ( n.clazz ? "T" : "F" ) ;
    00304       _m[node->first] = boost::str( fmt ) ;
    00305     }
    00306     for ( Map::const_iterator item = _m.begin() ; _m.end() != item ; ++item )
    00307     {
    00308       boost::format fmt( "  %1% %|45t|%2% " ) ;
    00309       fmt % no_prefix( item->first , m_prefix )  % item->second ;
    00310       stream() << level  << boost::str( fmt ) << endreq ;
    00311     }
    00312   }
    00313   return StatusCode::SUCCESS ;
    00314 }

## Member Data Documentation

IIncidentSvc* DataOnDemandSvc::m_incSvc`[private]`

Incident service.

Definition at line 214 of file DataOnDemandSvc.h.

Referenced by finalize(), reinitialize(), and setup().

IAlgManager* DataOnDemandSvc::m_algMgr`[private]`

Algorithm manager.

Definition at line 216 of file DataOnDemandSvc.h.

Referenced by configureHandler(), finalize(), reinitialize(), and setup().

IDataProviderSvc* DataOnDemandSvc::m_dataSvc`[private]`

Data provider reference.

Definition at line 218 of file DataOnDemandSvc.h.

Referenced by execHandler(), finalize(), reinitialize(), and setup().

std::string DataOnDemandSvc::m_trapType`[private]`

Trap name.

Definition at line 220 of file DataOnDemandSvc.h.

Referenced by finalize(), handle(), reinitialize(), and setup().

std::string DataOnDemandSvc::m_dataSvcName`[private]`

Data service name.

Definition at line 222 of file DataOnDemandSvc.h.

Referenced by setup().

bool DataOnDemandSvc::m_partialPath`[private]`

Flag to allow for the creation of partial leaves.

Definition at line 224 of file DataOnDemandSvc.h.

Referenced by update().

SimpleProperty<Setup> DataOnDemandSvc::m_algMapping`[private]`

Mapping to algorithms.

Definition at line 226 of file DataOnDemandSvc.h.

Referenced by setupAlgHandlers().

SimpleProperty<Setup> DataOnDemandSvc::m_nodeMapping`[private]`

Mapping to nodes.

Definition at line 228 of file DataOnDemandSvc.h.

Referenced by setupNodeHandlers().

AlgMap DataOnDemandSvc::m_algs`[private]`

List of algorithms to handle incidents.

Definition at line 230 of file DataOnDemandSvc.h.

Referenced by dump(), handle(), setupAlgHandlers(), and update().

NodeMap DataOnDemandSvc::m_nodes`[private]`

Map of "empty" objects to be placed as intermediate nodes.

Definition at line 232 of file DataOnDemandSvc.h.

Referenced by dump(), handle(), and update().

Map DataOnDemandSvc::m_algMap`[private]`

Definition at line 236 of file DataOnDemandSvc.h.

Referenced by setupAlgHandlers(), and update().

Map DataOnDemandSvc::m_nodeMap`[private]`

Definition at line 237 of file DataOnDemandSvc.h.

Referenced by setupNodeHandlers(), and update().

MapRef* DataOnDemandSvc::m_algMap_`[private]`

Definition at line 238 of file DataOnDemandSvc.h.

Referenced by ~DataOnDemandSvc().

MapRef* DataOnDemandSvc::m_nodeMap_`[private]`

Definition at line 239 of file DataOnDemandSvc.h.

Referenced by ~DataOnDemandSvc().

bool DataOnDemandSvc::m_updateRequired`[private]`

Definition at line 240 of file DataOnDemandSvc.h.

Referenced by handle(), setupAlgHandlers(), setupNodeHandlers(), update(), update_1(), update_2(), and update_3().

std::string DataOnDemandSvc::m_prefix`[private]`

Definition at line 241 of file DataOnDemandSvc.h.

Referenced by dump(), and update().

MsgStream* DataOnDemandSvc::m_log`[mutable, private]`

Definition at line 242 of file DataOnDemandSvc.h.

Referenced by finalize(), stream(), and ~DataOnDemandSvc().

ChronoEntity DataOnDemandSvc::m_total`[private]`

Definition at line 243 of file DataOnDemandSvc.h.

Referenced by execHandler(), and finalize().

ulonglong DataOnDemandSvc::m_statAlg`[private]`

Definition at line 244 of file DataOnDemandSvc.h.

Referenced by finalize(), and handle().

ulonglong DataOnDemandSvc::m_statNode`[private]`

Definition at line 245 of file DataOnDemandSvc.h.

Referenced by finalize(), and handle().

ulonglong DataOnDemandSvc::m_stat`[private]`

Definition at line 246 of file DataOnDemandSvc.h.

Referenced by finalize(), and handle().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/IncidentSvc/DataOnDemandSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/IncidentSvc/DataOnDemandSvc.cpp