10 #include "GaudiKernel/IToolSvc.h" 
   11 #include "GaudiKernel/MsgStream.h" 
   12 #include "GaudiKernel/AlgTool.h" 
   17                 const std::string& cloneName,
 
   18                 const InterfaceID& cloneID, 
 
   25     const AlgTool* pCloned(
dynamic_cast<const AlgTool*
>(&cloned));
 
   27       std::cerr << 
"CloneTool::FATAL: Could not dcast IAlgTool "  
   28         << cloned.name() << 
" to an AlgTool" << std::endl;
 
   29       return StatusCode::FAILURE;
 
   33     IToolSvc* toolSvc(pCloned->toolSvc());
 
   34     assert (0 != toolSvc);
 
   36     MsgStream 
mlog( pCloned->msgSvc(), 
"CloneAlgTool::clone" );
 
   37     if (!toolSvc->retrieve(pCloned->type(), 
 
   44        << pCloned->name() << 
" to " << cloneName << 
endmsg;
 
   45       return StatusCode::FAILURE;
 
   49     std::vector<Gaudi::Details::PropertyBase*>::const_iterator iProp(pCloned->getProperties().begin());
 
   50     std::vector<Gaudi::Details::PropertyBase*>::const_iterator eProp(pCloned->getProperties().end());
 
   52     AlgTool* aResult=
dynamic_cast<AlgTool*
>(
result);
 
   56       return StatusCode::FAILURE;
 
   58     while (iProp != eProp &&
 
   59        (aResult->setProperty(**iProp)).isSuccess()) ++iProp;
 
   62       << 
"Failed to set result property " << (**iProp).name() 
 
   64       return StatusCode::FAILURE;
 
   67       << cloneName << 
" properties set" 
   73     if (Gaudi::StateMachine::INITIALIZED == pCloned->FSMState() &&
 
   74     Gaudi::StateMachine::CONFIGURED == aResult->FSMState())
 
   75       return aResult->sysInitialize(); 
 
   78       << 
"Did not initialize " <<  cloneName
 
   80       return StatusCode::SUCCESS;