67 using namespace YACS::HMI;
68 using namespace YACS::ENGINE;
70 std::map<int, std::string> GuiObserver::_eventNameMap;
80 GuiContext::getCurrent()->getSubjectProc()->cleanPostErase();
85 Subject::Subject(
Subject *parent) : _parent(parent)
120 set<GuiObserver*>::iterator it;
121 while (
int nbObs =
_setObs.size())
123 DEBTRACE(
"--- " <<
this <<
" nbObs " << nbObs);
124 set<GuiObserver*> copySet =
_setObs;
125 for (it = copySet.begin(); it != copySet.end(); ++it)
130 DEBTRACE(
"nbSubjects=" << nbsub <<
" obs=" << anObs);
143 DEBTRACE(
"Subject::registerUndoDestroy");
148 DEBTRACE(
"Subject::attach " << obs);
155 DEBTRACE(
"Subject::detach " << obs);
172 std::map<std::string, std::string> empty;
183 std::vector<std::string> empty;
189 DEBTRACE(
"Subject::select " << isSelected <<
" " <<
this);
190 set<GuiObserver*> copySet =
_setObs;
191 for (set<GuiObserver *>::iterator it = copySet.begin(); it != copySet.end(); ++it)
194 currOb->
select(isSelected);
201 set<GuiObserver*> copySet =
_setObs;
202 for (set<GuiObserver *>::iterator it = copySet.begin(); it != copySet.end(); ++it)
207 (*it)->update(event, type, son);
211 std::cerr <<
"Internal error in Subject::update: " << ex.
what() << std::endl;
215 std::cerr <<
"Internal error in Subject::update: " << std::endl;
240 string toDestroy = son->
getName();
241 DEBTRACE(
"Subject::destroy " << toDestroy);
243 string startnode =
"";
245 string startport =
"";
250 if (dynamic_cast<SubjectProc*>(son))
254 if (
SubjectNode *subNode = dynamic_cast<SubjectNode*>(son))
256 if (subNode->getNode()->getFather() )
259 else if (dynamic_cast<SubjectDataPort*>(son))
264 startportType = son->
getType();
266 else if (
SubjectLink* slink = dynamic_cast<SubjectLink*>(son))
268 startnode = proc->
getChildName(slink->getSubjectOutNode()->getNode());
269 endnode = proc->
getChildName(slink->getSubjectInNode()->getNode());
270 startport = slink->getSubjectOutPort()->getName();
271 endport = slink->getSubjectInPort()->getName();
272 startportType = slink->getSubjectOutPort()->getType();
273 endportType = slink->getSubjectInPort()->getType();
277 startnode = proc->
getChildName(sclink->getSubjectOutNode()->getNode());
278 endnode = proc->
getChildName(sclink->getSubjectInNode()->getNode());
282 if(scont->getName() ==
"DefaultContainer")
292 startnode = scont->getName();
305 DEBTRACE(
"Destruction done: " << toDestroy);
337 : _destructible(true)
345 DEBTRACE(
"GuiObserver::~GuiObserver " <<
this);
347 set<Subject*>::iterator it= subsetcpy.begin();
348 for (; it != subsetcpy.end(); ++it)
354 DEBTRACE(
"GuiObserver::select() " << isSelected);
369 DEBTRACE(
"subject " << subject <<
" is already a subject of observer " <<
this <<
"---------------------------");
383 DEBTRACE(
"subject " << subject <<
" is not a subject of observer " <<
this <<
"---------------------------");
432 else return "Unknown Event";
445 DEBTRACE(
"SubjectObserver::select " << isSelected);
450 DEBTRACE(
"SubjectObserver::update " << type <<
"," <<
eventName(event) <<
"," << son);
457 :
Subject(parent), _reference(ref)
481 DEBTRACE(
"SubjectReference::localClean ");
486 std::stringstream name;
523 Dispatcher::getDispatcher()->removeObserver(
this,
_node,
"status");
531 if (dynamic_cast<ForEachLoop*>(father) == NULL ||
532 getName() != ForEachLoop::NAME_OF_SPLITTERNODE)
539 DEBTRACE(
"------------------------------------------------------------------------------");
540 DEBTRACE(
"SubjectNode::localClean: father->edRemoveChild: YACS exception " << e.
what());
541 DEBTRACE(
"------------------------------------------------------------------------------");
558 DEBTRACE(
"SubjectNode::localClean ");
561 list<SubjectLink*>::iterator its;
563 for (its = cpll.begin(); its != cpll.end(); ++its)
567 list<SubjectControlLink*>::iterator its;
569 for (its = cplcl.begin(); its != cplcl.end(); ++its)
573 list<SubjectInputPort*>::iterator iti;
575 for(iti = cpli.begin(); iti != cpli.end(); ++iti)
579 list<SubjectOutputPort*>::iterator ito;
581 for(ito = cplo.begin(); ito != cplo.end(); ++ito)
585 list<SubjectInputDataStreamPort*>::iterator itid;
587 for(itid = cplid.begin(); itid != cplid.end(); ++itid)
591 list<SubjectOutputDataStreamPort*>::iterator itod;
593 for(itod = cplod.begin(); itod != cplod.end(); ++itod)
599 sb->removeNode(
this);
601 sfl->completeChildrenSubjectList( 0 );
603 swl->completeChildrenSubjectList( 0 );
605 sdpl->removeNode(
this);
607 ss->removeNode(
this);
620 ostringstream blocName;
622 Bloc *undoBloc =
new Bloc(blocName.str());
631 string position = proc->
getName();
638 swCase=aswitch->getRankOfNode(
_node);
648 list<ServiceNode*> serviceList;
652 if (service = dynamic_cast<ServiceNode*>(
_node))
653 serviceList.push_back(service);
659 list<Node*>::iterator it = children.begin();
660 for (; it != children.end(); ++it)
661 if (service = dynamic_cast<ServiceNode*>(*it))
662 serviceList.push_back(service);
670 list<ServiceNode*>::const_iterator ita = serviceList.begin();
671 for (; ita != serviceList.end(); ++ita)
673 bool instanceUsedOutside =
false;
680 set<SubjectServiceNode*>::const_iterator itset = scomp->_subServiceSet.begin();
681 for (; itset != scomp->_subServiceSet.end(); ++itset)
684 if (sn && (sn != service))
687 instanceUsedOutside =
true;
688 list<ServiceNode*>::const_iterator itb = serviceList.
begin();
689 for (; itb != serviceList.end(); ++itb)
693 instanceUsedOutside =
false;
697 if (instanceUsedOutside)
703 if (!instanceUsedOutside)
721 vector<pair<OutPort *, InPort *> > globalList = listLeaving;
722 vector<pair<InPort *, OutPort *> >::iterator it1;
723 for (it1 = listIncoming.begin(); it1 != listIncoming.end(); ++it1)
725 pair<OutPort *, InPort *> outin = pair<OutPort *, InPort *>((*it1).second, (*it1).first);
726 globalList.push_back(outin);
728 vector<pair<OutPort *, InPort *> >::iterator it2;
729 for (it2 = globalList.begin(); it2 != globalList.end(); ++it2)
744 list<SubjectControlLink*>::iterator its;
746 for (its = cplcl.begin(); its != cplcl.end(); ++its)
749 Node *nout = (*its)->getSubjectOutNode()->getNode();
750 Node *nin = (*its)->getSubjectInNode()->getNode();
751 inside = inside && (node == nout);
752 inside = inside && (node == nin);
755 (*its)->registerUndoDestroy();
784 string position =
"";
785 if (proc != dynamic_cast<Proc*>(
_node))
790 string newParent =
"";
791 if (proc != dynamic_cast<Proc*>(cnp))
834 string position =
"";
835 if (fromproc != dynamic_cast<Proc*>(
_node))
840 string newParent =
"";
841 if (proc != dynamic_cast<Proc*>(cnp))
875 DEBTRACE(
"SubjectNode::setName " << name);
877 string position =
"";
878 if (proc != dynamic_cast<Proc*>(
_node))
894 DEBTRACE(
"SubjectNode::notifyObserver " << object->
getName() <<
" " << event);
904 std::list<OutGate *>::const_iterator ito;
907 Node* n1=(*ito)->getNode();
911 std::list<InGate *>::const_iterator iti;
915 Node* n2=(*iti)->getNode();
923 std::vector< std::pair<OutPort *, InPort *> >::iterator it3;
924 for (it3 = listLeaving.begin(); it3 != listLeaving.end(); ++it3)
931 ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
932 if(n1 == fath ||n2 == fath)
936 dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
945 dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
950 dataflowLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
955 std::vector< std::pair<InPort *, OutPort *> >::iterator it4;
956 for (it4 = listIncoming.begin(); it4 != listIncoming.end(); ++it4)
963 ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
964 if(n1 == fath ||n2 == fath)
968 dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
977 dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
982 dataflowLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
989 DEBTRACE(
"SubjectNode::restoreLinks");
991 std::vector< std::pair<OutPort *, InPort *> >::iterator it3;
998 ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
1019 InPort* p2=(*it3).second;
1022 ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
1038 if(n1==fath || n2==fath)
continue;
1045 pair<Node*,Node*> keyLink(n1,n2);
1057 std::list<OutGate *>::const_iterator it;
1060 Node* n1=(*it)->getNode();
1067 ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
1068 if(n1 == fath)
continue;
1069 if(n2 == fath)
continue;
1085 std::list<InGate *>::const_iterator it2;
1089 Node* n2=(*it2)->getNode();
1095 ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
1096 if(n1 == fath)
continue;
1097 if(n2 == fath)
continue;
1117 string position =
"";
1126 else delete command;
1134 string theName = name;
1135 if (name.empty()) theName =port->
getName();
1136 DEBTRACE(
"SubjectNode::addSubjectInputPort "<< theName);
1140 if (!name.empty()) son->
setName(name);
1175 string theName = name;
1176 if (name.empty()) theName =port->
getName();
1177 DEBTRACE(
"SubjectNode::addSubjectOutputPort "<< theName);
1181 if (!name.empty()) son->
setName(name);
1191 string theName = name;
1192 if (name.empty()) theName =port->
getName();
1193 DEBTRACE(
"SubjectNode::addSubjectIDSPort "<< theName);
1197 if (!name.empty()) son->
setName(name);
1208 string theName = name;
1209 if (name.empty()) theName =port->
getName();
1210 DEBTRACE(
"SubjectNode::addSubjectODSPort "<< theName);
1214 if (!name.empty()) son->
setName(name);
1226 string outNodePos = proc->getChildName(outNode);
1228 string inNodePos = proc->getChildName(inNode);
1247 std::vector< std::pair<OutPort *, InPort *> > globalList = listLeaving;
1248 std::vector< std::pair<InPort *, OutPort *> >::iterator it1;
1249 for (it1 = listIncoming.begin(); it1 != listIncoming.end(); ++it1)
1251 std::pair<OutPort *, InPort *> outin = std::pair<OutPort *, InPort *>((*it1).second, (*it1).first);
1252 globalList.push_back(outin);
1254 std::vector< std::pair<OutPort *, InPort *> >::iterator it2;
1255 for (it2 = globalList.begin(); it2 != globalList.end(); ++it2)
1268 DEBTRACE(
"------------------------------------------------------------------------------");
1269 DEBTRACE(
"SubjectNode::removeExternalLinks(): an external link not in map...");
1270 DEBTRACE(
"------------------------------------------------------------------------------");
1279 list<SubjectControlLink*>::iterator its;
1281 for (its = cplcl.begin(); its != cplcl.end(); ++its)
1284 Node *nout = (*its)->getSubjectOutNode()->getNode();
1285 Node *nin = (*its)->getSubjectInNode()->getNode();
1286 inside = inside && (node == nout);
1287 inside = inside && (node == nin);
1301 string position =
"";
1310 else delete command;
1318 :
SubjectNode(composedNode, parent), _composedNode(composedNode)
1343 DEBTRACE(
"SubjectComposedNode::localClean ");
1352 DEBTRACE(
"SubjectComposedNode::addNode("<<catalog<<
","<<compo<<
","<<type<<
","<<name<<
")");
1366 string position =
"";
1381 else delete command;
1391 string theName = name;
1392 if (name.empty()) theName =node->
getName();
1393 DEBTRACE(
"SubjectComposedNode::addSubjectNode "<< theName);
1400 son =
new SubjectBloc(dynamic_cast<YACS::ENGINE::Bloc*>(node),
this);
1403 son =
new SubjectPythonNode(dynamic_cast<YACS::ENGINE::PythonNode*>(node),
this);
1406 son =
new SubjectPyFuncNode(dynamic_cast<YACS::ENGINE::PyFuncNode*>(node),
this);
1409 son =
new SubjectCORBANode(dynamic_cast<YACS::ENGINE::CORBANode*>(node),
this);
1412 son =
new SubjectCppNode(dynamic_cast<YACS::ENGINE::CppNode*>(node),
this);
1415 son =
new SubjectSalomeNode(dynamic_cast<YACS::ENGINE::SalomeNode*>(node),
this);
1421 son =
new SubjectXmlNode(dynamic_cast<YACS::ENGINE::XmlNode*>(node),
this);
1427 son =
new SubjectPresetNode(dynamic_cast<YACS::ENGINE::PresetNode*>(node),
this);
1430 son =
new SubjectOutNode(dynamic_cast<YACS::ENGINE::OutNode*>(node),
this);
1439 son =
new SubjectForLoop(dynamic_cast<YACS::ENGINE::ForLoop*>(node),
this);
1442 son =
new SubjectWhileLoop(dynamic_cast<YACS::ENGINE::WhileLoop*>(node),
this);
1445 son =
new SubjectSwitch(dynamic_cast<YACS::ENGINE::Switch*>(node),
this);
1460 if (!name.empty()) son->
setName(name);
1464 if (catalog && !compo.empty() && !type.empty())
1465 service->setComponentFromCatalog(catalog,compo,type);
1467 service->setComponent();
1481 if(find(setOfNode.begin(),setOfNode.end(),node2Insert)==setOfNode.end())
1482 setOfNode.push_back(node2Insert);
1484 for(list<Node *>::iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1493 std::cerr <<
"Unknown type of node" << std::endl;
1500 list<InputPort*>::const_iterator iti;
1501 for (iti = listInputPorts.begin(); iti != listInputPorts.end(); ++iti)
1503 list<OutputPort*>::const_iterator ito;
1504 for (ito = listOutputPorts.begin(); ito != listOutputPorts.end(); ++ito)
1513 DEBTRACE(
"SubjectComposedNode::addSubjectLink");
1516 pair<OutPort*,InPort*> keyLink(outp,inp);
1539 pair<OutPort*,InPort*> keyLink(outp,inp);
1556 pair<Node*,Node*> keyLink(outn,inn);
1577 pair<Node*,Node*> keyLink(outn,inn);
1591 DEBTRACE(
"SubjectComposedNode::removeExternalControlLinks " <<
getName());
1593 list<SubjectControlLink*>::iterator its;
1595 for (its = cplcl.begin(); its != cplcl.end(); ++its)
1598 Node *nout = (*its)->getSubjectOutNode()->getNode();
1599 Node *nin = (*its)->getSubjectInNode()->getNode();
1622 for(list<Node *>::iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1636 std::vector<std::pair<OutPort*,InPort*> >::iterator itp;
1637 for (itp = setOfLinks.begin(); itp != setOfLinks.end(); ++itp)
1641 InPort *inp = (*itp).second;
1653 std::list<Node*>::const_iterator itn;
1654 for(itn = setOfNodes.begin(); itn != setOfNodes.end(); ++itn)
1657 OutGate* outgate = (*itn)->getOutGate();
1658 std::list<InGate*> setIngate = outgate->
edSetInGate();
1659 std::list<InGate*>::const_iterator itg;
1660 for(itg = setIngate.begin(); itg != setIngate.end(); ++itg)
1662 Node* inNode = (*itg)->getNode();
1737 DEBTRACE(
"SubjectBloc::localClean ");
1738 set<SubjectNode*>::iterator it;
1739 set<SubjectNode*> copyChildren =
_children;
1740 for (it = copyChildren.begin(); it !=copyChildren.end(); ++it)
1750 DEBTRACE(
"SubjectBloc::addNode( " << catalog <<
", " << compo <<
", " << type <<
", " << name <<
" )");
1779 set<SubjectNode*>::const_iterator it =
_children.begin();
1781 if ( (*it)->getNode() == node )
1793 update(event, type, son);
1794 set<SubjectNode*>::iterator it =
_children.begin();
1796 (*it)->recursiveUpdate(event, type, son);
1826 DEBTRACE(
"SubjectProc::localClean ");
1831 DEBTRACE(
"SubjectProc::cleanPostErase");
1857 std::map<std::string, TypeCode *>::iterator pt;
1858 for(pt=builtinCatalog->
_typeMap.begin();pt!=builtinCatalog->
_typeMap.end();pt++)
1878 for (map<string, ComponentInstance*>::const_iterator itComp = aProc->
componentInstanceMap.begin();
1900 for (map<string, Container*>::const_iterator itCont = aProc->
containerMap.begin(); itCont != aProc->
containerMap.end(); ++itCont)
1908 DEBTRACE(
"SubjectProc::addComponent " << compoName <<
" " << containerName);
1915 else delete command;
1921 DEBTRACE(
"SubjectProc::addContainer " << name <<
" " << ref);
1939 DEBTRACE(
"SubjectProc::addContainer " << name <<
" " << ref);
1957 DEBTRACE(
"SubjectProc::addDataType " << typeName);
1961 DEBTRACE(
"new datatype " << typeName);
1965 else delete command;
1981 DEBTRACE(
"SubjectProc::addSubjectContainer " << name);
1995 string typeName = type->
name();
1996 DEBTRACE(
"SubjectProc::addComSubjectDataType " << typeName);
2007 else delete command;
2015 string typeName = type->
name();
2016 DEBTRACE(
"SubjectProc::addSubjectDataType " << typeName);
2019 if (! proc->
typeMap.count(typeName))
2022 proc->
typeMap[ typeName ]->incrRef();
2041 unsigned int aRefCnt = aTypeCode->getRefCnt();
2042 DEBTRACE(
"SubjectProc::removeSubjectDataType: " << typeName <<
" " << aRefCnt);
2044 proc->
typeMap.erase(typeName);
2046 aTypeCode->decrRef();
2060 :
SubjectNode(elementaryNode, parent), _elementaryNode(elementaryNode)
2069 DEBTRACE(
"SubjectElementaryNode::~SubjectElementaryNode " <<
getName());
2085 DEBTRACE(
"SubjectElementaryNode::localClean ");
2090 update(event, type, son);
2095 DEBTRACE(
"SubjectElementaryNode::addInputPort( " << catalog <<
", " << type <<
", " << name <<
" )");
2097 string position =
"";
2110 else delete command;
2116 DEBTRACE(
"SubjectElementaryNode::addOutputPort( " << catalog <<
", " << type <<
", " << name <<
" )");
2118 string position =
"";
2131 else delete command;
2137 DEBTRACE(
"SubjectElementaryNode::addIDSPort( " << catalog <<
", " << type <<
", " << name <<
" )");
2139 string position =
"";
2152 else delete command;
2158 DEBTRACE(
"SubjectElementaryNode::addODSPort( " << catalog <<
", " << type <<
", " << name <<
" )");
2160 string position =
"";
2173 else delete command;
2179 DEBTRACE(
"SubjectElementaryNode::OrderDataPorts");
2181 string position =
"";
2185 if (!portToMove)
return false;
2186 string nameToMove = portToMove->
getName();
2235 listInputPorts.push_back(splitterNode->getFather()->getInputPort(
"SmplsCollection"));
2236 list<InputPort*>::const_iterator iti;
2237 for (iti = listInputPorts.begin(); iti != listInputPorts.end(); ++iti)
2239 list<OutputPort*>::const_iterator ito;
2240 for (ito = listOutputPorts.begin(); ito != listOutputPorts.end(); ++ito)
2242 list<InputDataStreamPort*>::const_iterator itids;
2243 for (itids = listIDSPorts.begin(); itids != listIDSPorts.end(); ++itids)
2245 list<OutputDataStreamPort*>::const_iterator itods;
2246 for (itods = listODSPorts.begin(); itods != listODSPorts.end(); ++itods)
2284 else delete command;
2306 DEBTRACE(
"SubjectInlineNode::localClean ");
2311 DEBTRACE(
"SubjectInlineNode::setExecutionMode ");
2319 else delete command;
2322 else delete command;
2328 DEBTRACE(
"SubjectInlineNode::setContainer ");
2336 else delete command;
2339 else delete command;
2357 if (!instance)
return;
2379 DEBTRACE(
"SubjectServiceNode::localClean ");
2406 std::string service)
2408 DEBTRACE(
"SubjectServiceNode::setComponentFromCatalog " << compo);
2419 else delete command;
2429 DEBTRACE(
"SubjectServiceNode::setComponent");
2438 DEBTRACE(
"SubjectServiceNode::setComponent : create subject for compo = " << compo.c_str());
2441 std::cerr <<
"PROBLEM : ComponentInstance should be registered in proc, add it " << instance->
getInstanceName() << std::endl;
2467 DEBTRACE(
"SubjectServiceNode::setComponent : get already created subject for compo = " <<compo.c_str());
2491 else delete command;
2533 DEBTRACE(
"SubjectPythonNode::localClean ");
2559 else delete command;
2576 DEBTRACE(
"SubjectPyFuncNode::localClean ");
2604 DEBTRACE(
"SubjectCORBANode::localClean ");
2633 DEBTRACE(
"SubjectCppNode::localClean ");
2662 DEBTRACE(
"SubjectSalomeNode::localClean ");
2676 DEBTRACE(
"SubjectSalomePythonNode::~SubjectSalomePythonNode " <<
getName());
2692 DEBTRACE(
"SubjectSalomePythonNode::localClean ");
2721 DEBTRACE(
"SubjectXmlNode::localClean ");
2751 DEBTRACE(
"SubjectSplitterNode::localClean ");
2786 DEBTRACE(
"SubjectDataNode::localClean ");
2815 DEBTRACE(
"SubjectPresetNode::localClean ");
2844 DEBTRACE(
"SubjectOutNode::localClean ");
2873 DEBTRACE(
"SubjectStudyInNode::localClean ");
2902 DEBTRACE(
"SubjectStudyOutNode::localClean ");
2931 DEBTRACE(
"SubjectForLoop::localClean ");
2938 update(event, type, son);
2949 DEBTRACE(
"SubjectForLoop::addNode("<<catalog<<
","<<compo<<
","<<type<<
","<<name<<
")");
2956 body =
createNode(catalog, compo, type, name, newCompoInst);
2975 DEBTRACE(
"SubjectForLoop::setNbSteps " << nbSteps);
2984 else delete command;
3023 DEBTRACE(
"SubjectWhileLoop::localClean ");
3030 update(event, type, son);
3041 DEBTRACE(
"SubjectWhileLoop::addNode(catalog, compo, type, name)");
3048 body =
createNode(catalog, compo, type, name, newCompoInst);
3067 DEBTRACE(
"SubjectWhileLoop::setCondition " << condition);
3076 else delete command;
3116 DEBTRACE(
"SubjectSwitch::localClean ");
3117 map<int, SubjectNode*>::iterator it;
3118 map<int, SubjectNode*> bodyMapCpy =
_bodyMap;
3119 for (it = bodyMapCpy.begin(); it != bodyMapCpy.end(); ++it)
3120 erase((*it).second);
3125 update(event, type, son);
3126 map<int, SubjectNode*>::iterator it =
_bodyMap.begin();
3128 (*it).second->recursiveUpdate(event, type, son);
3139 DEBTRACE(
"SubjectSwitch::addNode("<<catalog<<
","<<compo<<
","<<type<<
","<<name<<
","<<swCase<<
","<<(
int)replace<<
")");
3141 if (!replace &&
_bodyMap.count(swCase))
3146 body =
createNode(catalog, compo, type, name, newCompoInst, swCase);
3156 bool isFound =
false;
3157 map<int, SubjectNode*>::const_iterator it;
3160 if ( (*it).second == son )
3182 DEBTRACE(
"SubjectSwitch::houseKeepingAfterCutPaste");
3192 DEBTRACE(
"SubjectSwitch::completeChildrenSubjectList");
3202 map<int, SubjectNode*>::const_iterator it;
3204 if ( (*it).second->getNode() == node )
3206 aChild = (*it).second;
3216 DEBTRACE(
"SubjectSwitch::setSelect " << select);
3225 else delete command;
3231 DEBTRACE(
"SubjectSwitch::setCase " << caseId);
3237 int newRank = atoi(caseId.c_str());
3238 if (previousRank == newRank)
return true;
3249 else delete command;
3280 update(event, type, son);
3295 DEBTRACE(
"SubjectDynParaLoop::addNode(catalog, compo, type, name)");
3299 "put the nodes in a bloc";
3302 return createNode(catalog, compo, type, name, newCompoInst);
3326 DEBTRACE(
"SubjectDynParaLoop::localClean ");
3377 DEBTRACE(
"SubjectDynParaLoop::setNbBranches " << nbBranches);
3386 else delete command;
3420 Node* aSplitterEngine = 0;
3428 DEBTRACE(
"SubjectForEachLoop::clean: remove for each loop splitter");
3435 DEBTRACE(
"SubjectForEachLoop::localClean ");
3445 if (son && son->
getName() == ForEachLoop::NAME_OF_SPLITTERNODE)
3454 if (child->
getName() == ForEachLoop::NAME_OF_SPLITTERNODE)
3471 DEBTRACE(
"SubjectOptimizerLoop::~SubjectOptimizerLoop " <<
getName());
3487 DEBTRACE(
"SubjectOptimizerLoop::localClean ");
3492 DEBTRACE(
"SubjectOptimizerLoop::setAlgorithm " << alglib <<
" " << symbol);
3500 else delete command;
3507 :
Subject(parent), _dataPort(port)
3523 DEBTRACE(
"father->edRemovePort(_dataPort)");
3530 DEBTRACE(
"------------------------------------------------------------------------------");
3531 DEBTRACE(
"SubjectDataPort::~SubjectDataPort: father->edRemovePort: YACS exception " << e.
what());
3532 DEBTRACE(
"------------------------------------------------------------------------------");
3551 DEBTRACE(
"SubjectDataPort::localClean ");
3553 for (list<SubjectLink*>::iterator it = lsl.begin(); it != lsl.end(); ++it)
3564 DEBTRACE(
"SubjectDataPort::setName " << name);
3566 string position =
"";
3568 if (proc != dynamic_cast<Proc*>(node))
3585 else delete command;
3596 DEBTRACE(
"SubjectDataPort::tryCreateLink");
3609 string outNodePos =
"";
3614 string outportName = subOutport->
getName();
3616 string inNodePos =
"";
3621 string inportName = subInport->
getName();
3624 inNodePos, inportName, subInport->
getType(), control);
3657 DEBTRACE(
"SubjectDataPort::registerUndoDestroy");
3669 string typeName = dtyp->
name();
3671 undoCata->
_typeMap[typeName] = dtyp;
3684 list<InputPort*>::iterator pos = plist.begin();
3685 for (; (*pos) != port; pos++)
3687 nbUp = plist.size() -rang;
3698 list<OutputPort*>::iterator pos = plist.begin();
3699 for (; (*pos) != port; pos++)
3701 nbUp = plist.size() -rang;
3719 for (list<SubjectLink*>::iterator it = lsl.begin(); it != lsl.end(); ++it)
3721 (*it)->registerUndoDestroy();
3732 if (
ForLoop* forloop = dynamic_cast<ForLoop*>(node))
3736 else if (
WhileLoop* whileloop = dynamic_cast<WhileLoop*>(node))
3740 else if (
Switch* aSwitch = dynamic_cast<Switch*>(node))
3744 else if (
ForEachLoop*
foreach = dynamic_cast<ForEachLoop*>(node))
3748 else if (
OptimizerLoop* optil = dynamic_cast<OptimizerLoop*>(node))
3752 else if (
SplitterNode* split = dynamic_cast<SplitterNode*>(node))
3777 DEBTRACE(
"SubjectInputPort::localClean ");
3787 DEBTRACE(
"SubjectInputPort::setValue " << value);
3796 else delete command;
3829 DEBTRACE(
"SubjectOutputPort::localClean ");
3839 DEBTRACE(
"SubjectOutputPort::setValue " << value);
3848 else delete command;
3862 DEBTRACE(
"SubjectInputDataStreamPort::~SubjectInputDataStreamPort " <<
getName());
3872 std::vector<std::string> props;
3873 props.push_back(
"StorageLevel");
3875 props.push_back(
"DateCalSchem");
3876 props.push_back(
"Alpha");
3877 props.push_back(
"DeltaT");
3878 props.push_back(
"InterpolationSchem");
3879 props.push_back(
"ExtrapolationSchem");
3893 else delete command;
3910 DEBTRACE(
"SubjectInputDataStreamPort::localClean ");
3915 DEBTRACE(
"SubjectInputDataStreamPort::registerUndoDestroy");
3918 if (properties.empty())
3940 DEBTRACE(
"SubjectOutputDataStreamPort::~SubjectOutputDataStreamPort " <<
getName());
3958 else delete command;
3975 DEBTRACE(
"SubjectOutputDataStreamPort::localClean ");
3980 DEBTRACE(
"SubjectOutputDataStreamPort::registerUndoDestroy");
3983 if (properties.empty())
4003 _subOutNode(subOutNode), _outPort(outPort), _subInNode(subInNode), _inPort(inPort)
4016 DEBTRACE(
"SubjectLink::SubjectLink " << _name);
4039 DEBTRACE(
"SubjectLink::localClean ");
4045 father->removeLink(
this);
4084 else delete command;
4090 DEBTRACE(
"SubjectLink::registerUndoDestroy");
4106 if (properties.empty())
4123 _subOutNode(subOutNode), _subInNode(subInNode)
4134 DEBTRACE(
"SubjectControlLink::SubjectControlLink " << _name);
4149 DEBTRACE(
"------------------------------------------------------------------------------");
4150 DEBTRACE(
"SubjectControlLink::~SubjectControlLink: edRemoveLink YACS exception " << e.
what());
4151 DEBTRACE(
"------------------------------------------------------------------------------");
4169 DEBTRACE(
"SubjectControlLink::localClean ");
4175 father->removeControlLink(
this);
4188 DEBTRACE(
"SubjectControlLink::registerUndoDestroy");
4200 :
Subject(parent), _compoInst(component)
4232 DEBTRACE(
"SubjectComponent::localClean " <<
this);
4237 std::list<SubjectNode*> services;
4240 if(
ServiceNode* service=dynamic_cast<ServiceNode*>((*it).first))
4244 services.push_back((*it).second);
4248 while(!services.empty())
4251 services.pop_front();
4259 if (!container)
return;
4263 subContainer->removeSubComponentFromSet(
this);
4313 if (command->execute())
4317 else delete command;
4320 else delete command;
4326 DEBTRACE(
"SubjectComponent::attachService");
4336 DEBTRACE(
"SubjectComponent::detachService");
4348 DEBTRACE(
"SubjectComponent::moveService");
4372 DEBTRACE(
"SubjectComponent::notifyServicesChange");
4376 (*it)->update(event, type, son);
4388 else delete command;
4403 if(!dynamic_cast<YACS::ENGINE::HomogeneousPoolContainer *>(container))
4406 return new SubjectHPContainer(dynamic_cast<YACS::ENGINE::HomogeneousPoolContainer *>(container),parent);
4417 DEBTRACE(
"SubjectContainerBase::~SubjectContainerBase");
4421 map<ComponentInstance*,SubjectComponent*> mapOfSubjectComponentCpy
4423 map<ComponentInstance*,SubjectComponent*>::iterator it = mapOfSubjectComponentCpy.begin();
4424 for ( ; it!=mapOfSubjectComponentCpy.end(); it++ )
4425 if ( (*it).first && (*it).first->getContainer() ==
_container )
4427 (*it).first->setContainer(0);
4456 DEBTRACE(
"SubjectContainer::setName " << name);
4465 else delete command;
4471 DEBTRACE(
"SubjectContainer::attachComponent");
4481 DEBTRACE(
"SubjectContainer::detachComponent");
4492 DEBTRACE(
"SubjectContainer::moveComponent");
4506 DEBTRACE(
"SubjectContainer::removeSubComponentFromSet");
4513 DEBTRACE(
"SubjectContainer::notifyComponentsChange");
4517 (*it)->update(event, type, son);
4518 (*it)->notifyServicesChange(event, type, son);
4535 DEBTRACE(
"SubjectContainerBase::localClean ");
4541 std::list<SubjectComponent*> compos;
4543 if ( (*it).first && (*it).first->getContainer() ==
_container )
4547 compos.push_back((*it).second);
4549 while(!compos.empty())
4551 compo=compos.front();
4572 DEBTRACE(
"SubjectContainer::registerUndoDestroy");
4591 throw Exception(
"Invalid container type in SubjectHPContainer !");
4598 DEBTRACE(
"SubjectHPContainer::registerUndoDestroy");
4606 :
Subject(parent), _typeCode(typeCode), _alias(alias)
4627 DEBTRACE(
"SubjectDataType::localClean ");