#include <ToolUsingTool.h>
Inheritance diagram for ToolUsingTool:
Public Types | |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
| enum | Status |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
| enum | Status |
Public Member Functions | |
| ToolUsingTool (const std::string &, const std::string &, const IInterface *) | |
| StatusCode | queryInterface (const InterfaceID &riid, void **ppvIf) |
| StatusCode | initialize () |
| StatusCode | finalize () |
| virtual StatusCode | doSomething (double &result) |
| virtual const std::string & | type () const =0 |
| virtual const IInterface * | parent () const =0 |
| virtual StatusCode | configure ()=0 |
| virtual StatusCode | start ()=0 |
| virtual StatusCode | stop ()=0 |
| virtual StatusCode | terminate ()=0 |
| virtual StatusCode | reinitialize ()=0 |
| virtual StatusCode | restart ()=0 |
| virtual Gaudi::StateMachine::State | FSMState () const =0 |
| virtual StatusCode | sysInitialize ()=0 |
| virtual StatusCode | sysStart ()=0 |
| virtual StatusCode | sysStop ()=0 |
| virtual StatusCode | sysFinalize ()=0 |
| virtual StatusCode | sysReinitialize ()=0 |
| virtual StatusCode | sysRestart ()=0 |
| virtual unsigned long | refCount () const =0 |
| virtual const std::string & | name () const =0 |
| virtual unsigned long | addRef ()=0 |
| virtual unsigned long | release ()=0 |
| virtual unsigned long | addRef () |
| virtual unsigned long | release () |
| virtual const std::string & | name () const |
| virtual const std::string & | type () const |
| virtual const IInterface * | parent () const |
| virtual StatusCode | configure () |
| virtual StatusCode | start () |
| virtual StatusCode | stop () |
| virtual StatusCode | terminate () |
| virtual StatusCode | reinitialize () |
| virtual StatusCode | restart () |
| virtual Gaudi::StateMachine::State | FSMState () const |
| virtual Gaudi::StateMachine::State | targetFSMState () const |
| virtual StatusCode | sysInitialize () |
| virtual StatusCode | sysStart () |
| virtual StatusCode | sysStop () |
| virtual StatusCode | sysFinalize () |
| virtual StatusCode | sysReinitialize () |
| virtual StatusCode | sysRestart () |
| virtual StatusCode | setProperty (const Property &p) |
| virtual StatusCode | setProperty (const std::string &s) |
| virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
| StatusCode | setProperty (const std::string &name, const TYPE &value) |
| 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 |
| PropertyMgr * | getPropertyMgr () |
| ISvcLocator * | serviceLocator () const |
| ISvcLocator * | svcLoc () const |
| IMessageSvc * | msgSvc () const |
| IToolSvc * | toolSvc () const |
| StatusCode | setProperties () |
| StatusCode | service (const std::string &name, T *&svc, bool createIf=true) const |
| StatusCode | service (const std::string &type, const std::string &name, T *&svc) const |
| void | declInterface (const InterfaceID &, void *) |
| Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
| Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
| IAuditorSvc * | auditorSvc () const |
| IMonitorSvc * | monitorSvc () const |
| void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
| void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
Static Public Member Functions | |
| static const InterfaceID & | interfaceID () |
Public Attributes | |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
Protected Member Functions | |
| int | outputLevel () const |
| virtual unsigned long | refCount () const |
| IntegerProperty & | outputLevelProperty () |
| void | initOutputLevel (Property &prop) |
Private Attributes | |
| MsgStream | m_log |
| double | m_factor |
| ToolHandle< IVirtualTool > | m_pubTool |
| ToolHandle< IVirtualTool > | m_privTool |
| ToolHandleArray< IVirtualTool > | m_toolArray |
Definition at line 15 of file ToolUsingTool.h.
| ToolUsingTool::ToolUsingTool | ( | const std::string & | , | |
| const std::string & | , | |||
| const IInterface * | ||||
| ) |
Definition at line 6 of file ToolUsingTool.cc.
00008 : AlgTool( type, name, parent ), m_log( msgSvc(), name ), 00009 m_pubTool( "ConcreteTool/PublicConcreteTool" ), // no parent, making it public 00010 m_privTool( "ConcreteTool", this ), m_toolArray( this ) // adding 'this' makes it private 00011 { 00012 00013 // declare any properties here 00014 00015 declareProperty( "Factor", m_factor = 1., "multiplicative factor to perform task" ); 00016 00017 declareProperty( "TheToolPubTool", m_pubTool, "global helper to offload tasks to" ); 00018 declareProperty( "TheToolTool", m_privTool, "helper to offload some tasks to" ); 00019 declareProperty( "TheToolToolArray", m_toolArray, "list of helpers to offload some tasks to" ); 00020 00021 // set default toolArray 00022 m_toolArray.push_back( "ConcreteTool/CxxDefaultTool" ); 00023 }
| StatusCode ToolUsingTool::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvIf | |||
| ) | [virtual] |
Reimplemented from AlgTool.
Definition at line 27 of file ToolUsingTool.cc.
00028 { 00029 if ( riid == IVirtualTool::interfaceID() ) { 00030 *ppvIf = (IVirtualTool*)this; 00031 addRef(); 00032 return StatusCode::SUCCESS; 00033 } 00034 00035 return AlgTool::queryInterface( riid, ppvIf ); 00036 }
| StatusCode ToolUsingTool::initialize | ( | ) | [virtual] |
Reimplemented from AlgTool.
Definition at line 39 of file ToolUsingTool.cc.
00040 { 00041 00042 // perform necessary one-off initialization 00043 00044 // needed if OutputLevel property was modified 00045 m_log.setLevel( outputLevel() ); 00046 00047 // verify that our tool handle is pointing to an accessible tool 00048 if ( m_pubTool.retrieve().isFailure() ) { 00049 m_log << MSG::FATAL << "Failed to retrieve " << m_pubTool << endreq; 00050 return StatusCode::FAILURE; 00051 } else { 00052 m_log << MSG::INFO << "Retrieved " << m_pubTool << endreq; 00053 } 00054 00055 if ( m_privTool.retrieve().isFailure() ) { 00056 m_log << MSG::FATAL << "Failed to retrieve " << m_privTool << endreq; 00057 return StatusCode::FAILURE; 00058 } else { 00059 m_log << MSG::INFO << "Retrieved " << m_privTool << endreq; 00060 } 00061 00062 if ( m_toolArray.retrieve().isFailure() ) { 00063 m_log << MSG::ERROR << "Failed to retreive " << m_toolArray << endreq; 00064 return StatusCode::FAILURE; 00065 } else { 00066 m_log << MSG::INFO << "Retrieved " << m_toolArray << endreq; 00067 } 00068 00069 return StatusCode::SUCCESS; 00070 }
| StatusCode ToolUsingTool::finalize | ( | ) | [virtual] |
Reimplemented from AlgTool.
Definition at line 73 of file ToolUsingTool.cc.
00074 { 00075 00076 // perform work done at shutdown 00077 00078 return StatusCode::SUCCESS; 00079 }
| StatusCode ToolUsingTool::doSomething | ( | double & | result | ) | [virtual] |
Implements IVirtualTool.
Definition at line 82 of file ToolUsingTool.cc.
00083 { 00084 00085 // do what needs to be done 00086 m_log << MSG::INFO << "performing task using tool (factor: " << m_factor << ") ..." << endreq; 00087 00088 StatusCode sc = m_pubTool->doSomething( result ); 00089 if ( sc.isFailure() ) { 00090 m_log << MSG::ERROR << "the global, public tool failed it's task ... stop!" << endreq; 00091 return sc; 00092 } 00093 00094 sc = m_privTool->doSomething( result ); 00095 if ( sc.isFailure() ) { 00096 m_log << MSG::ERROR << "my tool failed it's task ... stop!" << endreq; 00097 return sc; 00098 } 00099 00100 m_log << MSG::INFO << "... task using tool is done"; 00101 if ( m_log.level() <= MSG::DEBUG ) { m_log << ", result: " << result; } 00102 m_log << endreq; 00103 00104 // make list of tools do their work 00105 double newvalue = 12345.0; 00106 ToolHandleArray< IVirtualTool >::iterator itPriv = m_toolArray.begin(), 00107 itPrivEnd = m_toolArray.end(); 00108 for ( ; itPriv != itPrivEnd; ++itPriv ) { 00109 sc = (*itPriv)->doSomething( newvalue ); 00110 if ( sc.isFailure() ) { 00111 m_log << MSG::ERROR << "tool " << (*itPriv).typeAndName() << " failed it's task ... stop!" << endreq; 00112 return sc; 00113 } 00114 } 00115 00116 return StatusCode::SUCCESS; 00117 }
| static const InterfaceID& ToolUsingTool::interfaceID | ( | ) | [inline, static] |
Reimplemented from AlgTool.
Definition at line 31 of file ToolUsingTool.h.
00031 { return IVirtualTool::interfaceID(); }
MsgStream ToolUsingTool::m_log [private] |
Definition at line 34 of file ToolUsingTool.h.
double ToolUsingTool::m_factor [private] |
Definition at line 37 of file ToolUsingTool.h.
ToolHandle< IVirtualTool > ToolUsingTool::m_pubTool [private] |
Definition at line 39 of file ToolUsingTool.h.
ToolHandle< IVirtualTool > ToolUsingTool::m_privTool [private] |
Definition at line 40 of file ToolUsingTool.h.
ToolHandleArray< IVirtualTool > ToolUsingTool::m_toolArray [private] |
Definition at line 41 of file ToolUsingTool.h.
1.4.7