30 std::cout <<
" CloneService:clone ERROR: parent " << iParent->name()
31 <<
" is not a service!" << std::endl;
32 return StatusCode::FAILURE;
37 ISvcLocator* svcLoc(
parent->serviceLocator());
40 MsgStream
mlog(
parent->msgSvc(),
"CloneService::clone" );
45 const bool DONOTCREATE(
false);
46 if ((svcLoc->getService(childName, pIS, DONOTCREATE)).isSuccess() &&
47 0 != (child =
dynamic_cast<Service*
>(pIS))) {
49 <<
"Found service " << childName
53 SmartIF<ISvcManager>
svcMgr(svcLoc);
56 <<
"ISvcManager interface not found by serviceLocator."
58 return StatusCode::FAILURE;
60 const std::string& parentType = System::typeinfoName(
typeid(*
parent));
61 if (
svcMgr->createService(parentType, childName,
63 0 != (child =
dynamic_cast<Service*
>(pIS))) {
65 <<
"Created service " << childName <<
" of type " << parentType
69 <<
"Failed to create " << childName <<
" of type " << parentType
71 return StatusCode::FAILURE;
76 std::vector<Gaudi::Details::PropertyBase*>::const_iterator iProp(
parent->getProperties().begin());
77 std::vector<Gaudi::Details::PropertyBase*>::const_iterator eProp(
parent->getProperties().end());
78 while (iProp != eProp &&
79 (child->setProperty(**iProp)).isSuccess()) ++iProp;
82 <<
"Failed to set child property " << (**iProp).name()
84 return StatusCode::FAILURE;
87 << childName <<
" properties set"
93 if (Gaudi::StateMachine::INITIALIZED ==
parent->FSMState() &&
94 Gaudi::StateMachine::CONFIGURED == child->FSMState())
95 return child->sysInitialize();
98 <<
"Did not initialize " << childName
100 return StatusCode::SUCCESS;