![]() |
|
|
Generated: 8 Jan 2009 |
#include <IncidentSvc/DataOnDemandSvc.h>


In the job options handlers can be declared, which allow to configure this service. Such handlers are either:
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.
Definition at line 89 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) |
| void | update_2 (Property &p) |
| void | update_3 (Property &p) |
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 | |
| void | dump (const MSG::Level level, const bool mode=true) const |
| dump the content of DataOnDemand service | |
Private Types | |
| typedef std::map< std::string, std::string > | Map |
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. | |
| bool | m_dump |
| flag to force the printout | |
| Setup | m_algMapping |
| Mapping to algorithms. | |
| Setup | m_nodeMapping |
| Mapping to nodes. | |
| AlgMap | m_algs |
| Map of algorithms to handle incidents. | |
| NodeMap | m_nodes |
| Map of "empty" objects to be placed as intermediate nodes. | |
| Map | m_algMap |
| the major configuration property { 'data' : 'algorithm' } | |
| Map | m_nodeMap |
| the major configuration property { 'data' : 'type' } | |
| 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 |
| typedef std::vector<std::string> DataOnDemandSvc::Setup |
Definition at line 96 of file DataOnDemandSvc.h.
| typedef ROOT::Reflex::Type DataOnDemandSvc::ClassH |
Definition at line 97 of file DataOnDemandSvc.h.
| typedef std::map<std::string, Node> DataOnDemandSvc::NodeMap |
Definition at line 168 of file DataOnDemandSvc.h.
| typedef std::map<std::string, Leaf> DataOnDemandSvc::AlgMap |
Definition at line 169 of file DataOnDemandSvc.h.
typedef std::map<std::string,std::string> DataOnDemandSvc::Map [private] |
Definition at line 267 of file DataOnDemandSvc.h.
| DataOnDemandSvc::DataOnDemandSvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Standard initializing service constructor.
| name | [IN] Service name | |
| svc | [IN] Pointer to service locator |
Definition at line 39 of file DataOnDemandSvc.cpp.
00040 : Service(name, svc) 00041 , m_incSvc ( 0 ) 00042 , m_algMgr ( 0 ) 00043 , m_dataSvc ( 0 ) 00044 // 00045 , m_trapType ( "DataFault") 00046 , m_dataSvcName ( "EventDataSvc" ) 00047 , m_partialPath ( true ) 00048 , m_dump ( false ) 00049 // 00050 , m_algMapping () 00051 , m_nodeMapping () 00052 // 00053 , m_algMap ( ) 00054 , m_nodeMap ( ) 00055 // 00056 , m_updateRequired ( true ) 00057 , m_prefix ( "/Event/" ) 00058 , m_log ( 0 ) 00059 , m_total ( ) 00060 , m_statAlg ( 0 ) 00061 , m_statNode ( 0 ) 00062 , m_stat ( 0 ) 00063 { 00064 // ========================================================================== 00065 declareProperty ( "IncidentName" , m_trapType ) ; 00066 declareProperty ( "DataSvc" , m_dataSvcName ) ; 00067 declareProperty ( "UsePreceedingPath" , m_partialPath ) ; 00068 declareProperty ( "Dump" , m_dump ) ; 00069 // 00070 declareProperty ( "Algorithms" , m_algMapping ) -> 00071 declareUpdateHandler ( &DataOnDemandSvc::update_2 , this ) ; 00072 declareProperty ( "Nodes" , m_nodeMapping ) -> 00073 declareUpdateHandler ( &DataOnDemandSvc::update_3 , this ) ; 00074 // 00075 declareProperty ( "AlgMap" , m_algMap ) -> 00076 declareUpdateHandler ( &DataOnDemandSvc::update_1 , this ) ; 00077 declareProperty ( "NodeMap" , m_nodeMap ) -> 00078 declareUpdateHandler ( &DataOnDemandSvc::update_1 , this ) ; 00079 // 00080 declareProperty ( "Prefix" , m_prefix ) ; 00081 // ========================================================================== 00082 }
| DataOnDemandSvc::~DataOnDemandSvc | ( | ) | [virtual] |
| StatusCode DataOnDemandSvc::initialize | ( | ) | [virtual] |
Inherited Service overrides: Service initialization.
Reimplemented from Service.
Definition at line 272 of file DataOnDemandSvc.cpp.
00273 { 00274 // initialize the Service Base class 00275 StatusCode sc = Service::initialize(); 00276 if ( sc.isFailure() ) { return sc; } 00277 sc = setup(); 00278 if ( sc.isFailure() ) { return sc; } 00279 // 00280 if ( m_dump ) { dump ( MSG::INFO ) ; } 00281 else if ( MSG::DEBUG >= outputLevel() ) { dump ( MSG::DEBUG ) ; } 00282 // 00283 return StatusCode::SUCCESS ; 00284 }
| StatusCode DataOnDemandSvc::finalize | ( | void | ) | [virtual] |
Inherited Service overrides: Service finalization.
Reimplemented from Service.
Definition at line 403 of file DataOnDemandSvc.cpp.
00404 { 00405 // 00406 stream () 00407 << MSG::INFO 00408 << "Handled \"" << m_trapType << "\" incidents: " 00409 << m_statAlg << "/" << m_statNode << "/" << m_stat << "(Alg/Node/Total)." 00410 << endreq ; 00411 if ( m_dump || MSG::DEBUG >= outputLevel() ) 00412 { 00413 stream () 00414 << MSG::INFO 00415 << m_total.outputUserTime 00416 ( "Algorithm timing: Mean(+-rms)/Min/Max:%3%(+-%4%)/%6%/%7%[ms] " , System::milliSec ) 00417 << m_total.outputUserTime ( "Total:%2%[s]" , System::Sec ) << endreq ; 00418 } 00419 // dump it! 00420 if ( m_dump ) { dump ( MSG::INFO , false ) ; } 00421 else if ( MSG::DEBUG >= outputLevel() ) { dump ( MSG::DEBUG , false ) ; } 00422 // 00423 if ( m_incSvc ) 00424 { 00425 m_incSvc->removeListener(this, m_trapType); 00426 m_incSvc->release(); 00427 m_incSvc = 0; 00428 } 00429 if ( 0 != m_algMgr ) { m_algMgr -> release () ; m_algMgr = 0 ; } 00430 if ( 0 != m_dataSvc ) { m_dataSvc -> release () ; m_dataSvc = 0 ; } 00431 // 00432 return Service::finalize(); 00433 }
| StatusCode DataOnDemandSvc::reinitialize | ( | ) | [virtual] |
Inherited Service overrides: Service reinitialization.
re-initialization of the service
Reimplemented from Service.
Definition at line 437 of file DataOnDemandSvc.cpp.
00438 { 00439 // reinitialize the Service Base class 00440 if ( 0 != m_incSvc ) 00441 { 00442 m_incSvc -> removeListener ( this , m_trapType ); 00443 m_incSvc -> release (); 00444 m_incSvc = 0; 00445 } 00446 if ( 0 != m_algMgr ) { m_algMgr -> release() ; m_algMgr = 0 ; } 00447 if ( 0 != m_dataSvc ) { m_dataSvc -> release() ; m_dataSvc = 0 ; } 00448 if ( 0 != m_log ) { delete m_log ; m_log = 0 ; } 00449 // 00450 StatusCode sc = Service::reinitialize(); 00451 if ( sc.isFailure() ) { return sc; } 00452 // 00453 sc = setup() ; 00454 if ( sc.isFailure() ) { return sc; } 00455 // 00456 if ( m_dump ) { dump ( MSG::INFO ) ; } 00457 else if ( MSG::DEBUG >= outputLevel() ) { dump ( MSG::DEBUG ) ; } 00458 // 00459 return StatusCode::SUCCESS ; 00460 }
| StatusCode DataOnDemandSvc::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvInterface | |||
| ) | [virtual] |
Inherited Service overrides: query existing interfaces.
Reimplemented from Service.
Definition at line 465 of file DataOnDemandSvc.cpp.
00467 { 00468 if ( IIncidentListener::interfaceID() == riid ) 00469 { 00470 *ppvInterface = static_cast<IIncidentListener*>(this); 00471 addRef(); 00472 return StatusCode::SUCCESS; 00473 } 00474 // Interface is not directly available: try out a base class 00475 return Service::queryInterface(riid, ppvInterface); 00476 }
| void DataOnDemandSvc::handle | ( | const Incident & | incident | ) | [virtual] |
IIncidentListener interfaces overrides: incident handling.
Implements IIncidentListener.
Definition at line 615 of file DataOnDemandSvc.cpp.
00616 { 00617 ++m_stat ; 00618 // proper incident type? 00619 if ( incident.type() != m_trapType ) { return ; } // RETURN 00620 const DataIncident* inc = dynamic_cast<const DataIncident*>(&incident); 00621 if ( 0 == inc ) { return ; } // RETURN 00622 // update if needed! 00623 if ( m_updateRequired ) { update() ; } 00624 const std::string& tag = inc->tag(); 00625 if ( MSG::VERBOSE >= outputLevel() ) 00626 { 00627 stream() 00628 << MSG::VERBOSE 00629 << "Incident: [" << incident.type () << "] " 00630 << " = " << incident.source () 00631 << " Location:" << tag << endmsg; 00632 } 00633 // ========================================================================== 00634 NodeMap::iterator icl = m_nodes.find ( tag ) ; 00635 if ( icl != m_nodes.end() ) 00636 { 00637 StatusCode sc = execHandler ( tag , icl->second ) ; 00638 if ( sc.isSuccess() ) { ++m_statNode ; } 00639 return ; // RETURN 00640 } 00641 // ========================================================================== 00642 AlgMap::iterator ialg = m_algs.find ( tag ) ; 00643 if ( ialg != m_algs.end() ) 00644 { 00645 StatusCode sc = execHandler ( tag , ialg->second ) ; 00646 if ( sc.isSuccess() ) { ++m_statAlg ; } 00647 return ; // RETURN 00648 } 00649 }
| StatusCode DataOnDemandSvc::configureHandler | ( | Leaf & | leaf | ) | [protected] |
Configure handler for leaf.
| leaf | [IN] Reference to leaf handler |
Definition at line 595 of file DataOnDemandSvc.cpp.
00596 { 00597 if ( 0 == m_algMgr ) { return StatusCode::FAILURE ; } 00598 StatusCode sc = m_algMgr->getAlgorithm(l.name, l.algorithm); 00599 if ( sc.isFailure() ) 00600 { 00601 sc = m_algMgr->createAlgorithm(l.type, l.name, l.algorithm, true ); 00602 if ( sc.isFailure() ) 00603 { 00604 stream() 00605 << MSG::ERROR 00606 << "Failed to create algorithm " 00607 << l.type << "('" << l.name<< "')" << endmsg; 00608 } 00609 } 00610 return sc; 00611 }
| StatusCode DataOnDemandSvc::execHandler | ( | const std::string & | tag, | |
| Leaf & | leaf | |||
| ) | [protected] |
Execute leaf handler (algorithm).
| tag | [IN] Path to requested leaf | |
| leaf | [IN] Reference to leaf handler |
Definition at line 700 of file DataOnDemandSvc.cpp.
00701 { 00702 // 00703 if ( l.executing ) { return StatusCode::FAILURE ; } // RETURN 00704 // 00705 if ( 0 == l.algorithm ) 00706 { 00707 StatusCode sc = configureHandler ( l ) ; 00708 if ( sc.isFailure() ) 00709 { 00710 stream() 00711 << MSG::ERROR 00712 << "Failed to configure handler for: " 00713 << l.name << "[" << l.type << "] " << tag << endmsg; 00714 return sc ; // RETURN 00715 } 00716 } 00717 // 00718 Timer timer ( m_total ) ; 00719 // 00720 Protection p(l.executing); 00721 StatusCode sc = l.algorithm->sysExecute(); 00722 if ( sc.isFailure() ) 00723 { 00724 stream() << MSG::ERROR 00725 << "Failed to execute the algorithm:" 00726 << l.algorithm->name() << " for location:" << tag << endmsg; 00727 return sc ; // RETURN 00728 } 00729 ++l.num ; 00730 // 00731 return StatusCode::SUCCESS ; 00732 }
| StatusCode DataOnDemandSvc::execHandler | ( | const std::string & | tag, | |
| Node & | node | |||
| ) | [protected] |
Execute node handler (simple object creation using seal reflection).
| tag | [IN] Path to requested leaf | |
| node | [IN] Reference to node handler |
Definition at line 654 of file DataOnDemandSvc.cpp.
00655 { 00656 if ( n.executing ) { return StatusCode::FAILURE ; } // RETURN 00657 00658 // try to recover the handler 00659 if ( !n.clazz ) { n.clazz = ROOT::Reflex::Type::ByName(n.name) ; } 00660 if ( !n.clazz ) 00661 { 00662 stream() 00663 << MSG::ERROR 00664 << "Failed to get dictionary for class '" 00665 << n.name 00666 << "' for location:" << tag << endmsg; 00667 return StatusCode::FAILURE ; // RETURN 00668 } 00669 00670 ROOT::Reflex::Object obj = n.clazz.Construct(); 00671 DataObject* pO = (DataObject*)obj.Address(); 00672 if ( !pO ) 00673 { 00674 stream() 00675 << MSG::ERROR 00676 << "Failed to create an object of type:" 00677 << n.clazz.Name(ROOT::Reflex::SCOPED) << " for location:" << tag 00678 << endmsg; 00679 return StatusCode::FAILURE ; // RETURN 00680 } 00681 // 00682 Protection p(n.executing); 00683 StatusCode sc = m_dataSvc->registerObject(tag, pO); 00684 if ( sc.isFailure() ) 00685 { 00686 stream() 00687 << MSG::ERROR << "Failed to register an object of type:" 00688 << n.clazz.Name(ROOT::Reflex::SCOPED) << " at location:" << tag 00689 << endmsg; 00690 return sc ; // RETURN 00691 } 00692 ++n.num ; 00693 // 00694 return StatusCode::SUCCESS ; 00695 }
| StatusCode DataOnDemandSvc::setupNodeHandlers | ( | ) | [protected] |
Initialize node handlers.
Definition at line 514 of file DataOnDemandSvc.cpp.
00515 { 00516 Setup::const_iterator j; 00517 std::string nam, typ, tag; 00518 StatusCode sc = StatusCode::SUCCESS; 00519 // Setup for node leafs, where simply a constructor is called... 00520 for ( j=m_nodeMapping.begin(); j != m_nodeMapping.end(); ++j) 00521 { 00522 Tokenizer tok(true); 00523 tok.analyse(*j, " ", "", "", "=", "'", "'"); 00524 for ( Tokenizer::Items::iterator i = tok.items().begin(); 00525 i != tok.items().end(); i++ ) { 00526 const std::string& t = (*i).tag(); 00527 const std::string& v = (*i).value(); 00528 switch( ::toupper(t[0]) ) { 00529 case 'D': 00530 tag = v; 00531 break; 00532 case 'T': 00533 nam = v; 00534 break; 00535 } 00536 } 00537 if ( m_algMap .end () != m_algMap .find ( tag ) || 00538 m_nodeMap .end () != m_nodeMap .find ( tag ) ) 00539 { 00540 stream() 00541 << MSG::WARNING 00542 << "The obsolete property 'Nodes' redefines the action for '" 00543 + tag + "' to be '" +nam+"'" 00544 << endreq ; 00545 } 00546 m_nodeMap[tag] = nam ; 00547 } 00548 // 00549 m_updateRequired = true ; 00550 // 00551 return sc; 00552 }
| StatusCode DataOnDemandSvc::setupAlgHandlers | ( | ) | [protected] |
Initialize leaf handlers.
Definition at line 556 of file DataOnDemandSvc.cpp.
00557 { 00558 Setup::const_iterator j; 00559 std::string typ, tag; 00560 00561 for(j=m_algMapping.begin(); j != m_algMapping.end(); ++j) 00562 { 00563 Tokenizer tok(true); 00564 tok.analyse(*j, " ", "", "", "=", "'", "'"); 00565 for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++ ) { 00566 const std::string& t = (*i).tag(); 00567 const std::string& v = (*i).value(); 00568 switch( ::toupper(t[0]) ) { 00569 case 'D': 00570 tag = v; 00571 break; 00572 case 'T': 00573 typ = v; 00574 break; 00575 } 00576 } 00577 ListItem item(typ); 00578 if ( m_algMap .end () != m_algMap .find ( tag ) || 00579 m_nodeMap .end () != m_nodeMap .find ( tag ) ) 00580 { 00581 stream() 00582 << MSG::WARNING 00583 << "The obsolete property 'Algorithms' redefines the action for '" 00584 + tag + "' to be '" +item.type() +"/"+item.name()+"'" 00585 << endreq ; 00586 } 00587 m_algMap[tag] = item.type() + "/" + item.name() ; 00588 } 00589 m_updateRequired = true ; 00590 return StatusCode::SUCCESS; 00591 }
| StatusCode DataOnDemandSvc::setup | ( | ) | [protected] |
Setup routine (called by (re-) initialize.
Definition at line 480 of file DataOnDemandSvc.cpp.
00481 { 00482 m_algMgr = 0; 00483 StatusCode sc = 00484 serviceLocator()->queryInterface(IID_IAlgManager, pp_cast<void>(&m_algMgr)); 00485 if ( sc.isFailure () ) 00486 { 00487 stream() 00488 << MSG::ERROR 00489 << "Failed to retrieve the IAlgManager interface." << endmsg; 00490 return sc; 00491 } 00492 sc = service("IncidentSvc", m_incSvc, true); 00493 if ( sc.isFailure () ) 00494 { 00495 stream() 00496 << MSG::ERROR << "Failed to retrieve Incident service." << endmsg; 00497 return sc; 00498 } 00499 m_incSvc->addListener(this, m_trapType); 00500 sc = service(m_dataSvcName, m_dataSvc, true); 00501 if ( sc.isFailure () ) 00502 { 00503 stream() 00504 << MSG::ERROR 00505 << "Failed to retrieve the data provider interface of " 00506 << m_dataSvcName << endmsg; 00507 return sc; 00508 } 00509 return update() ; 00510 }
| void DataOnDemandSvc::update_1 | ( | Property & | p | ) |
Definition at line 86 of file DataOnDemandSvc.cpp.
00087 { 00088 stream() << MSG::VERBOSE << " I am update handler for property " << p << endreq ; 00089 // force update 00090 m_updateRequired = true ; 00091 }
| void DataOnDemandSvc::update_2 | ( | Property & | p | ) |
Definition at line 107 of file DataOnDemandSvc.cpp.
00108 { 00109 stream() << MSG::WARNING 00110 << "The property 'Algorithms' is obsolete, switch to map-like 'AlgMap' " 00111 << " = { 'data' : 'algorithm' } " 00112 << endreq ; 00113 // force update 00114 m_updateRequired = true ; 00115 }
| void DataOnDemandSvc::update_3 | ( | Property & | p | ) |
Definition at line 95 of file DataOnDemandSvc.cpp.
00096 { 00097 stream() << MSG::WARNING 00098 << "The property 'Nodes' is obsolete, switch to map-like 'NodeMap' " 00099 << " = { 'data' : 'type' } " 00100 << endreq ; 00101 // force update 00102 m_updateRequired = true ; 00103 }
| StatusCode DataOnDemandSvc::update | ( | ) | [protected] |
update the handlers
convert obsolete "Nodes" into new "NodeMap"
convert obsolete "Algorithms" into new "AlgMap"
add the default prefix
add the default prefix
get all directories
setup algorithms
setup nodes
Definition at line 199 of file DataOnDemandSvc.cpp.
00200 { 00201 StatusCode sc = StatusCode::SUCCESS ; 00203 sc = setupNodeHandlers() ; // convert "Nodes" new "NodeMap" 00204 if ( sc.isFailure() ) 00205 { 00206 stream() << MSG::ERROR << "Failed to setup old \"Nodes\"" << endreq ; 00207 return sc ; 00208 } 00210 sc = setupAlgHandlers() ; // convert "Algorithms" into "AlgMap" 00211 if ( sc.isFailure() ) 00212 { 00213 stream() << MSG::ERROR << "Failed to setup old \"Algorithms\"" << endreq ; 00214 return sc ; 00215 } 00217 add_prefix ( m_algMap , m_prefix ) ; 00219 add_prefix ( m_nodeMap , m_prefix ) ; 00221 typedef std::set<std::string> Set ; 00222 Set dirs ; 00223 if ( m_partialPath ){ get_dirs ( m_algMap , dirs ) ; } 00224 if ( m_partialPath ){ get_dirs ( m_nodeMap , dirs ) ; } 00225 // 00226 Set::iterator _e = dirs.find("/Event") ; 00227 if ( dirs.end() != _e ) { dirs.erase( _e ) ; } 00228 // add all directories as nodes 00229 for ( Set::const_iterator dir = dirs.begin() ; dirs.end() != dir ; ++dir ) 00230 { 00231 if ( m_algMap .end () != m_algMap .find ( *dir ) ) { continue ; } 00232 if ( m_nodeMap .end () != m_nodeMap .find ( *dir ) ) { continue ; } 00233 m_nodeMap [*dir] = "DataObject" ; 00234 } 00235 // 00236 m_algs .clear () ; 00237 m_nodes .clear () ; 00238 // 00240 for ( Map::const_iterator ialg = m_algMap.begin() ; 00241 m_algMap.end() != ialg ; ++ialg ) 00242 { 00243 ListItem alg ( ialg->second ) ; 00244 m_algs[ialg->first] = Leaf( alg.type() , alg.name() ) ; 00245 } 00247 for ( Map::const_iterator inode = m_nodeMap.begin() ; 00248 m_nodeMap.end() != inode ; ++inode ) 00249 { 00250 ClassH cl = ROOT::Reflex::Type::ByName( inode->second ) ; 00251 if ( !cl ) 00252 { 00253 stream() << MSG::WARNING 00254 << "Failed to access dictionary class for " 00255 << inode->first << " of type:" << inode->second << endmsg; 00256 } 00257 m_nodes[inode->first] = Node ( cl , false , inode->second ) ; 00258 } 00260 m_updateRequired = false ; 00261 // 00262 return StatusCode::SUCCESS ; 00263 }
| MsgStream& DataOnDemandSvc::stream | ( | ) | const [inline, protected] |
| void DataOnDemandSvc::dump | ( | const MSG::Level | level, | |
| const bool | mode = true | |||
| ) | const [protected] |
dump the content of DataOnDemand service
| level | the printout level | |
| mode | the printout mode |
Definition at line 292 of file DataOnDemandSvc.cpp.
00294 { 00295 if ( m_algs.empty() && m_nodes.empty() ) { return ; } 00296 00297 typedef std::pair<std::string,std::string> Pair ; 00298 typedef std::map<std::string,Pair> PMap ; 00299 00300 PMap _m ; 00301 for ( AlgMap::const_iterator alg = m_algs.begin() ; 00302 m_algs.end() != alg ; ++alg ) 00303 { 00304 PMap::const_iterator check = _m.find(alg->first) ; 00305 if ( _m.end() != check ) 00306 { 00307 stream() 00308 << MSG::WARNING 00309 << " The data item is activated for '" 00310 << check->first << "' as '" << check->second.first << "'" << endreq ; 00311 } 00312 const Leaf& l = alg->second ; 00313 std::string nam = ( l.name == l.type ? l.type : (l.type+"/"+l.name) ) ; 00314 // 00315 if ( !mode && 0 == l.num ) { continue ; } 00316 // 00317 std::string val ; 00318 if ( mode ) { val = ( 0 == l.algorithm ) ? "F" : "T" ; } 00319 else { val = boost::lexical_cast<std::string>( l.num ) ; } 00320 // 00321 _m[ no_prefix ( alg->first , m_prefix ) ] = std::make_pair ( nam , val ) ; 00322 } 00323 // nodes: 00324 for ( NodeMap::const_iterator node = m_nodes.begin() ; 00325 m_nodes.end() != node ; ++node ) 00326 { 00327 PMap::const_iterator check = _m.find(node->first) ; 00328 if ( _m.end() != check ) 00329 { 00330 stream() 00331 << MSG::WARNING 00332 << " The data item is already activated for '" 00333 << check->first << "' as '" << check->second.first << "'" << endreq ; 00334 } 00335 const Node& n = node->second ; 00336 std::string nam = "'" + n.name + "'" ; 00337 // 00338 std::string val ; 00339 00340 if ( !mode && 0 == n.num ) { continue ; } 00341 00342 if ( mode ) { val = ( 0 == n.clazz ) ? "F" : "T" ; } 00343 else { val = boost::lexical_cast<std::string>( n.num ) ; } 00344 // 00345 _m[ no_prefix ( node->first , m_prefix ) ] = std::make_pair ( nam , val ) ; 00346 } 00347 // 00348 if ( _m.empty() ) { return ; } 00349 00350 // find the correct formats 00351 size_t n1 = 0 ; 00352 size_t n2 = 0 ; 00353 size_t n3 = 0 ; 00354 for ( PMap::const_iterator it = _m.begin() ; _m.end() != it ; ++it ) 00355 { 00356 n1 = std::max ( n1 , it->first.size() ) ; 00357 n2 = std::max ( n2 , it->second.first.size() ) ; 00358 n3 = std::max ( n3 , it->second.second.size() ) ; 00359 } 00360 if ( 10 > n1 ) { n1 = 10 ; } 00361 if ( 10 > n2 ) { n2 = 10 ; } 00362 if ( 60 < n1 ) { n1 = 60 ; } 00363 if ( 60 < n2 ) { n2 = 60 ; } 00364 // 00365 00366 const std::string _f = " | %%1$-%1%.%1%s | %%2$-%2%.%2%s | %%3$%3%.%3%s |" ; 00367 boost::format _ff ( _f ) ; 00368 _ff % n1 % n2 % n3 ; 00369 00370 const std::string _format = _ff.str() ; 00371 00372 MsgStream& msg = stream() << level ; 00373 00374 if ( mode ) { msg << "Data-On-Demand Actions enabled for:" ; } 00375 else { msg << "Data-On-Demand Actions has been used for:" ; } 00376 00377 boost::format fmt1( _format) ; 00378 fmt1 % "Address" % "Creator" % ( mode ? "S" : "#" ) ; 00379 // 00380 const std::string header = fmt1.str() ; 00381 std::string line = std::string( header.size() , '-' ) ; 00382 line[0] = ' ' ; 00383 00384 msg << std::endl << line 00385 << std::endl << header 00386 << std::endl << line ; 00387 00388 // make the actual printout: 00389 for ( PMap::const_iterator item = _m.begin() ; 00390 _m.end() != item ; ++item ) 00391 { 00392 boost::format fmt( _format) ; 00393 msg << std::endl << 00394 ( fmt % item->first % item->second.first % item->second.second ) ; 00395 } 00396 00397 msg << std::endl << line << endreq ; 00398 00399 }
IIncidentSvc* DataOnDemandSvc::m_incSvc [private] |
IAlgManager* DataOnDemandSvc::m_algMgr [private] |
IDataProviderSvc* DataOnDemandSvc::m_dataSvc [private] |
std::string DataOnDemandSvc::m_trapType [private] |
std::string DataOnDemandSvc::m_dataSvcName [private] |
bool DataOnDemandSvc::m_partialPath [private] |
bool DataOnDemandSvc::m_dump [private] |
Setup DataOnDemandSvc::m_algMapping [private] |
Setup DataOnDemandSvc::m_nodeMapping [private] |
AlgMap DataOnDemandSvc::m_algs [private] |
NodeMap DataOnDemandSvc::m_nodes [private] |
Map of "empty" objects to be placed as intermediate nodes.
Definition at line 265 of file DataOnDemandSvc.h.
Map DataOnDemandSvc::m_algMap [private] |
the major configuration property { 'data' : 'algorithm' }
Definition at line 269 of file DataOnDemandSvc.h.
Map DataOnDemandSvc::m_nodeMap [private] |
the major configuration property { 'data' : 'type' }
Definition at line 271 of file DataOnDemandSvc.h.
bool DataOnDemandSvc::m_updateRequired [private] |
Definition at line 272 of file DataOnDemandSvc.h.
std::string DataOnDemandSvc::m_prefix [private] |
Definition at line 273 of file DataOnDemandSvc.h.
MsgStream* DataOnDemandSvc::m_log [mutable, private] |
Definition at line 274 of file DataOnDemandSvc.h.
ChronoEntity DataOnDemandSvc::m_total [private] |
Definition at line 276 of file DataOnDemandSvc.h.
ulonglong DataOnDemandSvc::m_statAlg [private] |
Definition at line 277 of file DataOnDemandSvc.h.
ulonglong DataOnDemandSvc::m_statNode [private] |
Definition at line 278 of file DataOnDemandSvc.h.
ulonglong DataOnDemandSvc::m_stat [private] |
Definition at line 279 of file DataOnDemandSvc.h.