Version: 9.15.0
guiObservers.cxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #include <Python.h>
21 #include "guiObservers.hxx"
22 #include "commandsProc.hxx"
23 #include "Node.hxx"
24 #include "ComposedNode.hxx"
25 #include "Bloc.hxx"
26 #include "Proc.hxx"
27 #include "ElementaryNode.hxx"
28 #include "InlineNode.hxx"
29 #include "ServiceNode.hxx"
30 #include "PythonNode.hxx"
31 #include "CORBANode.hxx"
32 #include "CppNode.hxx"
33 #include "XMLNode.hxx"
34 #include "SalomePythonNode.hxx"
35 #include "DataNode.hxx"
36 #include "PresetNode.hxx"
37 #include "OutNode.hxx"
38 #include "StudyNodes.hxx"
39 #include "ForLoop.hxx"
40 #include "ForEachLoop.hxx"
41 #include "WhileLoop.hxx"
42 #include "Switch.hxx"
43 #include "OptimizerLoop.hxx"
44 #include "InputPort.hxx"
45 #include "OutputPort.hxx"
46 #include "InputDataStreamPort.hxx"
47 #include "OutputDataStreamPort.hxx"
48 #include "SalomeHPContainer.hxx"
49 #include "SalomeContainer.hxx"
50 #include "SalomeComponent.hxx"
51 #include "ComponentDefinition.hxx"
52 #include "TypeCode.hxx"
53 #include "RuntimeSALOME.hxx"
54 
55 #include "guiContext.hxx"
56 
57 #include <string>
58 #include <sstream>
59 #include <vector>
60 
61 //#define _DEVDEBUG_
62 #include "YacsTrace.hxx"
63 
64 using namespace std;
65 
66 using namespace YACS;
67 using namespace YACS::HMI;
68 using namespace YACS::ENGINE;
69 
70 std::map<int, std::string> GuiObserver::_eventNameMap;
71 
72 // ----------------------------------------------------------------------------
73 
74 void Subject::erase(Subject* sub, Command *command, bool post)
75 {
76  Subject* parent =sub->getParent();
77  sub->clean(command);
78  delete sub;
79  if (!post) // --- avoid recursion in erase, see cleanPostErase
80  GuiContext::getCurrent()->getSubjectProc()->cleanPostErase();
81 }
82 
83 // ----------------------------------------------------------------------------
84 
85 Subject::Subject(Subject *parent) : _parent(parent)
86 {
87  _destructible = true;
88  _askRegisterUndo = false;
89 }
90 
98 {
99  DEBTRACE("Subject::~Subject " << this << " "<< getName());
100 }
101 
107 void Subject::clean(Command *command)
108 {
109  localclean(command);
110 }
111 
118 {
119  DEBTRACE("Subject::localClean ");
120  set<GuiObserver*>::iterator it;
121  while (int nbObs = _setObs.size())
122  {
123  DEBTRACE("--- " << this << " nbObs " << nbObs);
124  set<GuiObserver*> copySet = _setObs;
125  for (it = copySet.begin(); it != copySet.end(); ++it)
126  {
127  GuiObserver* anObs = (*it);
128  detach(anObs);
129  int nbsub = anObs->getNbSubjects();
130  DEBTRACE("nbSubjects=" << nbsub << " obs=" << anObs);
131  if (nbsub <= 0 && anObs->isDestructible())
132  {
133  delete anObs ;
134  break; // --- each delete may induce remove of other observers
135  }
136  }
137  }
138  _setObs.clear();
139 }
140 
142 {
143  DEBTRACE("Subject::registerUndoDestroy");
144 }
145 
147 {
148  DEBTRACE("Subject::attach " << obs);
149  _setObs.insert(obs);
150  obs->incrementSubjects(this);
151 }
152 
154 {
155  DEBTRACE("Subject::detach " << obs);
156  obs->decrementSubjects(this);
157  _setObs.erase(obs);
158 }
159 
160 std::string Subject::getName()
161 {
162  return "generic";
163 }
164 
165 bool Subject::setName(std::string name)
166 {
167  return false;
168 }
169 
170 std::map<std::string, std::string> Subject::getProperties()
171 {
172  std::map<std::string, std::string> empty;
173  return empty;
174 }
175 
176 bool Subject::setProperties(std::map<std::string, std::string> properties)
177 {
178  return true;
179 }
180 
181 std::vector<std::string> Subject::knownProperties()
182 {
183  std::vector<std::string> empty;
184  return empty;
185 }
186 
187 void Subject::select(bool isSelected)
188 {
189  DEBTRACE("Subject::select " << isSelected << " " << this);
190  set<GuiObserver*> copySet = _setObs;
191  for (set<GuiObserver *>::iterator it = copySet.begin(); it != copySet.end(); ++it)
192  {
193  GuiObserver* currOb = *it;
194  currOb->select(isSelected);
195  }
196 }
197 
198 void Subject::update(GuiEvent event,int type, Subject* son)
199 {
200  //DEBTRACE("Subject::update " << type << "," << GuiObserver::eventName(event) << "," << son);
201  set<GuiObserver*> copySet = _setObs;
202  for (set<GuiObserver *>::iterator it = copySet.begin(); it != copySet.end(); ++it)
203  {
204  //DEBTRACE("Subject::update " << *it);
205  try
206  {
207  (*it)->update(event, type, son);
208  }
209  catch(Exception& ex)
210  {
211  std::cerr << "Internal error in Subject::update: " << ex.what() << std::endl;
212  }
213  catch(...)
214  {
215  std::cerr << "Internal error in Subject::update: " << std::endl;
216  }
217  }
218 }
219 
221 {
222  return _parent;
223 }
224 
226 {
227  _parent=son;
228 }
229 
231 
239 {
240  string toDestroy = son->getName();
241  DEBTRACE("Subject::destroy " << toDestroy);
242  Proc *proc = GuiContext::getCurrent()->getProc();
243  string startnode = "";
244  string endnode = "";
245  string startport = "";
246  string endport = "";
247  TypeOfElem startportType = UNKNOWN;
248  TypeOfElem endportType = UNKNOWN;
249 
250  if (dynamic_cast<SubjectProc*>(son))
251  startnode = proc->getName();
252  else
253  {
254  if (SubjectNode *subNode = dynamic_cast<SubjectNode*>(son))
255  {
256  if (subNode->getNode()->getFather() )
257  startnode = proc->getChildName(subNode->getNode());
258  }
259  else if (dynamic_cast<SubjectDataPort*>(son))
260  {
261  SubjectNode *subNodep = dynamic_cast<SubjectNode*>(son->getParent());
262  startnode = proc->getChildName(subNodep->getNode());
263  startport = son->getName();
264  startportType = son->getType();
265  }
266  else if (SubjectLink* slink = dynamic_cast<SubjectLink*>(son))
267  {
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();
274  }
275  else if (SubjectControlLink* sclink = dynamic_cast<SubjectControlLink*>(son))
276  {
277  startnode = proc->getChildName(sclink->getSubjectOutNode()->getNode());
278  endnode = proc->getChildName(sclink->getSubjectInNode()->getNode());
279  }
280  else if (SubjectContainerBase* scont = dynamic_cast<SubjectContainerBase*>(son))
281  {
282  if(scont->getName() == "DefaultContainer")
283  {
284  GuiContext::getCurrent()->_lastErrorMessage = "You can't delete the default container";
285  return false;
286  }
287  if(scont->isUsed())
288  {
289  GuiContext::getCurrent()->_lastErrorMessage = "You can't delete a container that contains components";
290  return false;
291  }
292  startnode = scont->getName();
293  }
294  else
295  {
296  GuiContext::getCurrent()->_lastErrorMessage = "No command Destroy for that type";
297  return false;
298  }
299  }
300  if (son->isDestructible())
301  {
302  CommandDestroy* command = new CommandDestroy(son->getType(), startnode, startport, startportType, endnode, endport, endportType);
303  if (command->execute())
304  {
305  DEBTRACE("Destruction done: " << toDestroy);
306  GuiContext::getCurrent()->getInvoc()->add(command);
307  return true;
308  }
309  else delete command;
310  }
311  return false;
312 }
313 
315 {
316 }
317 
319 {
320 }
321 
323 {
324  DEBTRACE("Subject::addSubjectReference " << getName() << " " << ref->getName());
325  SubjectReference *son = new SubjectReference(ref, this);
326  update(ADDREF, 0, son);
327 }
328 
329 void Subject::setProgress( std::string newProgress )
330 {
331  _progress = newProgress;
332 }
333 
334 // ----------------------------------------------------------------------------
335 
337  : _destructible(true)
338 {
339  //DEBTRACE("GuiObserver::GuiObserver " << this);
340  _subjectSet.clear();
341 }
342 
344 {
345  DEBTRACE("GuiObserver::~GuiObserver " << this);
346  set<Subject*> subsetcpy = _subjectSet;
347  set<Subject*>::iterator it= subsetcpy.begin();
348  for (; it != subsetcpy.end(); ++it)
349  (*it)->detach(this);
350 }
351 
352 void GuiObserver::select(bool isSelected)
353 {
354  DEBTRACE("GuiObserver::select() " << isSelected);
355 }
356 
357 void GuiObserver::update(GuiEvent event, int type, Subject* son)
358 {
359  //DEBTRACE("GuiObserver::update, event not handled " << eventName(event) << " " << type );
360 }
361 
367 {
368  if (_subjectSet.count(subject))
369  DEBTRACE("subject " << subject << " is already a subject of observer " << this << "---------------------------");
370  _subjectSet.insert(subject);
371  //DEBTRACE(this << " " << _subjectSet.size());
372 }
373 
379 {
380  if (_subjectSet.count(subject))
381  _subjectSet.erase(subject);
382  else
383  DEBTRACE("subject " << subject << " is not a subject of observer " << this << "---------------------------");
384  //DEBTRACE(this << " " << _subjectSet.size());
385 }
386 
395 {
396  return _subjectSet.size();
397 }
398 
400 {
401  _eventNameMap.clear();
402  _eventNameMap[ADD] = "ADD";
403  _eventNameMap[REMOVE] = "REMOVE";
404  _eventNameMap[CUT] = "CUT";
405  _eventNameMap[PASTE] = "PASTE";
406  _eventNameMap[ORDER] = "ORDER";
407  _eventNameMap[EDIT] = "EDIT";
408  _eventNameMap[UPDATE] = "UPDATE";
409  _eventNameMap[UPDATEPROGRESS] = "UPDATEPROGRESS";
410  _eventNameMap[SYNCHRO] = "SYNCHRO";
411  _eventNameMap[UP] = "UP";
412  _eventNameMap[DOWN] = "DOWN";
413  _eventNameMap[RENAME] = "RENAME";
414  _eventNameMap[NEWROOT] = "NEWROOT";
415  _eventNameMap[ENDLOAD] = "ENDLOAD";
416  _eventNameMap[ADDLINK] = "ADDLINK";
417  _eventNameMap[ADDCONTROLLINK] = "ADDCONTROLLINK";
418  _eventNameMap[ADDREF] = "ADDREF";
419  _eventNameMap[ADDCHILDREF] = "ADDCHILDREF";
420  _eventNameMap[REMOVECHILDREF] = "REMOVECHILDREF";
421  _eventNameMap[ASSOCIATE] = "ASSOCIATE";
422  _eventNameMap[SETVALUE] = "SETVALUE";
423  _eventNameMap[SETCASE] = "SETCASE";
424  _eventNameMap[SETSELECT] = "SETSELECT";
425  _eventNameMap[GEOMETRY] = "GEOMETRY";
426 }
427 
429 {
430  if (_eventNameMap.count(event))
431  return _eventNameMap[event];
432  else return "Unknown Event";
433 }
434 
435 // ----------------------------------------------------------------------------
436 
438 {
439 }
441 {
442 }
443 void SubjectObserver::select(bool isSelected)
444 {
445  DEBTRACE("SubjectObserver::select " << isSelected);
446  //propagate nothing
447 }
448 void SubjectObserver::update(GuiEvent event, int type, Subject* son)
449 {
450  DEBTRACE("SubjectObserver::update " << type << "," << eventName(event) << "," << son);
451  //propagate only RENAME events
452  if(event == RENAME)
453  _reference->update(event,type,son);
454 }
455 
457  : Subject(parent), _reference(ref)
458 {
459  _sobs=new SubjectObserver(this);
460  ref->attach(_sobs);
461 }
462 
464 {
465  delete _sobs;
466 }
467 
469 {
470  if (_askRegisterUndo)
471  {
472  _askRegisterUndo = false;
474  }
475  localclean(command);
476  Subject::clean(command);
477 }
478 
480 {
481  DEBTRACE("SubjectReference::localClean ");
482 }
483 
485 {
486  std::stringstream name;
487  name << "ref-->" << _reference->getName();
488  return name.str();
489 }
490 
492 {
493  return _reference;
494 }
495 
497 {
498  _parent = parent;
499 }
500 
501 // ----------------------------------------------------------------------------
502 
504  : Subject(parent), _node(node)
505 {
506  _listSubjectInputPort.clear();
507  _listSubjectOutputPort.clear();
508  _listSubjectIDSPort.clear();
509  _listSubjectODSPort.clear();
510  _listSubjectLink.clear();
511  _listSubjectControlLink.clear();
513  Dispatcher* d=Dispatcher::getDispatcher();
514  d->addObserver(this,node,"status");
515 }
516 
521 {
522  DEBTRACE("SubjectNode::~SubjectNode " << getName());
523  Dispatcher::getDispatcher()->removeObserver(this,_node,"status");
524 
525  ComposedNode* father = _node->getFather();
527  if (father)
528  try
529  {
530  // Remove child except if it's the splitter node of a ForEachLoop
531  if (dynamic_cast<ForEachLoopGen*>(father) == NULL ||
532  getName() != ForEachLoopGen::NAME_OF_SPLITTERNODE)
533  {
534  father->edRemoveChild(_node);
535  }
536  }
537  catch (YACS::Exception &e)
538  {
539  DEBTRACE("------------------------------------------------------------------------------");
540  DEBTRACE("SubjectNode::localClean: father->edRemoveChild: YACS exception " << e.what());
541  DEBTRACE("------------------------------------------------------------------------------");
542  }
543 }
544 
546 {
547  if (_askRegisterUndo)
548  {
549  _askRegisterUndo = false;
551  }
552  localclean(command);
553  Subject::clean(command);
554 }
555 
557 {
558  DEBTRACE("SubjectNode::localClean ");
560  {
561  list<SubjectLink*>::iterator its;
562  list<SubjectLink*> cpll = _listSubjectLink;
563  for (its = cpll.begin(); its != cpll.end(); ++its)
564  erase(*its);
565  }
566  {
567  list<SubjectControlLink*>::iterator its;
568  list<SubjectControlLink*> cplcl = _listSubjectControlLink;
569  for (its = cplcl.begin(); its != cplcl.end(); ++its)
570  erase(*its);
571  }
572  {
573  list<SubjectInputPort*>::iterator iti;
574  list<SubjectInputPort*> cpli = _listSubjectInputPort;
575  for(iti = cpli.begin(); iti != cpli.end(); ++iti)
576  erase(*iti);
577  }
578  {
579  list<SubjectOutputPort*>::iterator ito;
580  list<SubjectOutputPort*> cplo = _listSubjectOutputPort;
581  for(ito = cplo.begin(); ito != cplo.end(); ++ito)
582  erase(*ito);
583  }
584  {
585  list<SubjectInputDataStreamPort*>::iterator itid;
586  list<SubjectInputDataStreamPort*> cplid = _listSubjectIDSPort;
587  for(itid = cplid.begin(); itid != cplid.end(); ++itid)
588  erase(*itid);
589  }
590  {
591  list<SubjectOutputDataStreamPort*>::iterator itod;
592  list<SubjectOutputDataStreamPort*> cplod = _listSubjectODSPort;
593  for(itod = cplod.begin(); itod != cplod.end(); ++itod)
594  erase(*itod);
595  }
596  if (_parent)
597  {
598  if( SubjectBloc* sb = dynamic_cast<SubjectBloc*>(_parent) )
599  sb->removeNode(this);
600  else if( SubjectForLoop* sfl = dynamic_cast<SubjectForLoop*>(_parent) )
601  sfl->completeChildrenSubjectList( 0 );
602  else if( SubjectWhileLoop* swl = dynamic_cast<SubjectWhileLoop*>(_parent) )
603  swl->completeChildrenSubjectList( 0 );
604  else if( SubjectDynParaLoop* sdpl = dynamic_cast<SubjectDynParaLoop*>(_parent) )
605  sdpl->removeNode(this);
606  else if( SubjectSwitch* ss = dynamic_cast<SubjectSwitch*>(_parent) )
607  ss->removeNode(this);
608  }
609 }
610 
612 {
613  DEBTRACE("SubjectNode::registerUndoDestroy " << getName());
614 
615  Proc *undoProc = GuiContext::getCurrent()->getInvoc()->getUndoProc();
616  ComposedNode *oldFather = _node->getFather();
617 
618  // --- clone the node in undoProc
619 
620  ostringstream blocName;
621  blocName << "undoBloc_" << Invocator::_ctr++;
622  Bloc *undoBloc = new Bloc(blocName.str());
623  undoProc->edAddChild(undoBloc);
624  ComposedNode *newFather = undoBloc;
626  newFather->edAddChild(clone);
627 
628  // --- register a CommandCopyNode from undoProc
629 
630  Proc *proc = GuiContext::getCurrent()->getProc();
631  string position = proc->getName();
632  if (proc != dynamic_cast<Proc*>(_node->getFather())) position = proc->getChildName(_node->getFather());
633 
634  int swCase=0;
635  if (Switch* aswitch = dynamic_cast<Switch*>(_node->getFather()))
636  {
637  //the node is in a switch, save the case
638  swCase=aswitch->getRankOfNode(_node);
639  }
640 
641  CommandCopyNode *command = new CommandCopyNode(undoProc,
642  undoProc->getChildName(clone),
643  position, swCase);
644  GuiContext::getCurrent()->getInvoc()->add(command);
645 
646  // --- identify all the children service node
647 
648  list<ServiceNode*> serviceList;
649  serviceList.clear();
650  ServiceNode *service = 0;
651  ComposedNode *cnode = 0;
652  if (service = dynamic_cast<ServiceNode*>(_node))
653  serviceList.push_back(service);
654  else
655  cnode = dynamic_cast<ComposedNode*>(_node);
656  if (cnode)
657  {
658  list<Node*> children = cnode->getAllRecursiveNodes();
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);
663  }
664 
665  // --- for all the children service node, find the componentInstance,
666  // see if the componentInstance has other services that will stay alive after the destroy
667  // if not, register a CommandAddComponentInstance
668  //
669 
670  list<ServiceNode*>::const_iterator ita = serviceList.begin();
671  for (; ita != serviceList.end(); ++ita)
672  {
673  bool instanceUsedOutside = false;
674  service = *ita;
675  ComponentInstance *compo = service->getComponent();
676  if (!compo) break;
677  YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(compo));
679  //list<ServiceNode*> compServiceSet;
680  set<SubjectServiceNode*>::const_iterator itset = scomp->_subServiceSet.begin();
681  for (; itset != scomp->_subServiceSet.end(); ++itset)
682  {
683  ServiceNode *sn = dynamic_cast<ServiceNode*>((*itset)->getNode());
684  if (sn && (sn != service))
685  {
686  //compServiceSet.push_back(sn);
687  instanceUsedOutside = true;
688  list<ServiceNode*>::const_iterator itb = serviceList.begin();
689  for (; itb != serviceList.end(); ++itb)
690  {
691  if ((*itb) == sn)
692  {
693  instanceUsedOutside = false;
694  break;
695  }
696  }
697  if (instanceUsedOutside)
698  break;
699  }
700  }
701 
702  string instanceName = compo->getInstanceName();
703  if (!instanceUsedOutside)
704  {
705  string compoName = compo->getCompoName();
706  string containerName = compo->getContainer()->getName();
707  CommandAddComponentInstance *comaci = new CommandAddComponentInstance(compoName, containerName, instanceName);
708  GuiContext::getCurrent()->getInvoc()->add(comaci);
709  }
710 
711  string servicePos = proc->getChildName(service);
713  instanceName);
714  GuiContext::getCurrent()->getInvoc()->add(comastc);
715  }
716 
717  // --- explore all the external links and register commands for recreation
718 
719  vector<pair<OutPort *, InPort *> > listLeaving = getNode()->getSetOfLinksLeavingCurrentScope();
720  vector<pair<InPort *, OutPort *> > listIncoming = getNode()->getSetOfLinksComingInCurrentScope();
721  vector<pair<OutPort *, InPort *> > globalList = listLeaving;
722  vector<pair<InPort *, OutPort *> >::iterator it1;
723  for (it1 = listIncoming.begin(); it1 != listIncoming.end(); ++it1)
724  {
725  pair<OutPort *, InPort *> outin = pair<OutPort *, InPort *>((*it1).second, (*it1).first);
726  globalList.push_back(outin);
727  }
728  vector<pair<OutPort *, InPort *> >::iterator it2;
729  for (it2 = globalList.begin(); it2 != globalList.end(); ++it2)
730  {
731  SubjectLink* subject = 0;
732  if (GuiContext::getCurrent()->_mapOfSubjectLink.count(*it2))
733  {
734  subject = GuiContext::getCurrent()->_mapOfSubjectLink[*it2];
735  YASSERT(subject);
736  DEBTRACE("register undo destroy link " << subject->getName());
737  subject->registerUndoDestroy();
738  }
739  }
740 
741  // --- explore all the external control links and register commands for recreation
742 
743  list<SubjectControlLink*> cplcl = getSubjectControlLinks();
744  list<SubjectControlLink*>::iterator its;
745  Node* node = getNode();
746  for (its = cplcl.begin(); its != cplcl.end(); ++its)
747  {
748  bool inside = true;
749  Node *nout = (*its)->getSubjectOutNode()->getNode();
750  Node *nin = (*its)->getSubjectInNode()->getNode();
751  inside = inside && (node == nout);
752  inside = inside && (node == nin);
753  if (!inside)
754  {
755  (*its)->registerUndoDestroy();
756  }
757  }
758 }
759 
761 {
762  DEBTRACE("SubjectNode::reparent");
763  Subject *sub = getParent(); // --- old parent subject
764  SubjectComposedNode *sop = dynamic_cast<SubjectComposedNode*>(sub);
765  YASSERT(sop);
766  SubjectComposedNode *snp = dynamic_cast<SubjectComposedNode*>(parent); // --- new parent subject
767  if (!snp)
768  {
769  GuiContext::getCurrent()->_lastErrorMessage = "new parent must be a composed node";
770  DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
771  return false;
772  }
773  ComposedNode *cnp = dynamic_cast<ComposedNode*>(snp->getNode());
774  YASSERT(cnp);
775  Proc *proc = GuiContext::getCurrent()->getProc();
776  Proc *fromproc=_node->getProc();
777  if(proc != fromproc)
778  {
779  GuiContext::getCurrent()->_lastErrorMessage = "cut is not yet possible across procs";
780  DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
781  return false;
782  }
783 
784  string position = "";
785  if (proc != dynamic_cast<Proc*>(_node))
786  position = proc->getChildName(_node);
787  else
788  position = _node->getName();
789 
790  string newParent = "";
791  if (proc != dynamic_cast<Proc*>(cnp))
792  newParent = proc->getChildName(cnp);
793  else
794  newParent = cnp->getName();
795 
796  CommandReparentNode *command = new CommandReparentNode(position, newParent);
797  if (command->execute())
798  {
799  GuiContext::getCurrent()->getInvoc()->add(command);
800  return true;
801  }
802  else delete command;
803  DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
804  return false;
805 }
806 
807 void SubjectNode::recursiveUpdate(GuiEvent event, int type, Subject* son)
808 {
809  update(event, type, son);
810 }
811 
813 {
814  DEBTRACE("SubjectNode::copy");
815  Subject *sop = getParent(); // --- old parent subject
816  SubjectComposedNode *snp = dynamic_cast<SubjectComposedNode*>(parent); // --- new parent subject
817  if (!snp)
818  {
819  GuiContext::getCurrent()->_lastErrorMessage = "new parent must be a composed node";
820  DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
821  return false;
822  }
823  ComposedNode *cnp = dynamic_cast<ComposedNode*>(snp->getNode());
824  YASSERT(cnp);
825  Proc *proc = GuiContext::getCurrent()->getProc();
826  Proc *fromproc=_node->getProc();
827  if(proc != fromproc)
828  {
829  GuiContext::getCurrent()->_lastErrorMessage = "It is not possible to paste an object from one schema to another.";
830  DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
831  return false;
832  }
833 
834  string position = "";
835  if (fromproc != dynamic_cast<Proc*>(_node))
836  position = fromproc->getChildName(_node);
837  else
838  position = _node->getName();
839 
840  string newParent = "";
841  if (proc != dynamic_cast<Proc*>(cnp))
842  newParent = proc->getChildName(cnp);
843  else
844  newParent = cnp->getName();
845 
846  CommandCopyNode *command = new CommandCopyNode(fromproc, position, newParent);
847  if (command->execute())
848  {
849  GuiContext::getCurrent()->getInvoc()->add(command);
850  return true;
851  }
852  else delete command;
853  DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
854  return false;
855 
856 }
857 
858 std::string SubjectNode::getName()
859 {
860  return _node->getName();
861 }
862 
864 {
865  return _node;
866 }
867 
869 {
870  return _node->isValid();
871 }
872 
873 bool SubjectNode::setName(std::string name)
874 {
875  DEBTRACE("SubjectNode::setName " << name);
876  Proc *proc = GuiContext::getCurrent()->getProc();
877  string position = "";
878  if (proc != dynamic_cast<Proc*>(_node))
879  position = proc->getChildName(_node);
880  else
881  position = _node->getName();
882  CommandRenameNode* command = new CommandRenameNode(position, name);
883  if (command->execute())
884  {
885  GuiContext::getCurrent()->getInvoc()->add(command);
886  return true;
887  }
888  else delete command;
889  return false;
890 }
891 
892 void SubjectNode::notifyObserver(Node* object,const std::string& event)
893 {
894  DEBTRACE("SubjectNode::notifyObserver " << object->getName() << " " << event);
895  TypeOfElem ntyp = ProcInvoc::getTypeOfNode(object);
896  update(UPDATE, ntyp , 0 );
897 }
898 
900 {
901  DEBTRACE("SubjectNode::saveLinks");
904  std::list<OutGate *>::const_iterator ito;
905  for(ito=loutgate.begin();ito != loutgate.end();ito++)
906  {
907  Node* n1=(*ito)->getNode();
908  Node* n2=_node;
909  DEBTRACE(n1->getName()<< " " << n2->getName());
910  }
911  std::list<InGate *>::const_iterator iti;
912  for(iti=singate.begin();iti != singate.end();iti++)
913  {
914  Node* n1=_node;
915  Node* n2=(*iti)->getNode();
916  DEBTRACE(n1->getName()<< " " << n2->getName());
917  }
918 
919  dataLinks.clear();
920  dataflowLinks.clear();
921 
922  std::vector< std::pair<OutPort *, InPort *> > listLeaving = getNode()->getSetOfLinksLeavingCurrentScope();
923  std::vector< std::pair<OutPort *, InPort *> >::iterator it3;
924  for (it3 = listLeaving.begin(); it3 != listLeaving.end(); ++it3)
925  {
926  OutPort* p1=(*it3).first;
927  InPort* p2=(*it3).second;
928  Node* n1=p1->getNode();
929  Node* n2=p2->getNode();
930  //are nodes in sequence (control link direct or indirect) ?
931  ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
932  if(n1 == fath ||n2 == fath)
933  {
934  //consider it as a data only link
935  DEBTRACE("It's a data link: " << n1->getName() << "." << p1->getName() << " -> "<< n2->getName() << "." << p2->getName());
936  dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
937  continue;
938  }
939  while(n1->getFather() != fath) n1=n1->getFather();
940  while(n2->getFather() != fath) n2=n2->getFather();
941  OutGate* outg=n1->getOutGate();
942  if(!outg->isAlreadyInSet(n2->getInGate()))
943  {
944  DEBTRACE("It's a data link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
945  dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
946  }
947  else
948  {
949  DEBTRACE("It's a dataflow link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
950  dataflowLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
951  }
952  }
953 
954  std::vector< std::pair<InPort *, OutPort *> > listIncoming = getNode()->getSetOfLinksComingInCurrentScope();
955  std::vector< std::pair<InPort *, OutPort *> >::iterator it4;
956  for (it4 = listIncoming.begin(); it4 != listIncoming.end(); ++it4)
957  {
958  OutPort* p1=(*it4).second;
959  InPort* p2=(*it4).first;
960  Node* n1=p1->getNode();
961  Node* n2=p2->getNode();
962  //are nodes in sequence (control link direct or indirect) ?
963  ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
964  if(n1 == fath ||n2 == fath)
965  {
966  //consider it as a data only link
967  DEBTRACE("It's a data link: " << n1->getName() << "." << p1->getName() << " -> "<< n2->getName() << "." << p2->getName());
968  dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
969  continue;
970  }
971  while(n1->getFather() != fath) n1=n1->getFather();
972  while(n2->getFather() != fath) n2=n2->getFather();
973  OutGate* outg=n1->getOutGate();
974  if(!outg->isAlreadyInSet(n2->getInGate()))
975  {
976  DEBTRACE("It's a data link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
977  dataLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
978  }
979  else
980  {
981  DEBTRACE("It's a dataflow link: "<<p1->getNode()->getName()<<"."<<p1->getName()<<" -> "<< p2->getNode()->getName()<<"."<<p2->getName());
982  dataflowLinks.push_back(std::pair<OutPort *, InPort *>(p1,p2));
983  }
984  }
985 }
986 
988 {
989  DEBTRACE("SubjectNode::restoreLinks");
990  //restore simple data links
991  std::vector< std::pair<OutPort *, InPort *> >::iterator it3;
992  for (it3 = dataLinks.begin(); it3 != dataLinks.end(); ++it3)
993  {
994  OutPort* p1=(*it3).first;
995  InPort* p2=(*it3).second;
996  Node* n1=p1->getNode();
997  Node* n2=p2->getNode();
998  ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
999  try
1000  {
1001  fath->edAddLink(p1,p2);
1002  }
1003  catch(Exception& ex)
1004  {
1005  // if a link can't be restored ignore it. It's possible when a node is reparented to a foreachloop
1006  continue;
1007  }
1009  SubjectNode *sno = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n1)];
1010  SubjectNode *sni = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n2)];
1013  scla->addSubjectLink(sno,spo,sni,spi);
1014  }
1015  //restore dataflow links
1016  for (it3 = dataflowLinks.begin(); it3 != dataflowLinks.end(); ++it3)
1017  {
1018  OutPort* p1=(*it3).first;
1019  InPort* p2=(*it3).second;
1020  Node* n1=p1->getNode();
1021  Node* n2=p2->getNode();
1022  ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
1023  try
1024  {
1025  fath->edAddDFLink(p1,p2);
1026  }
1027  catch(Exception& ex)
1028  {
1029  // if a link can't be restored ignore it. It's possible when a node is reparented to a foreachloop
1030  continue;
1031  }
1033  SubjectNode *sno = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n1)];
1034  SubjectNode *sni = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n2)];
1037  scla->addSubjectLink(sno,spo,sni,spi);
1038  if(n1==fath || n2==fath) continue;
1039  while(n1->getFather() != fath) n1=n1->getFather();
1040  while(n2->getFather() != fath) n2=n2->getFather();
1041  OutGate *ogate = n1->getOutGate();
1042  InGate *igate = n2->getInGate();
1043  if (ogate->isAlreadyInSet(igate))
1044  {
1045  pair<Node*,Node*> keyLink(n1,n2);
1046  if (!GuiContext::getCurrent()->_mapOfSubjectControlLink.count(keyLink))
1047  {
1048  SubjectNode *sfno = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n1)];
1049  SubjectNode *sfni = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(n2)];
1050  scla->addSubjectControlLink(sfno, sfni);
1051  }
1052  }
1053  }
1054 
1055  //reconnect control links
1056  // links from another node to this node
1057  std::list<OutGate *>::const_iterator it;
1058  for(it=loutgate.begin();it != loutgate.end();it++)
1059  {
1060  Node* n1=(*it)->getNode();
1061  Node* n2=_node;
1062  if(GuiContext::getCurrent()->_mapOfSubjectNode.count(n1)==0)
1063  {
1064  //It's an internal node or a destroyed one : don't treat it
1065  continue;
1066  }
1067  ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
1068  if(n1 == fath)continue;
1069  if(n2 == fath)continue;
1070  //add a control link only if nodes are not in the same descendance
1071  while(n1->getFather() != fath) n1=n1->getFather();
1072  while(n2->getFather() != fath) n2=n2->getFather();
1073  OutGate *ogate = n1->getOutGate();
1074  InGate *igate = n2->getInGate();
1075  if (!ogate->isAlreadyInSet(igate))
1076  {
1077  fath->edAddCFLink(n1,n2);
1081  scla->addSubjectControlLink(subOutNode,subInNode);
1082  }
1083  }
1084 
1085  std::list<InGate *>::const_iterator it2;
1086  for(it2=singate.begin();it2 != singate.end();it2++)
1087  {
1088  Node* n1=_node;
1089  Node* n2=(*it2)->getNode();
1090  if(GuiContext::getCurrent()->_mapOfSubjectNode.count(n2)==0)
1091  {
1092  //It's an internal node or a destroyed one : don't treat it
1093  continue;
1094  }
1095  ComposedNode* fath= ComposedNode::getLowestCommonAncestor(n1,n2);
1096  if(n1 == fath)continue;
1097  if(n2 == fath)continue;
1098  //add a control link only if nodes are not in the same descendance
1099  while(n1->getFather() != fath) n1=n1->getFather();
1100  while(n2->getFather() != fath) n2=n2->getFather();
1101  OutGate *ogate = n1->getOutGate();
1102  InGate *igate = n2->getInGate();
1103  if (!ogate->isAlreadyInSet(igate))
1104  {
1105  fath->edAddCFLink(n1,n2);
1109  scla->addSubjectControlLink(subOutNode,subInNode);
1110  }
1111  }
1112 }
1113 
1114 bool SubjectNode::putInComposedNode(std::string name,std::string type, bool toSaveRestoreLinks)
1115 {
1116  Proc *proc = GuiContext::getCurrent()->getProc();
1117  string position = "";
1118  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
1119 
1120  CommandPutInComposedNode *command = new CommandPutInComposedNode(position, name, type, toSaveRestoreLinks);
1121  if (command->execute())
1122  {
1123  GuiContext::getCurrent()->getInvoc()->add(command);
1124  return true;
1125  }
1126  else delete command;
1127  DEBTRACE(GuiContext::getCurrent()->_lastErrorMessage);
1128  return false;
1129 }
1130 
1132  std::string name)
1133 {
1134  string theName = name;
1135  if (name.empty()) theName =port->getName();
1136  DEBTRACE("SubjectNode::addSubjectInputPort "<< theName);
1137  SubjectInputPort *son = new SubjectInputPort(port, this);
1138  GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(port)] = son;
1139  _listSubjectInputPort.push_back(son);
1140  if (!name.empty()) son->setName(name);
1141  update(ADD, INPUTPORT ,son);
1142  YACS::ENGINE::TypeCode *typcod = port->edGetType();
1143  if (!GuiContext::getCurrent()->getSubjectProc()->addComSubjectDataType(typcod, typcod->name()))
1144  GuiContext::getCurrent()->getSubjectProc()->addSubjectDataType(typcod, typcod->name()); // --- new type of forEachLoop
1145  return son;
1146 }
1147 
1148 void SubjectNode::update( GuiEvent event, int type, Subject* son )
1149 {
1150  Subject::update( event, type, son );
1151 
1152  // remove subject data type if necessary
1153  YACS::HMI::SubjectDataPort* aSPort = dynamic_cast< YACS::HMI::SubjectDataPort* >( son );
1154 // if ( aSPort && event == REMOVE )
1155 // {
1156 // YACS::ENGINE::DataPort* aEPort = aSPort->getPort();
1157 // if ( aEPort )
1158 // {
1159 // YACS::ENGINE::TypeCode* aTypeCode = aEPort->edGetType();
1160 // if ( aTypeCode )
1161 // GuiContext::getCurrent()->getSubjectProc()->removeSubjectDataType( aTypeCode );
1162 // }
1163 // }
1164 }
1165 
1166 void SubjectNode::setExecState(int execState)
1167 {
1168  _execState = execState;
1170 }
1171 
1173  std::string name)
1174 {
1175  string theName = name;
1176  if (name.empty()) theName =port->getName();
1177  DEBTRACE("SubjectNode::addSubjectOutputPort "<< theName);
1178  SubjectOutputPort *son = new SubjectOutputPort(port, this);
1179  GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(port)] = son;
1180  _listSubjectOutputPort.push_back(son);
1181  if (!name.empty()) son->setName(name);
1182  update(ADD, OUTPUTPORT ,son);
1183  YACS::ENGINE::TypeCode *typcod = port->edGetType();
1185  return son;
1186 }
1187 
1189  std::string name)
1190 {
1191  string theName = name;
1192  if (name.empty()) theName =port->getName();
1193  DEBTRACE("SubjectNode::addSubjectIDSPort "<< theName);
1195  GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(port)] = son;
1196  _listSubjectIDSPort.push_back(son);
1197  if (!name.empty()) son->setName(name);
1199  YACS::ENGINE::TypeCode *typcod = port->edGetType();
1201  return son;
1202 }
1203 
1204 
1206  std::string name)
1207 {
1208  string theName = name;
1209  if (name.empty()) theName =port->getName();
1210  DEBTRACE("SubjectNode::addSubjectODSPort "<< theName);
1212  GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(port)] = son;
1213  _listSubjectODSPort.push_back(son);
1214  if (!name.empty()) son->setName(name);
1216  YACS::ENGINE::TypeCode *typcod = port->edGetType();
1218  return son;
1219 }
1220 
1222 {
1223  DEBTRACE("SubjectNode::tryCreateLink " << subOutNode->getName() << " " << subInNode->getName());
1224  Proc *proc = GuiContext::getCurrent()->getProc();
1225  Node *outNode = subOutNode->getNode();
1226  string outNodePos = proc->getChildName(outNode);
1227  Node *inNode = subInNode->getNode();
1228  string inNodePos = proc->getChildName(inNode);
1229  CommandAddControlLink *command = new CommandAddControlLink(outNodePos, inNodePos);
1230  if (command->execute())
1231  {
1232  GuiContext::getCurrent()->getInvoc()->add(command);
1233  return true;
1234  }
1235  else
1236  {
1237  delete command;
1238  return false;
1239  }
1240 }
1241 
1243 {
1244  DEBTRACE("SubjectNode::removeExternalLinks " << getName());
1245  std::vector< std::pair<OutPort *, InPort *> > listLeaving = getNode()->getSetOfLinksLeavingCurrentScope();
1246  std::vector< std::pair<InPort *, OutPort *> > listIncoming = getNode()->getSetOfLinksComingInCurrentScope();
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)
1250  {
1251  std::pair<OutPort *, InPort *> outin = std::pair<OutPort *, InPort *>((*it1).second, (*it1).first);
1252  globalList.push_back(outin);
1253  }
1254  std::vector< std::pair<OutPort *, InPort *> >::iterator it2;
1255  for (it2 = globalList.begin(); it2 != globalList.end(); ++it2)
1256  {
1257  SubjectLink* subject = 0;
1258  if (GuiContext::getCurrent()->_mapOfSubjectLink.count(*it2))
1259  {
1260  subject = GuiContext::getCurrent()->_mapOfSubjectLink[*it2];
1261  YASSERT(subject);
1262  DEBTRACE("link to remove " << subject->getName());
1263  erase(subject);
1265  }
1266  else
1267  {
1268  DEBTRACE("------------------------------------------------------------------------------");
1269  DEBTRACE("SubjectNode::removeExternalLinks(): an external link not in map...");
1270  DEBTRACE("------------------------------------------------------------------------------");
1271  }
1272  }
1273 }
1274 
1276 {
1277  DEBTRACE("SubjectNode::removeExternalControlLinks " << getName());
1278  list<SubjectControlLink*> cplcl = getSubjectControlLinks();
1279  list<SubjectControlLink*>::iterator its;
1280  Node* node = getNode();
1281  for (its = cplcl.begin(); its != cplcl.end(); ++its)
1282  {
1283  bool inside = true;
1284  Node *nout = (*its)->getSubjectOutNode()->getNode();
1285  Node *nin = (*its)->getSubjectInNode()->getNode();
1286  inside = inside && (node == nout);
1287  inside = inside && (node == nin);
1288  if (!inside)
1289  Subject::erase(*its);
1290  }
1291 }
1292 
1293 std::map<std::string, std::string> SubjectNode::getProperties()
1294 {
1295  return _node->getPropertyMap();
1296 }
1297 
1298 bool SubjectNode::setProperties(std::map<std::string, std::string> properties)
1299 {
1300  Proc *proc = GuiContext::getCurrent()->getProc();
1301  string position = "";
1302  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
1303 
1304  CommandSetNodeProperties *command = new CommandSetNodeProperties(position, properties);
1305  if (command->execute())
1306  {
1307  GuiContext::getCurrent()->getInvoc()->add(command);
1308  return true;
1309  }
1310  else delete command;
1311  return false;
1312 }
1313 
1314 // ----------------------------------------------------------------------------
1315 
1317  Subject *parent)
1318  : SubjectNode(composedNode, parent), _composedNode(composedNode)
1319 {
1320 }
1321 
1326 {
1327  DEBTRACE("SubjectComposedNode::~SubjectComposedNode " << getName());
1328 }
1329 
1331 {
1332  if (_askRegisterUndo)
1333  {
1334  _askRegisterUndo = false;
1336  }
1337  localclean(command);
1338  SubjectNode::clean(command);
1339 }
1340 
1342 {
1343  DEBTRACE("SubjectComposedNode::localClean ");
1344 }
1345 
1347  std::string compo,
1348  std::string type,
1349  std::string name,
1350  bool newCompoInst)
1351 {
1352  DEBTRACE("SubjectComposedNode::addNode("<<catalog<<","<<compo<<","<<type<<","<<name<<")");
1353  SubjectNode* body = 0;
1354  GuiContext::getCurrent()->_lastErrorMessage = "YACS Internal Error: SubjectComposedNode::addNode";
1355  return body;
1356 }
1357 
1359  std::string compo,
1360  std::string type,
1361  std::string name,
1362  bool newCompoInst,
1363  int swCase)
1364 {
1365  Proc *proc = GuiContext::getCurrent()->getProc();
1366  string position = "";
1367  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
1369  compo,
1370  type,
1371  position,
1372  name,
1373  newCompoInst,
1374  swCase);
1375  if (command->execute())
1376  {
1377  GuiContext::getCurrent()->getInvoc()->add(command);
1378  Node * node = command->getNode();
1379  return command->getSubjectNode();
1380  }
1381  else delete command;
1382  return 0;
1383 }
1384 
1386  std::string name,
1387  YACS::ENGINE::Catalog *catalog,
1388  std::string compo,
1389  std::string type)
1390 {
1391  string theName = name;
1392  if (name.empty()) theName =node->getName();
1393  DEBTRACE("SubjectComposedNode::addSubjectNode "<< theName);
1394  TypeOfElem ntyp = ProcInvoc::getTypeOfNode(node);
1395  DEBTRACE("TypeOfNode: " << ntyp);
1396  SubjectNode *son = 0;
1397  switch(ntyp)
1398  {
1399  case BLOC:
1400  son = new SubjectBloc(dynamic_cast<YACS::ENGINE::Bloc*>(node), this);
1401  break;
1402  case PYTHONNODE:
1403  son = new SubjectPythonNode(dynamic_cast<YACS::ENGINE::PythonNode*>(node), this);
1404  break;
1405  case PYFUNCNODE:
1406  son = new SubjectPyFuncNode(dynamic_cast<YACS::ENGINE::PyFuncNode*>(node), this);
1407  break;
1408  case CORBANODE:
1409  son = new SubjectCORBANode(dynamic_cast<YACS::ENGINE::CORBANode*>(node), this);
1410  break;
1411  case CPPNODE:
1412  son = new SubjectCppNode(dynamic_cast<YACS::ENGINE::CppNode*>(node), this);
1413  break;
1414  case SALOMENODE:
1415  son = new SubjectSalomeNode(dynamic_cast<YACS::ENGINE::SalomeNode*>(node), this);
1416  break;
1417  case SALOMEPYTHONNODE:
1418  son = new SubjectSalomePythonNode(dynamic_cast<YACS::ENGINE::SalomePythonNode*>(node), this);
1419  break;
1420  case XMLNODE:
1421  son = new SubjectXmlNode(dynamic_cast<YACS::ENGINE::XmlNode*>(node), this);
1422  break;
1423  case SPLITTERNODE:
1424  son = new SubjectSplitterNode(dynamic_cast<YACS::ENGINE::SplitterNode*>(node), this);
1425  break;
1426  case PRESETNODE:
1427  son = new SubjectPresetNode(dynamic_cast<YACS::ENGINE::PresetNode*>(node), this);
1428  break;
1429  case OUTNODE:
1430  son = new SubjectOutNode(dynamic_cast<YACS::ENGINE::OutNode*>(node), this);
1431  break;
1432  case STUDYINNODE:
1433  son = new SubjectStudyInNode(dynamic_cast<YACS::ENGINE::StudyInNode*>(node), this);
1434  break;
1435  case STUDYOUTNODE:
1436  son = new SubjectStudyOutNode(dynamic_cast<YACS::ENGINE::StudyOutNode*>(node), this);
1437  break;
1438  case FORLOOP:
1439  son = new SubjectForLoop(dynamic_cast<YACS::ENGINE::ForLoop*>(node), this);
1440  break;
1441  case WHILELOOP:
1442  son = new SubjectWhileLoop(dynamic_cast<YACS::ENGINE::WhileLoop*>(node), this);
1443  break;
1444  case SWITCH:
1445  son = new SubjectSwitch(dynamic_cast<YACS::ENGINE::Switch*>(node), this);
1446  break;
1447  case FOREACHLOOP:
1448  son = new SubjectForEachLoop(dynamic_cast<YACS::ENGINE::ForEachLoopGen*>(node), this);
1449  break;
1450  case OPTIMIZERLOOP:
1451  son = new SubjectOptimizerLoop(dynamic_cast<YACS::ENGINE::OptimizerLoop*>(node), this);
1452  break;
1453  default:
1454  throw YACS::Exception("Not implemented");
1455  //YASSERT(0);
1456  }
1457  YASSERT(son);
1458  GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(node)] = son;
1460  if (!name.empty()) son->setName(name);
1462  update(ADD, ntyp ,son);
1463  if (SubjectServiceNode *service = dynamic_cast<SubjectServiceNode*>(son))
1464  if (catalog && !compo.empty() && !type.empty()) // --- clone from catalog: set component
1465  service->setComponentFromCatalog(catalog,compo,type);
1466  else
1467  service->setComponent();
1468  return son;
1469 }
1470 
1472 {
1473 }
1474 
1476 {
1477  list<Node *> setOfNode= _composedNode->edGetDirectDescendants();
1478  if (ForEachLoopGen *feloop = dynamic_cast<ForEachLoopGen*>(_composedNode))
1479  {
1480  Node *node2Insert=feloop->getChildByName(ForEachLoopGen::NAME_OF_SPLITTERNODE);
1481  if(find(setOfNode.begin(),setOfNode.end(),node2Insert)==setOfNode.end())
1482  setOfNode.push_back(node2Insert);
1483  }
1484  for(list<Node *>::iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1485  {
1486  try
1487  {
1488  SubjectNode * son = addSubjectNode(*iter);
1489  son->loadChildren();
1490  }
1491  catch(YACS::Exception& ex)
1492  {
1493  std::cerr << "Unknown type of node" << std::endl;
1494  }
1495  }
1496  list<InputPort*> listInputPorts = _composedNode->getLocalInputPorts();
1497  list<OutputPort*> listOutputPorts = _composedNode->getLocalOutputPorts();
1498  list<InputDataStreamPort*> listIDSPorts = _composedNode->getSetOfInputDataStreamPort();
1499  list<OutputDataStreamPort*> listODSPorts = _composedNode->getSetOfOutputDataStreamPort();
1500  list<InputPort*>::const_iterator iti;
1501  for (iti = listInputPorts.begin(); iti != listInputPorts.end(); ++iti)
1502  addSubjectInputPort(*iti);
1503  list<OutputPort*>::const_iterator ito;
1504  for (ito = listOutputPorts.begin(); ito != listOutputPorts.end(); ++ito)
1505  addSubjectOutputPort(*ito);
1506 }
1507 
1509  SubjectDataPort *spo,
1510  SubjectNode *sni,
1511  SubjectDataPort *spi)
1512 {
1513  DEBTRACE("SubjectComposedNode::addSubjectLink");
1514  OutPort *outp = dynamic_cast<OutPort*>(spo->getPort());
1515  InPort *inp = dynamic_cast<InPort*>(spi->getPort());
1516  pair<OutPort*,InPort*> keyLink(outp,inp);
1517  //Don't create a new subject if it already exists
1518  if(GuiContext::getCurrent()->_mapOfSubjectLink.count(keyLink)!=0)
1519  return GuiContext::getCurrent()->_mapOfSubjectLink[keyLink];
1520 
1521  SubjectLink *son = new SubjectLink(sno, spo, sni, spi, this);
1522  GuiContext::getCurrent()->_mapOfSubjectLink[keyLink] = son;
1523  _listSubjectLink.push_back(son);
1524  spo->addSubjectLink(son);
1525  spi->addSubjectLink(son);
1526  update(ADDLINK, DATALINK, son);
1527  spi->update(UPDATE, DATALINK, spo);
1528  spo->update(UPDATE, DATALINK, spi);
1529  DEBTRACE("addSubjectLink: " << getName() << " " << son->getName());
1530  return son;
1531 }
1532 
1534 {
1535  DEBTRACE("removeLink: " << link->getName());
1536 
1537  OutPort *outp = dynamic_cast<OutPort*>(link->getSubjectOutPort()->getPort());
1538  InPort *inp = dynamic_cast<InPort*>(link->getSubjectInPort()->getPort());
1539  pair<OutPort*,InPort*> keyLink(outp,inp);
1540  if (GuiContext::getCurrent()->_mapOfSubjectLink.count(keyLink))
1541  {
1542  DEBTRACE(outp->getName() << " " << inp->getName());
1543  GuiContext::getCurrent()->_mapOfSubjectLink.erase(keyLink);
1544  }
1545 
1546  link->getSubjectOutPort()->removeSubjectLink(link);
1547  link->getSubjectInPort()->removeSubjectLink(link);
1548  _listSubjectLink.remove(link);
1549 }
1550 
1552  SubjectNode *sni)
1553 {
1554  Node *outn = sno->getNode();
1555  Node *inn = sni->getNode();
1556  pair<Node*,Node*> keyLink(outn,inn);
1557  //Don't create a new subject if it already exists
1558  if(GuiContext::getCurrent()->_mapOfSubjectControlLink.count(keyLink)!=0)
1560 
1561  SubjectControlLink *son = new SubjectControlLink(sno, sni, this);
1563  _listSubjectControlLink.push_back(son);
1564  sno->addSubjectControlLink(son);
1565  sni->addSubjectControlLink(son);
1567  DEBTRACE("addSubjectControlLink: " << getName() << " " << son->getName());
1568  return son;
1569 }
1570 
1572 {
1573  DEBTRACE("removeSubjectControlLink: " << getName());
1574 
1575  Node *outn = link->getSubjectOutNode()->getNode();
1576  Node *inn = link->getSubjectInNode()->getNode();
1577  pair<Node*,Node*> keyLink(outn,inn);
1578  if (GuiContext::getCurrent()->_mapOfSubjectControlLink.count(keyLink))
1579  {
1580  DEBTRACE(outn->getName() << " " << inn->getName());
1582  }
1583 
1586  _listSubjectControlLink.remove(link);
1587 }
1588 
1590 {
1591  DEBTRACE("SubjectComposedNode::removeExternalControlLinks " << getName());
1592  list<SubjectControlLink*> cplcl = getSubjectControlLinks();
1593  list<SubjectControlLink*>::iterator its;
1594  ComposedNode *cnode = dynamic_cast<ComposedNode*>(getNode());
1595  for (its = cplcl.begin(); its != cplcl.end(); ++its)
1596  {
1597  bool inside = true;
1598  Node *nout = (*its)->getSubjectOutNode()->getNode();
1599  Node *nin = (*its)->getSubjectInNode()->getNode();
1600  inside = inside && cnode->isInMyDescendance(nout); // --- 0 if nout is outside
1601  inside = inside && cnode->isInMyDescendance(nin); // --- 0 if nin is outside
1602  if (!inside)
1603  Subject::erase(*its);
1604  }
1605 }
1606 
1608 {
1609 }
1610 
1620 {
1621  list<Node *> setOfNode= _composedNode->edGetDirectDescendants();
1622  for(list<Node *>::iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1623  {
1624  ComposedNode *cnSon = dynamic_cast<ComposedNode*>(*iter);
1625  if (cnSon)
1626  {
1627  SubjectNode *subSon = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(*iter)];
1628  YASSERT(subSon);
1629  SubjectComposedNode *subCnSon = dynamic_cast<SubjectComposedNode*>(subSon);
1630  YASSERT(subCnSon);
1631  subCnSon->loadLinks();
1632  }
1633  }
1634 
1635  std::vector<std::pair<OutPort*,InPort*> > setOfLinks = _composedNode->getSetOfInternalLinks();
1636  std::vector<std::pair<OutPort*,InPort*> >::iterator itp;
1637  for (itp = setOfLinks.begin(); itp != setOfLinks.end(); ++itp)
1638  if (!GuiContext::getCurrent()->_mapOfSubjectLink.count(*itp))
1639  {
1640  OutPort *outp = (*itp).first;
1641  InPort *inp = (*itp).second;
1642  Node *outn = outp->getNode();
1643  Node *inn = inp->getNode();
1644  DEBTRACE(outn->getName()<<"."<<outp->getName()<<"->"<<inn->getName()<<"."<<inp->getName());
1645  SubjectNode *sno = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(outn)];
1646  SubjectNode *sni = GuiContext::getCurrent()->_mapOfSubjectNode[static_cast<Node*>(inn)];
1649  addSubjectLink(sno,spo,sni,spi);
1650  }
1651 
1652  std::list<Node*> setOfNodes = _composedNode->edGetDirectDescendants();
1653  std::list<Node*>::const_iterator itn;
1654  for(itn = setOfNodes.begin(); itn != setOfNodes.end(); ++itn)
1655  {
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)
1661  {
1662  Node* inNode = (*itg)->getNode();
1664  if(sno && sni)
1665  addSubjectControlLink(sno,sni);
1666  }
1667  }
1668 }
1669 
1671 
1682 {
1683  Node* node1 = snode1->getNode();
1684  Node* node2 = snode2->getNode();
1685 
1686  ComposedNode *node = ComposedNode::getLowestCommonAncestor(node1->getFather(), node2->getFather());
1688  return snode;
1689 }
1690 
1695 {
1696  return false;
1697 }
1698 
1703 {
1704  return "";
1705 }
1706 
1707 
1708 // ----------------------------------------------------------------------------
1709 
1711  : SubjectComposedNode(bloc, parent), _bloc(bloc)
1712 {
1713  _children.clear();
1714 }
1715 
1720 {
1721  DEBTRACE("SubjectBloc::~SubjectBloc " << getName());
1722 }
1723 
1725 {
1726  if (_askRegisterUndo)
1727  {
1728  _askRegisterUndo = false;
1730  }
1731  localclean(command);
1732  SubjectComposedNode::clean(command);
1733 }
1734 
1736 {
1737  DEBTRACE("SubjectBloc::localClean ");
1738  set<SubjectNode*>::iterator it;
1739  set<SubjectNode*> copyChildren = _children;
1740  for (it = copyChildren.begin(); it !=copyChildren.end(); ++it)
1741  erase(*it);
1742 }
1743 
1745  std::string compo,
1746  std::string type,
1747  std::string name,
1748  bool newCompoInst)
1749 {
1750  DEBTRACE("SubjectBloc::addNode( " << catalog << ", " << compo << ", " << type << ", " << name << " )");
1751  SubjectNode* child = createNode(catalog, compo, type, name, newCompoInst);
1752  return child;
1753 }
1754 
1756 {
1757  if (isCut)
1758  removeNode(son);
1759  else
1761 }
1762 
1764 {
1765  _children.insert(son);
1766 }
1767 
1769 {
1770  _children.erase(child);
1771 }
1772 
1774 {
1775  SubjectNode* aChild = 0;
1776 
1777  if (node)
1778  {
1779  set<SubjectNode*>::const_iterator it = _children.begin();
1780  for ( ; it != _children.end(); it++ )
1781  if ( (*it)->getNode() == node )
1782  {
1783  aChild = (*it);
1784  break;
1785  }
1786  }
1787 
1788  return aChild;
1789 }
1790 
1791 void SubjectBloc::recursiveUpdate(GuiEvent event, int type, Subject* son)
1792 {
1793  update(event, type, son);
1794  set<SubjectNode*>::iterator it = _children.begin();
1795  for (; it != _children.end(); ++it)
1796  (*it)->recursiveUpdate(event, type, son);
1797 }
1798 
1799 
1800 // ----------------------------------------------------------------------------
1801 
1803  : SubjectBloc(proc, parent), _proc(proc)
1804 {
1805  _postEraseList.clear();
1806 }
1807 
1809 {
1810  DEBTRACE("SubjectProc::~SubjectProc " << getName());
1811 }
1812 
1814 {
1815  if (_askRegisterUndo)
1816  {
1817  _askRegisterUndo = false;
1819  }
1820  localclean(command);
1821  SubjectBloc::clean(command);
1822 }
1823 
1825 {
1826  DEBTRACE("SubjectProc::localClean ");
1827 }
1828 
1830 {
1831  DEBTRACE("SubjectProc::cleanPostErase");
1832  for (int i=0; i<_postEraseList.size(); i++)
1833  {
1834  DEBTRACE("cleanPostErase " << _postEraseList[i]->getName());
1835  erase(_postEraseList[i],0, true); // --- true: do not call recursively erase
1836  }
1837  _postEraseList.clear();
1838 }
1839 
1841 {
1842  DEBTRACE("SubjectProc::loadProc " << getName());
1843  loadTypes();
1844  loadContainers();
1845  loadComponents();
1846  loadChildren();
1847  loadLinks();
1848 }
1849 
1851 
1855 {
1856  Catalog* builtinCatalog = getSALOMERuntime()->getBuiltinCatalog();
1857  std::map<std::string, TypeCode *>::iterator pt;
1858  for(pt=builtinCatalog->_typeMap.begin();pt!=builtinCatalog->_typeMap.end();pt++)
1859  {
1860  addSubjectDataType((*pt).second , (*pt).first);
1861  }
1862  for(pt=_proc->typeMap.begin();pt!=_proc->typeMap.end();pt++)
1863  {
1864  addSubjectDataType((*pt).second , (*pt).first);
1865  }
1866 }
1867 
1876 {
1877  Proc* aProc = GuiContext::getCurrent()->getProc();
1878  for (map<string, ComponentInstance*>::const_iterator itComp = aProc->componentInstanceMap.begin();
1879  itComp != aProc->componentInstanceMap.end(); ++itComp)
1880  {
1881  GuiContext::getCurrent()->_mapOfLastComponentInstance[itComp->second->getCompoName()]=itComp->second;
1882 
1883  if ( GuiContext::getCurrent()->_mapOfSubjectComponent.find((*itComp).second)
1884  ==
1886  { // engine object for component already exists => add only a subject for it
1887  addSubjectComponent((*itComp).second);
1888  }
1889  }
1890 }
1891 
1898 {
1899  Proc* aProc = GuiContext::getCurrent()->getProc();
1900  for (map<string, Container*>::const_iterator itCont = aProc->containerMap.begin(); itCont != aProc->containerMap.end(); ++itCont)
1901  if ( GuiContext::getCurrent()->_mapOfSubjectContainer.find((*itCont).second) == GuiContext::getCurrent()->_mapOfSubjectContainer.end() )
1902  // engine object for container already exists => add only a subject for it
1903  addSubjectContainer((*itCont).second,(*itCont).second->getName());
1904 }
1905 
1906 SubjectComponent* SubjectProc::addComponent(std::string compoName, std::string containerName)
1907 {
1908  DEBTRACE("SubjectProc::addComponent " << compoName << " " << containerName);
1909  CommandAddComponentInstance *command = new CommandAddComponentInstance(compoName, containerName);
1910  if (command->execute())
1911  {
1912  GuiContext::getCurrent()->getInvoc()->add(command);
1913  return command->getSubjectComponent();
1914  }
1915  else delete command;
1916  return 0;
1917 }
1918 
1919 SubjectContainerBase *SubjectProc::addContainer(std::string name, std::string ref)
1920 {
1921  DEBTRACE("SubjectProc::addContainer " << name << " " << ref);
1922  if (! GuiContext::getCurrent()->getProc()->containerMap.count(name))
1923  {
1924  CommandAddContainer *command(new CommandAddContainer(name,ref));
1925  if (command->execute())
1926  {
1927  GuiContext::getCurrent()->getInvoc()->add(command);
1928  return command->getSubjectContainer();
1929  }
1930  else
1931  delete command;
1932  }
1933  else GuiContext::getCurrent()->_lastErrorMessage = "There is already a container with that name";
1934  return 0;
1935 }
1936 
1938 {
1939  DEBTRACE("SubjectProc::addContainer " << name << " " << ref);
1940  if (! GuiContext::getCurrent()->getProc()->containerMap.count(name))
1941  {
1942  CommandAddHPContainer *command(new CommandAddHPContainer(name,ref));
1943  if (command->execute())
1944  {
1945  GuiContext::getCurrent()->getInvoc()->add(command);
1946  return command->getSubjectContainer();
1947  }
1948  else
1949  delete command;
1950  }
1951  else GuiContext::getCurrent()->_lastErrorMessage = "There is already a container with that name";
1952  return 0;
1953 }
1954 
1955 bool SubjectProc::addDataType(YACS::ENGINE::Catalog* catalog, std::string typeName)
1956 {
1957  DEBTRACE("SubjectProc::addDataType " << typeName);
1958  CommandAddDataTypeFromCatalog *command = new CommandAddDataTypeFromCatalog(catalog, typeName);
1959  if (command->execute())
1960  {
1961  DEBTRACE("new datatype " << typeName);
1962  GuiContext::getCurrent()->getInvoc()->add(command);
1963  return true;
1964  }
1965  else delete command;
1966  return 0;
1967 }
1968 
1970 {
1971  DEBTRACE("SubjectProc::addSubjectComponent " << compo->getInstanceName());
1972  SubjectComponent *son = new SubjectComponent(compo, this);
1974  update(ADD, COMPONENT, son);
1975  //son->setContainer();
1976  return son;
1977 }
1978 
1980 {
1981  DEBTRACE("SubjectProc::addSubjectContainer " << name);
1983  // In edition mode do not clone containers
1984  // cont->attachOnCloning(); // agy : do not use _attachOnCloning attribute in edition mode. This attribute should be used now at runtime.
1986  update(ADD, CONTAINER, son);
1987  return son;
1988 }
1989 
1994 {
1995  string typeName = type->name();
1996  DEBTRACE("SubjectProc::addComSubjectDataType " << typeName);
1997  SubjectDataType* son = 0;
1998  if (GuiContext::getCurrent()->isLoading())
1999  son = addSubjectDataType(type,alias); // no sub command registration
2000  else
2001  {
2004  typeName);
2005  if (command->execute())
2006  GuiContext::getCurrent()->getInvoc()->add(command);
2007  else delete command;
2008  }
2009  return son;
2010 }
2011 
2012 
2014 {
2015  string typeName = type->name();
2016  DEBTRACE("SubjectProc::addSubjectDataType " << typeName);
2017  Proc* proc = GuiContext::getCurrent()->getProc();
2018  SubjectDataType* son = 0;
2019  if (! proc->typeMap.count(typeName))
2020  proc->typeMap[ typeName ] = type->clone();
2021  else
2022  proc->typeMap[ typeName ]->incrRef();
2023  if (! GuiContext::getCurrent()->_mapOfSubjectDataType.count(typeName))
2024  {
2025  son = new SubjectDataType(type, this, alias);
2026  GuiContext::getCurrent()->_mapOfSubjectDataType[typeName] = son;
2027  update(ADD, DATATYPE, son);
2028  }
2029  else
2030  GuiContext::getCurrent()->_lastErrorMessage = "Typecode " + typeName + " was already added in proc";
2031  return son;
2032 }
2033 
2034 void SubjectProc::removeSubjectDataType(std::string typeName)
2035 {
2036  Proc* proc = GuiContext::getCurrent()->getProc();
2037  YASSERT(proc->typeMap.count(typeName));
2038  YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataType.count(typeName));
2039  TypeCode* aTypeCode = proc->typeMap[typeName];
2041  unsigned int aRefCnt = aTypeCode->getRefCnt();
2042  DEBTRACE("SubjectProc::removeSubjectDataType: " << typeName << " " << aRefCnt);
2043  GuiContext::getCurrent()->_mapOfSubjectDataType.erase(typeName);
2044  proc->typeMap.erase(typeName);
2045  erase(aSDataType); // do all the necessary updates
2046  aTypeCode->decrRef();
2047 }
2048 
2050 {
2051  YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(scont->getContainer()));
2052  erase(scont); // do all the necessary updates
2053 }
2054 
2055 
2056 // ----------------------------------------------------------------------------
2057 
2059  Subject *parent)
2060  : SubjectNode(elementaryNode, parent), _elementaryNode(elementaryNode)
2061 {
2062 }
2063 
2068 {
2069  DEBTRACE("SubjectElementaryNode::~SubjectElementaryNode " << getName());
2070 }
2071 
2073 {
2074  if (_askRegisterUndo)
2075  {
2076  _askRegisterUndo = false;
2078  }
2079  localclean(command);
2080  SubjectNode::clean(command);
2081 }
2082 
2084 {
2085  DEBTRACE("SubjectElementaryNode::localClean ");
2086 }
2087 
2089 {
2090  update(event, type, son);
2091 }
2092 
2093 SubjectDataPort* SubjectElementaryNode::addInputPort(YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
2094 {
2095  DEBTRACE("SubjectElementaryNode::addInputPort( " << catalog << ", " << type << ", " << name << " )");
2096  Proc *proc = GuiContext::getCurrent()->getProc();
2097  string position = "";
2098  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
2099  else YASSERT(0);
2101  type,
2102  position,
2103  name);
2104  if (command->execute())
2105  {
2106  GuiContext::getCurrent()->getInvoc()->add(command);
2107  SubjectInputPort *son = command->getSubjectInputPort();
2108  return son;
2109  }
2110  else delete command;
2111  return 0;
2112 }
2113 
2115 {
2116  DEBTRACE("SubjectElementaryNode::addOutputPort( " << catalog << ", " << type << ", " << name << " )");
2117  Proc *proc = GuiContext::getCurrent()->getProc();
2118  string position = "";
2119  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
2120  else YASSERT(0);
2122  type,
2123  position,
2124  name);
2125  if (command->execute())
2126  {
2127  GuiContext::getCurrent()->getInvoc()->add(command);
2128  SubjectOutputPort *son = command->getSubjectOutputPort();
2129  return son;
2130  }
2131  else delete command;
2132  return 0;
2133 }
2134 
2135 SubjectDataPort* SubjectElementaryNode::addIDSPort(YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
2136 {
2137  DEBTRACE("SubjectElementaryNode::addIDSPort( " << catalog << ", " << type << ", " << name << " )");
2138  Proc *proc = GuiContext::getCurrent()->getProc();
2139  string position = "";
2140  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
2141  else YASSERT(0);
2143  type,
2144  position,
2145  name);
2146  if (command->execute())
2147  {
2148  GuiContext::getCurrent()->getInvoc()->add(command);
2150  return son;
2151  }
2152  else delete command;
2153  return 0;
2154 }
2155 
2156 SubjectDataPort* SubjectElementaryNode::addODSPort(YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
2157 {
2158  DEBTRACE("SubjectElementaryNode::addODSPort( " << catalog << ", " << type << ", " << name << " )");
2159  Proc *proc = GuiContext::getCurrent()->getProc();
2160  string position = "";
2161  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
2162  else YASSERT(0);
2164  type,
2165  position,
2166  name);
2167  if (command->execute())
2168  {
2169  GuiContext::getCurrent()->getInvoc()->add(command);
2171  return son;
2172  }
2173  else delete command;
2174  return 0;
2175 }
2176 
2178 {
2179  DEBTRACE("SubjectElementaryNode::OrderDataPorts");
2180  Proc *proc = GuiContext::getCurrent()->getProc();
2181  string position = "";
2182  if (proc != dynamic_cast<Proc*>(_node)) position = proc->getChildName(_node);
2183  else YASSERT(0);
2184 
2185  if (!portToMove) return false;
2186  string nameToMove = portToMove->getName();
2187 
2188  Command *command = 0;
2189  bool isInput = dynamic_cast<SubjectInputPort*>(portToMove);
2190  if (isInput)
2191  command = new CommandOrderInputPorts(position, nameToMove, isUp);
2192  else
2193  command = new CommandOrderOutputPorts(position, nameToMove, isUp);
2194 
2195  if (command->execute())
2196  {
2197  GuiContext::getCurrent()->getInvoc()->add(command);
2198  return true;
2199  }
2200  return false;
2201 }
2202 
2204 {
2205  DEBTRACE("SubjectElementaryNode::removePort " << port->getName());
2206  if (SubjectInputPort* inp = dynamic_cast<SubjectInputPort*>(port))
2207  {
2208  DEBTRACE("-");
2209  _listSubjectInputPort.remove(inp);
2210  }
2211  else if(SubjectOutputPort* outp = dynamic_cast<SubjectOutputPort*>(port))
2212  {
2213  DEBTRACE("--");
2214  _listSubjectOutputPort.remove(outp);
2215  }
2216  if (SubjectInputDataStreamPort* idsp = dynamic_cast<SubjectInputDataStreamPort*>(port))
2217  {
2218  DEBTRACE("---");
2219  _listSubjectIDSPort.remove(idsp);
2220  }
2221  else if(SubjectOutputDataStreamPort* odsp = dynamic_cast<SubjectOutputDataStreamPort*>(port))
2222  {
2223  DEBTRACE("----");
2224  _listSubjectODSPort.remove(odsp);
2225  }
2226 }
2227 
2229 {
2230  list<InputPort*> listInputPorts = _elementaryNode->getLocalInputPorts();
2231  list<OutputPort*> listOutputPorts = _elementaryNode->getLocalOutputPorts();
2232  list<InputDataStreamPort*> listIDSPorts = _elementaryNode->getSetOfInputDataStreamPort();
2233  list<OutputDataStreamPort*> listODSPorts = _elementaryNode->getSetOfOutputDataStreamPort();
2234  if (SplitterNode *splitterNode = dynamic_cast<SplitterNode*>(_elementaryNode))
2235  listInputPorts.push_back(splitterNode->getFather()->getInputPort("SmplsCollection"));
2236  list<InputPort*>::const_iterator iti;
2237  for (iti = listInputPorts.begin(); iti != listInputPorts.end(); ++iti)
2238  addSubjectInputPort(*iti);
2239  list<OutputPort*>::const_iterator ito;
2240  for (ito = listOutputPorts.begin(); ito != listOutputPorts.end(); ++ito)
2241  addSubjectOutputPort(*ito);
2242  list<InputDataStreamPort*>::const_iterator itids;
2243  for (itids = listIDSPorts.begin(); itids != listIDSPorts.end(); ++itids)
2244  addSubjectIDSPort(*itids);
2245  list<OutputDataStreamPort*>::const_iterator itods;
2246  for (itods = listODSPorts.begin(); itods != listODSPorts.end(); ++itods)
2247  addSubjectODSPort(*itods);
2248 }
2249 
2251 {
2253 }
2254 
2256 {
2258 }
2259 
2260 
2261 // ----------------------------------------------------------------------------
2262 
2263 
2265  : SubjectElementaryNode(inlineNode, parent), _inlineNode(inlineNode)
2266 {
2267 }
2268 
2270 {
2271  DEBTRACE("SubjectInlineNode::~SubjectInlineNode " << getName());
2272 }
2273 
2274 bool SubjectInlineNode::setScript(std::string script)
2275 {
2276  Proc *proc = GuiContext::getCurrent()->getProc();
2277  CommandSetInlineNodeScript *command =
2278  new CommandSetInlineNodeScript(proc->getChildName(_node), script);
2279  if (command->execute())
2280  {
2281  GuiContext::getCurrent()->getInvoc()->add(command);
2282  return true;
2283  }
2284  else delete command;
2285  return false;
2286 }
2287 
2289 {
2290  return _inlineNode->getScript();
2291 }
2292 
2294 {
2295  if (_askRegisterUndo)
2296  {
2297  _askRegisterUndo = false;
2299  }
2300  localclean(command);
2302 }
2303 
2305 {
2306  DEBTRACE("SubjectInlineNode::localClean ");
2307 }
2308 
2309 bool SubjectInlineNode::setExecutionMode(const std::string& mode)
2310 {
2311  DEBTRACE("SubjectInlineNode::setExecutionMode ");
2312  Proc *proc = GuiContext::getCurrent()->getProc();
2313 
2315  if (command->execute())
2316  {
2317  if (!GuiContext::getCurrent()->isLoading()) // do not register command when loading a schema
2318  GuiContext::getCurrent()->getInvoc()->add(command);
2319  else delete command;
2320  return true;
2321  }
2322  else delete command;
2323  return false;
2324 }
2325 
2327 {
2328  DEBTRACE("SubjectInlineNode::setContainer ");
2329  Proc *proc = GuiContext::getCurrent()->getProc();
2330 
2331  CommandSetContainer *command = new CommandSetContainer(proc->getChildName(_node), scont->getName());
2332  if (command->execute())
2333  {
2334  if (!GuiContext::getCurrent()->isLoading()) // do not register command when loading a schema
2335  GuiContext::getCurrent()->getInvoc()->add(command);
2336  else delete command;
2337  return true;
2338  }
2339  else delete command;
2340  return false;
2341 }
2342 
2343 
2344 // ----------------------------------------------------------------------------
2345 
2347  : SubjectElementaryNode(serviceNode, parent), _serviceNode(serviceNode)
2348 {
2349  _subjectReference = 0;
2350  _subRefComponent = 0;
2351 }
2352 
2354 {
2355  DEBTRACE("SubjectServiceNode::~SubjectServiceNode " << getName());
2357  if (!instance) return;
2358  if (GuiContext::getCurrent()->_mapOfSubjectComponent.count(instance))
2359  {
2361  if (!scomp->hasServices())
2363  }
2364 }
2365 
2367 {
2368  if (_askRegisterUndo)
2369  {
2370  _askRegisterUndo = false;
2372  }
2373  localclean(command);
2375 }
2376 
2378 {
2379  DEBTRACE("SubjectServiceNode::localClean ");
2380  if (_subRefComponent)
2381  {
2382  SubjectComponent *scomp = dynamic_cast<SubjectComponent*>(_subRefComponent->getParent());
2383  if (scomp)
2384  scomp->removeSubServiceFromSet(this);
2385  }
2386  if (_subjectReference)
2387  {
2388 // update( REMOVE, REFERENCE, _subjectReference );
2390  _subjectReference = 0;
2391  }
2392  if (_subRefComponent)
2393  {
2395  _subRefComponent = 0;
2396  }
2397 }
2398 
2399 
2405  std::string compo,
2406  std::string service)
2407 {
2408  DEBTRACE("SubjectServiceNode::setComponentFromCatalog " << compo);
2409 
2410  Proc* proc = GuiContext::getCurrent()->getProc();
2411  string position = proc->getChildName(_node);
2413  new CommandAddComponentFromCatalog(catalog,
2414  position,
2415  compo,
2416  service);
2417  if (command->execute())
2418  GuiContext::getCurrent()->getInvoc()->add(command);
2419  else delete command;
2420  return;
2421 }
2422 
2428 {
2429  DEBTRACE("SubjectServiceNode::setComponent");
2431  if (instance)
2432  {
2433  Proc* proc = GuiContext::getCurrent()->getProc();
2434  string compo = instance->getCompoName();
2435  SubjectComponent* subCompo = 0;
2436  if (! GuiContext::getCurrent()->_mapOfSubjectComponent.count(instance))
2437  {
2438  DEBTRACE("SubjectServiceNode::setComponent : create subject for compo = " << compo.c_str());
2439  if(proc->componentInstanceMap.count(instance->getInstanceName())==0)
2440  {
2441  std::cerr << "PROBLEM : ComponentInstance should be registered in proc, add it " << instance->getInstanceName() << std::endl;
2442  proc->componentInstanceMap[instance->getInstanceName()] = instance;
2443  Container* cont=instance->getContainer();
2444  //check if the associated container is consistent with containerMap
2445  if(cont)
2446  if (proc->containerMap.count(cont->getName()) == 0)
2447  {
2448  //container exists but is not in containerMap. Clone it, it's probably the result of copy paste from outside the proc
2449  Container* newcont(cont->cloneAlways());
2450  proc->containerMap[cont->getName()]=newcont;
2451  instance->setContainer(newcont);
2453  }
2454  else
2455  {
2456  if(cont != proc->containerMap[cont->getName()])
2457  {
2458  //the associated container is not the same as the one in containerMap: use the containerMap one
2459  instance->setContainer(proc->containerMap[cont->getName()]);
2460  }
2461  }
2462  }
2463  subCompo = GuiContext::getCurrent()->getSubjectProc()->addSubjectComponent(instance);
2464  }
2465  else
2466  {
2467  DEBTRACE("SubjectServiceNode::setComponent : get already created subject for compo = " <<compo.c_str());
2468  subCompo = GuiContext::getCurrent()->_mapOfSubjectComponent[instance];
2469  }
2470  YASSERT(subCompo);
2471  addSubjectReference(subCompo);
2472  if (_subRefComponent)
2473  subCompo->moveService(_subRefComponent);
2474  else
2475  _subRefComponent = subCompo->attachService(this);
2476  }
2477 }
2478 
2480 {
2481  DEBTRACE("SubjectServiceNode::associateToComponent " << getName() << " " << subcomp->getName());
2482  SubjectReference* oldSReference = _subjectReference;
2485  new CommandAssociateServiceToComponent(aName, subcomp->getName());
2486  if (command->execute())
2487  {
2488  GuiContext::getCurrent()->getInvoc()->add(command);
2489  return true;
2490  }
2491  else delete command;
2492  return false;
2493 }
2494 
2496 {
2497  DEBTRACE("Subject::addSubjectReference " << getName() << " " << ref->getName());
2498  SubjectReference *son = new SubjectReference(ref, this);
2499  _subjectReference = son;
2500  update(ADDREF, 0, son);
2501 }
2502 
2504 {
2505  return _subjectReference;
2506 }
2507 
2508 // ----------------------------------------------------------------------------
2509 
2511  : SubjectInlineNode(pythonNode, parent), _pythonNode(pythonNode)
2512 {
2513 }
2514 
2516 {
2517  DEBTRACE("SubjectPythonNode::~SubjectPythonNode " << getName());
2518 }
2519 
2521 {
2522  if (_askRegisterUndo)
2523  {
2524  _askRegisterUndo = false;
2526  }
2527  localclean(command);
2528  SubjectInlineNode::clean(command);
2529 }
2530 
2532 {
2533  DEBTRACE("SubjectPythonNode::localClean ");
2534 }
2535 
2536 
2537 // ----------------------------------------------------------------------------
2538 
2540  : SubjectInlineNode(pyFuncNode, parent), _pyFuncNode(pyFuncNode)
2541 {
2542 }
2543 
2545 {
2546  DEBTRACE("SubjectPyFuncNode::~SubjectPyFuncNode " << getName());
2547 }
2548 
2549 bool SubjectPyFuncNode::setFunctionName(std::string funcName)
2550 {
2551  Proc *proc = GuiContext::getCurrent()->getProc();
2553  new CommandSetFuncNodeFunctionName(proc->getChildName(_node), funcName);
2554  if (command->execute())
2555  {
2556  GuiContext::getCurrent()->getInvoc()->add(command);
2557  return true;
2558  }
2559  else delete command;
2560  return false;
2561 }
2562 
2564 {
2565  if (_askRegisterUndo)
2566  {
2567  _askRegisterUndo = false;
2569  }
2570  localclean(command);
2571  SubjectInlineNode::clean(command);
2572 }
2573 
2575 {
2576  DEBTRACE("SubjectPyFuncNode::localClean ");
2577 }
2578 
2579 // ----------------------------------------------------------------------------
2580 
2582  : SubjectServiceNode(corbaNode, parent), _corbaNode(corbaNode)
2583 {
2584 }
2585 
2587 {
2588  DEBTRACE("SubjectCORBANode::~SubjectCORBANode " << getName());
2589 }
2590 
2592 {
2593  if (_askRegisterUndo)
2594  {
2595  _askRegisterUndo = false;
2597  }
2598  localclean(command);
2599  SubjectServiceNode::clean(command);
2600 }
2601 
2603 {
2604  DEBTRACE("SubjectCORBANode::localClean ");
2605 }
2606 
2607 
2608 // ----------------------------------------------------------------------------
2609 
2611  : SubjectServiceNode(cppNode, parent), _cppNode(cppNode)
2612 {
2613 }
2614 
2616 {
2617  DEBTRACE("SubjectCppNode::~SubjectCppNode " << getName());
2618 }
2619 
2621 {
2622  if (_askRegisterUndo)
2623  {
2624  _askRegisterUndo = false;
2626  }
2627  localclean(command);
2628  SubjectServiceNode::clean(command);
2629 }
2630 
2632 {
2633  DEBTRACE("SubjectCppNode::localClean ");
2634 }
2635 
2636 
2637 // ----------------------------------------------------------------------------
2638 
2640  : SubjectServiceNode(salomeNode, parent), _salomeNode(salomeNode)
2641 {
2642 }
2643 
2645 {
2646  DEBTRACE("SubjectSalomeNode::~SubjectSalomeNode " << getName());
2647 }
2648 
2650 {
2651  if (_askRegisterUndo)
2652  {
2653  _askRegisterUndo = false;
2655  }
2656  localclean(command);
2657  SubjectServiceNode::clean(command);
2658 }
2659 
2661 {
2662  DEBTRACE("SubjectSalomeNode::localClean ");
2663 }
2664 
2665 
2666 // ----------------------------------------------------------------------------
2667 
2669  Subject *parent)
2670  : SubjectServiceNode(salomePythonNode, parent), _salomePythonNode(salomePythonNode)
2671 {
2672 }
2673 
2675 {
2676  DEBTRACE("SubjectSalomePythonNode::~SubjectSalomePythonNode " << getName());
2677 }
2678 
2680 {
2681  if (_askRegisterUndo)
2682  {
2683  _askRegisterUndo = false;
2685  }
2686  localclean(command);
2687  SubjectServiceNode::clean(command);
2688 }
2689 
2691 {
2692  DEBTRACE("SubjectSalomePythonNode::localClean ");
2693 }
2694 
2695 
2696 // ----------------------------------------------------------------------------
2697 
2699  : SubjectServiceNode(xmlNode, parent), _xmlNode(xmlNode)
2700 {
2701 }
2702 
2704 {
2705  DEBTRACE("SubjectXmlNode::~SubjectXmlNode " << getName());
2706 }
2707 
2709 {
2710  if (_askRegisterUndo)
2711  {
2712  _askRegisterUndo = false;
2714  }
2715  localclean(command);
2716  SubjectServiceNode::clean(command);
2717 }
2718 
2720 {
2721  DEBTRACE("SubjectXmlNode::localClean ");
2722 }
2723 
2724 
2725 // ----------------------------------------------------------------------------
2726 
2728  : SubjectElementaryNode(splitterNode, parent), _splitterNode(splitterNode)
2729 {
2730  _destructible = false;
2731 }
2732 
2734 {
2735  DEBTRACE("SubjectSplitterNode::~SubjectSplitterNode " << getName());
2736 }
2737 
2739 {
2740  if (_askRegisterUndo)
2741  {
2742  _askRegisterUndo = false;
2744  }
2745  localclean(command);
2747 }
2748 
2750 {
2751  DEBTRACE("SubjectSplitterNode::localClean ");
2752 }
2753 
2754 
2756 {
2757  return "splitter";
2758 }
2759 
2760 // ----------------------------------------------------------------------------
2761 
2763  : SubjectElementaryNode(dataNode, parent), _dataNode(dataNode)
2764 {
2765  _destructible = true;
2766 }
2767 
2769 {
2770  DEBTRACE("SubjectDataNode::~SubjectDataNode " << getName());
2771 }
2772 
2774 {
2775  if (_askRegisterUndo)
2776  {
2777  _askRegisterUndo = false;
2779  }
2780  localclean(command);
2782 }
2783 
2785 {
2786  DEBTRACE("SubjectDataNode::localClean ");
2787 }
2788 
2789 // ----------------------------------------------------------------------------
2790 
2792  : SubjectDataNode(presetNode, parent), _presetNode(presetNode)
2793 {
2794  _destructible = true;
2795 }
2796 
2798 {
2799  DEBTRACE("SubjectPresetNode::~SubjectPresetNode " << getName());
2800 }
2801 
2803 {
2804  if (_askRegisterUndo)
2805  {
2806  _askRegisterUndo = false;
2808  }
2809  localclean(command);
2810  SubjectDataNode::clean(command);
2811 }
2812 
2814 {
2815  DEBTRACE("SubjectPresetNode::localClean ");
2816 }
2817 
2818 // ----------------------------------------------------------------------------
2819 
2821  : SubjectDataNode(outNode, parent), _outNode(outNode)
2822 {
2823  _destructible = true;
2824 }
2825 
2827 {
2828  DEBTRACE("SubjectOutNode::~SubjectOutNode " << getName());
2829 }
2830 
2832 {
2833  if (_askRegisterUndo)
2834  {
2835  _askRegisterUndo = false;
2837  }
2838  localclean(command);
2839  SubjectDataNode::clean(command);
2840 }
2841 
2843 {
2844  DEBTRACE("SubjectOutNode::localClean ");
2845 }
2846 
2847 // ----------------------------------------------------------------------------
2848 
2850  : SubjectDataNode(studyInNode, parent), _studyInNode(studyInNode)
2851 {
2852  _destructible = true;
2853 }
2854 
2856 {
2857  DEBTRACE("SubjectStudyInNode::~SubjectStudyInNode " << getName());
2858 }
2859 
2861 {
2862  if (_askRegisterUndo)
2863  {
2864  _askRegisterUndo = false;
2866  }
2867  localclean(command);
2868  SubjectDataNode::clean(command);
2869 }
2870 
2872 {
2873  DEBTRACE("SubjectStudyInNode::localClean ");
2874 }
2875 
2876 // ----------------------------------------------------------------------------
2877 
2879  : SubjectDataNode(studyOutNode, parent), _studyOutNode(studyOutNode)
2880 {
2881  _destructible = true;
2882 }
2883 
2885 {
2886  DEBTRACE("SubjectStudyOutNode::~SubjectStudyOutNode " << getName());
2887 }
2888 
2890 {
2891  if (_askRegisterUndo)
2892  {
2893  _askRegisterUndo = false;
2895  }
2896  localclean(command);
2897  SubjectDataNode::clean(command);
2898 }
2899 
2901 {
2902  DEBTRACE("SubjectStudyOutNode::localClean ");
2903 }
2904 
2905 // ----------------------------------------------------------------------------
2906 
2908  : SubjectComposedNode(forLoop, parent), _forLoop(forLoop)
2909 {
2910  _body = 0;
2911 }
2912 
2914 {
2915  DEBTRACE("SubjectForLoop::~SubjectForLoop " << getName());
2916 }
2917 
2919 {
2920  if (_askRegisterUndo)
2921  {
2922  _askRegisterUndo = false;
2924  }
2925  localclean(command);
2926  SubjectComposedNode::clean(command);
2927 }
2928 
2930 {
2931  DEBTRACE("SubjectForLoop::localClean ");
2932  if (_body)
2933  erase(_body);
2934 }
2935 
2937 {
2938  update(event, type, son);
2939  if (_body)
2940  _body->recursiveUpdate(event, type, son);
2941 }
2942 
2944  std::string compo,
2945  std::string type,
2946  std::string name,
2947  bool newCompoInst)
2948 {
2949  DEBTRACE("SubjectForLoop::addNode("<<catalog<<","<<compo<<","<<type<<","<<name<<")");
2950  SubjectNode* body = 0;
2951  if (_body)
2952  {
2953  GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a loop, put the nodes in a bloc";
2954  return body;
2955  }
2956  body = createNode(catalog, compo, type, name, newCompoInst);
2957  return body;
2958 }
2959 
2961 {
2962  if (isCut)
2963  _body = 0;
2964  else
2965  _body = son;
2966 }
2967 
2969 {
2970  _body = son;
2971 }
2972 
2973 bool SubjectForLoop::setNbSteps(std::string nbSteps)
2974 {
2975  DEBTRACE("SubjectForLoop::setNbSteps " << nbSteps);
2976  Proc *proc = GuiContext::getCurrent()->getProc();
2977  CommandSetForLoopSteps *command =
2978  new CommandSetForLoopSteps(proc->getChildName(getNode()), nbSteps);
2979  if (command->execute())
2980  {
2981  GuiContext::getCurrent()->getInvoc()->add(command);
2982  return true;
2983  }
2984  else delete command;
2985  return false;
2986 }
2988 {
2989  return true;
2990 }
2991 
2993 {
2995 }
2996 
2997 // ----------------------------------------------------------------------------
2998 
3000  : SubjectComposedNode(whileLoop, parent), _whileLoop(whileLoop)
3001 {
3002  _body = 0;
3003 }
3004 
3006 {
3007  DEBTRACE("SubjectWhileLoop::~SubjectWhileLoop " << getName());
3008 }
3009 
3011 {
3012  if (_askRegisterUndo)
3013  {
3014  _askRegisterUndo = false;
3016  }
3017  localclean(command);
3018  SubjectComposedNode::clean(command);
3019 }
3020 
3022 {
3023  DEBTRACE("SubjectWhileLoop::localClean ");
3024  if (_body)
3025  erase(_body);
3026 }
3027 
3029 {
3030  update(event, type, son);
3031  if (_body)
3032  _body->recursiveUpdate(event, type, son);
3033 }
3034 
3036  std::string compo,
3037  std::string type,
3038  std::string name,
3039  bool newCompoInst)
3040 {
3041  DEBTRACE("SubjectWhileLoop::addNode(catalog, compo, type, name)");
3042  SubjectNode* body = 0;
3043  if (_body)
3044  {
3045  GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a loop, put the nodes in a bloc";
3046  return body;
3047  }
3048  body = createNode(catalog, compo, type, name, newCompoInst);
3049  return body;
3050 }
3051 
3053 {
3054  if (isCut)
3055  _body = 0;
3056  else
3057  _body = son;
3058 }
3059 
3061 {
3062  _body = son;
3063 }
3064 
3065 bool SubjectWhileLoop::setCondition(std::string condition)
3066 {
3067  DEBTRACE("SubjectWhileLoop::setCondition " << condition);
3068  Proc *proc = GuiContext::getCurrent()->getProc();
3069  CommandSetWhileCondition *command =
3070  new CommandSetWhileCondition(proc->getChildName(getNode()), condition);
3071  if (command->execute())
3072  {
3073  GuiContext::getCurrent()->getInvoc()->add(command);
3074  return true;
3075  }
3076  else delete command;
3077  return false;
3078 }
3079 
3081 {
3082  return true;
3083 }
3084 
3086 {
3088 }
3089 
3090 // ----------------------------------------------------------------------------
3091 
3093  : SubjectComposedNode(aSwitch, parent), _switch(aSwitch)
3094 {
3095  _bodyMap.clear();
3096 }
3097 
3099 {
3100  DEBTRACE("SubjectSwitch::~SubjectSwitch " << getName());
3101 }
3102 
3104 {
3105  if (_askRegisterUndo)
3106  {
3107  _askRegisterUndo = false;
3109  }
3110  localclean(command);
3111  SubjectComposedNode::clean(command);
3112 }
3113 
3115 {
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);
3121 }
3122 
3124 {
3125  update(event, type, son);
3126  map<int, SubjectNode*>::iterator it = _bodyMap.begin();
3127  for (; it != _bodyMap.end(); ++it)
3128  (*it).second->recursiveUpdate(event, type, son);
3129 }
3130 
3132  std::string compo,
3133  std::string type,
3134  std::string name,
3135  bool newCompoInst,
3136  int swCase,
3137  bool replace)
3138 {
3139  DEBTRACE("SubjectSwitch::addNode("<<catalog<<","<<compo<<","<<type<<","<<name<<","<<swCase<<","<<(int)replace<<")");
3140  SubjectNode* body = 0;
3141  if (!replace && _bodyMap.count(swCase))
3142  {
3143  GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a switch case, put the nodes in a bloc";
3144  return body;
3145  }
3146  body = createNode(catalog, compo, type, name, newCompoInst, swCase);
3147  return body;
3148 }
3149 
3151 {
3152  DEBTRACE("SubjectSwitch::removeNode("<<son->getName()<<")");
3153  if (son)
3154  {
3155  int id;
3156  bool isFound = false;
3157  map<int, SubjectNode*>::const_iterator it;
3158  for (it = _bodyMap.begin(); it != _bodyMap.end(); ++it)
3159  {
3160  if ( (*it).second == son )
3161  {
3162  isFound = true;
3163  id = (*it).first;
3164  break;
3165  }
3166  }
3167  if (isFound)
3168  {
3169  DEBTRACE("id = "<<id);
3170  _bodyMap.erase(id);
3171  }
3172  }
3173 }
3174 
3175 std::map<int, SubjectNode*> SubjectSwitch::getBodyMap()
3176 {
3177  return _bodyMap;
3178 }
3179 
3181 {
3182  DEBTRACE("SubjectSwitch::houseKeepingAfterCutPaste");
3183  if (isCut)
3184  _bodyMap.erase(_switch->getRankOfNode(son->getNode()));
3185  else
3186  _bodyMap[_switch->getRankOfNode(son->getNode())] = son;
3187 }
3188 
3189 
3191 {
3192  DEBTRACE("SubjectSwitch::completeChildrenSubjectList");
3193  _bodyMap[_switch->getRankOfNode(son->getNode())] = son;
3194 }
3195 
3197 {
3198  SubjectNode* aChild = 0;
3199 
3200  if (node)
3201  {
3202  map<int, SubjectNode*>::const_iterator it;
3203  for (it = _bodyMap.begin(); it != _bodyMap.end(); ++it)
3204  if ( (*it).second->getNode() == node )
3205  {
3206  aChild = (*it).second;
3207  break;
3208  }
3209  }
3210 
3211  return aChild;
3212 }
3213 
3214 bool SubjectSwitch::setSelect(std::string select)
3215 {
3216  DEBTRACE("SubjectSwitch::setSelect " << select);
3217  Proc *proc = GuiContext::getCurrent()->getProc();
3218  CommandSetSwitchSelect *command =
3220  if (command->execute())
3221  {
3222  GuiContext::getCurrent()->getInvoc()->add(command);
3223  return true;
3224  }
3225  else delete command;
3226  return false;
3227 }
3228 
3229 bool SubjectSwitch::setCase(std::string caseId, SubjectNode* snode)
3230 {
3231  DEBTRACE("SubjectSwitch::setCase " << caseId);
3232  Proc *proc = GuiContext::getCurrent()->getProc();
3233 
3234  Switch* aSwitch = dynamic_cast<Switch*>(getNode());
3235  Node* node =snode->getNode();
3236  int previousRank = aSwitch->getRankOfNode(node);
3237  int newRank = atoi(caseId.c_str());
3238  if (previousRank == newRank) return true; // nothing to do.
3239 
3240  CommandSetSwitchCase *command =
3242  proc->getChildName(snode->getNode()),
3243  caseId);
3244  if (command->execute())
3245  {
3246  GuiContext::getCurrent()->getInvoc()->add(command);
3247  return true;
3248  }
3249  else delete command;
3250  return false;
3251 }
3252 
3254 {
3255  return true;
3256 }
3257 
3259 {
3260  return _switch->edGetConditionPort()->getAsString();
3261 }
3262 
3263 // ----------------------------------------------------------------------------
3264 
3266  : SubjectComposedNode(dynParaLoop, parent), _dynParaLoop(dynParaLoop)
3267 {
3268  _subjectExecNode = NULL;
3269  _subjectInitNode = NULL;
3270  _subjectFinalizeNode = NULL;
3271 }
3272 
3274 {
3275  DEBTRACE("SubjectDynParaLoop::~SubjectDynParaLoop " << getName());
3276 }
3277 
3279 {
3280  update(event, type, son);
3281  if (_subjectExecNode)
3282  _subjectExecNode->recursiveUpdate(event, type, son);
3283  if (_subjectInitNode)
3284  _subjectInitNode->recursiveUpdate(event, type, son);
3286  _subjectFinalizeNode->recursiveUpdate(event, type, son);
3287 }
3288 
3290  std::string compo,
3291  std::string type,
3292  std::string name,
3293  bool newCompoInst)
3294 {
3295  DEBTRACE("SubjectDynParaLoop::addNode(catalog, compo, type, name)");
3296  if (_subjectExecNode)
3297  {
3298  GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a loop, "
3299  "put the nodes in a bloc";
3300  return NULL;
3301  }
3302  return createNode(catalog, compo, type, name, newCompoInst);
3303 }
3304 
3306 {
3307  if (isCut)
3308  removeNode(son);
3309  else
3310  _subjectExecNode = son;
3311 }
3312 
3314 {
3315  if (_askRegisterUndo)
3316  {
3317  _askRegisterUndo = false;
3319  }
3320  localclean(command);
3321  SubjectComposedNode::clean(command);
3322 }
3323 
3325 {
3326  DEBTRACE("SubjectDynParaLoop::localClean ");
3327  if (_subjectExecNode)
3328  {
3331  }
3332  if (_subjectInitNode)
3333  {
3336  }
3338  {
3341  }
3342 }
3343 
3345 {
3346  YASSERT(son);
3347  if (son->getNode() == _dynParaLoop->getExecNode())
3348  _subjectExecNode = son;
3349  else if (son->getNode() == _dynParaLoop->getInitNode())
3350  _subjectInitNode = son;
3351  else if (son->getNode() == _dynParaLoop->getFinalizeNode())
3352  _subjectFinalizeNode = son;
3353  else
3354  YASSERT(false);
3355 }
3356 
3358 {
3359  YASSERT(child);
3360  if (child == _subjectExecNode)
3361  _subjectExecNode = NULL;
3362  else if (child == _subjectInitNode)
3363  _subjectInitNode = NULL;
3364  else if (child == _subjectFinalizeNode)
3365  _subjectFinalizeNode = NULL;
3366  else
3367  YASSERT(false);
3368 }
3369 
3371 {
3372  return _subjectExecNode;
3373 }
3374 
3375 bool SubjectDynParaLoop::setNbBranches(std::string nbBranches)
3376 {
3377  DEBTRACE("SubjectDynParaLoop::setNbBranches " << nbBranches);
3378  Proc * proc = GuiContext::getCurrent()->getProc();
3379  CommandSetForEachBranch * command =
3380  new CommandSetForEachBranch(proc->getChildName(getNode()), nbBranches);
3381  if (command->execute())
3382  {
3383  GuiContext::getCurrent()->getInvoc()->add(command);
3384  return true;
3385  }
3386  else delete command;
3387  return false;
3388 }
3389 
3391 {
3392  return true;
3393 }
3394 
3396 {
3398  if(port)
3399  return port->getAsString();
3400  else
3401  return std::string();
3402 }
3403 
3404 // ----------------------------------------------------------------------------
3405 
3407  : SubjectDynParaLoop(forEachLoop, parent), _forEachLoop(forEachLoop)
3408 {
3409  _splitter = 0;
3410 }
3411 
3413 {
3414  DEBTRACE("SubjectForEachLoop::~SubjectForEachLoop " << getName());
3415 }
3416 
3418 {
3419  if (_askRegisterUndo)
3420  {
3421  _askRegisterUndo = false;
3423  }
3424  Node* aSplitterEngine = 0;
3425  if (_splitter) aSplitterEngine = _splitter->getNode();
3426 
3427  localclean(command);
3428  SubjectDynParaLoop::clean(command);
3429 
3430  if (_forEachLoop && aSplitterEngine)
3431  {
3432  DEBTRACE("SubjectForEachLoop::clean: remove for each loop splitter");
3433  _forEachLoop->edRemoveChild(aSplitterEngine);
3434  }
3435 }
3436 
3438 {
3439  DEBTRACE("SubjectForEachLoop::localClean ");
3440  if (_splitter)
3441  {
3443  erase(_splitter);
3444  }
3445 }
3446 
3448 {
3449  if (son && son->getName() == ForEachLoop::NAME_OF_SPLITTERNODE)
3450  _splitter = son;
3451  else
3453 }
3454 
3456 {
3457  YASSERT(child);
3458  if (child->getName() == ForEachLoop::NAME_OF_SPLITTERNODE)
3459  _splitter = NULL;
3460  else {
3462  }
3463 }
3464 
3465 // ----------------------------------------------------------------------------
3466 
3468  Subject *parent)
3469  : SubjectDynParaLoop(optimizerLoop, parent), _optimizerLoop(optimizerLoop)
3470 {
3471 }
3472 
3474 {
3475  DEBTRACE("SubjectOptimizerLoop::~SubjectOptimizerLoop " << getName());
3476 }
3477 
3479 {
3480  if (_askRegisterUndo)
3481  {
3482  _askRegisterUndo = false;
3484  }
3485  localclean(command);
3486  SubjectDynParaLoop::clean(command);
3487 }
3488 
3490 {
3491  DEBTRACE("SubjectOptimizerLoop::localClean ");
3492 }
3493 
3494 bool SubjectOptimizerLoop::setAlgorithm(const std::string& alglib,const std::string& symbol)
3495 {
3496  DEBTRACE("SubjectOptimizerLoop::setAlgorithm " << alglib << " " << symbol);
3497  Proc *proc = GuiContext::getCurrent()->getProc();
3498  CommandSetAlgo *command = new CommandSetAlgo(proc->getChildName(getNode()), alglib, symbol);
3499  if (command->execute())
3500  {
3501  GuiContext::getCurrent()->getInvoc()->add(command);
3502  return true;
3503  }
3504  else delete command;
3505  return false;
3506 }
3507 
3508 // ----------------------------------------------------------------------------
3509 
3511  : Subject(parent), _dataPort(port)
3512 {
3513  _listSubjectLink.clear();
3514  _execValue = "";
3515 }
3516 
3518 {
3519  DEBTRACE("SubjectDataPort::~SubjectDataPort " << getName());
3520  if (isDestructible())
3521  {
3522  Node* node = _dataPort->getNode();
3523  ElementaryNode * father = dynamic_cast<ElementaryNode*>(node);
3524  if (father)
3525  {
3526  DEBTRACE("father->edRemovePort(_dataPort)");
3527  try
3528  {
3529  father->edRemovePort(_dataPort);
3530  }
3531  catch (YACS::Exception &e)
3532  {
3533  DEBTRACE("------------------------------------------------------------------------------");
3534  DEBTRACE("SubjectDataPort::~SubjectDataPort: father->edRemovePort: YACS exception " << e.what());
3535  DEBTRACE("------------------------------------------------------------------------------");
3536  }
3537  }
3538  }
3539 }
3540 
3542 {
3543  if (_askRegisterUndo)
3544  {
3545  _askRegisterUndo = false;
3547  }
3548  localclean(command);
3549  Subject::clean(command);
3550 }
3551 
3553 {
3554  DEBTRACE("SubjectDataPort::localClean ");
3555  list<SubjectLink*> lsl = getListOfSubjectLink();
3556  for (list<SubjectLink*>::iterator it = lsl.begin(); it != lsl.end(); ++it)
3557  erase(*it);
3558 }
3559 
3561 {
3562  return _dataPort->getName();
3563 }
3564 
3565 bool SubjectDataPort::setName(std::string name)
3566 {
3567  DEBTRACE("SubjectDataPort::setName " << name);
3568  Proc *proc = GuiContext::getCurrent()->getProc();
3569  string position = "";
3570  Node *node = getPort()->getNode();
3571  if (proc != dynamic_cast<Proc*>(node))
3572  position = proc->getChildName(node);
3573  else
3574  position = node->getName();
3575 
3576  Command *command = 0;
3577  bool isIn = dynamic_cast<InPort*>(_dataPort);
3578  if (isIn)
3579  command = new CommandRenameInDataPort(position, _dataPort->getName(),name, getType());
3580  else
3581  command = new CommandRenameOutDataPort(position, _dataPort->getName(),name, getType());
3582 
3583  if (command->execute())
3584  {
3585  GuiContext::getCurrent()->getInvoc()->add(command);
3586  return true;
3587  }
3588  else delete command;
3589  return false;
3590 }
3591 
3593 {
3594  return _dataPort;
3595 }
3596 
3597 bool SubjectDataPort::tryCreateLink(SubjectDataPort *subOutport, SubjectDataPort *subInport,bool control)
3598 {
3599  DEBTRACE("SubjectDataPort::tryCreateLink");
3600 
3601  InPort *inp = dynamic_cast<InPort*>(subInport->getPort());
3602  OutPort *outp = dynamic_cast<OutPort*>(subOutport->getPort());
3603  if (outp && outp->isAlreadyLinkedWith(inp))
3604  {
3605  DEBTRACE("isAlreadyLinkedWith");
3606  GuiContext::getCurrent()->_lastErrorMessage = "Ports are already linked";
3607  return false;
3608  }
3609 
3610  Proc *proc = GuiContext::getCurrent()->getProc();
3611 
3612  string outNodePos = "";
3613  SubjectNode *sno = dynamic_cast<SubjectNode*>(subOutport->getParent());
3614  YASSERT(sno);
3615  Node *outNode = sno->getNode();
3616  outNodePos = proc->getChildName(outNode);
3617  string outportName = subOutport->getName();
3618 
3619  string inNodePos = "";
3620  SubjectNode *sni = dynamic_cast<SubjectNode*>(subInport->getParent());
3621  YASSERT(sni);
3622  Node *inNode = sni->getNode();
3623  inNodePos = proc->getChildName(inNode);
3624  string inportName = subInport->getName();
3625 
3626  CommandAddLink *command = new CommandAddLink(outNodePos, outportName, subOutport->getType(),
3627  inNodePos, inportName, subInport->getType(), control);
3628  if (command->execute())
3629  {
3630  GuiContext::getCurrent()->getInvoc()->add(command);
3631  return true;
3632  }
3633  else
3634  {
3635  delete command;
3636  return false;
3637  }
3638 }
3639 
3643 bool SubjectDataPort::setValue(std::string value)
3644 {
3645  return false;
3646 }
3647 
3648 void SubjectDataPort::setExecValue(std::string value)
3649 {
3650  _execValue = value;
3651 }
3652 
3654 {
3655  return _execValue;
3656 }
3657 
3659 {
3660  DEBTRACE("SubjectDataPort::registerUndoDestroy");
3661  Proc *proc = GuiContext::getCurrent()->getProc();
3662  SubjectNode *sno = dynamic_cast<SubjectNode*>(getParent());
3663  YASSERT(sno);
3664  Node *node = sno->getNode();
3665  string nodeName = proc->getChildName(node);
3666  string portName = getName();
3667  ElementaryNode* father = dynamic_cast<ElementaryNode*>(node);
3668  YASSERT(father);
3669 
3670  DataPort *port = getPort();
3671  TypeCode *dtyp = port->edGetType();
3672  string typeName = dtyp->name();
3673  Catalog *undoCata = GuiContext::getCurrent()->getInvoc()->getUndoCata();
3674  undoCata->_typeMap[typeName] = dtyp;
3675 
3676  Command *command = 0;
3677  Command *comm2 =0;
3678  TypeOfElem elemType = getType();
3679  switch (elemType)
3680  {
3681  case INPUTPORT:
3682  command = new CommandAddInputPortFromCatalog(undoCata, typeName, nodeName, portName);
3683  {
3684  int rang = 1;
3685  int nbUp = 0;
3686  list<InputPort*> plist = father->getSetOfInputPort();
3687  list<InputPort*>::iterator pos = plist.begin();
3688  for (; (*pos) != port; pos++)
3689  rang++;
3690  nbUp = plist.size() -rang;
3691  if (nbUp)
3692  comm2 = new CommandOrderInputPorts(nodeName, portName, nbUp);
3693  }
3694  break;
3695  case OUTPUTPORT:
3696  command = new CommandAddOutputPortFromCatalog(undoCata, typeName, nodeName, portName);
3697  {
3698  int rang = 1;
3699  int nbUp = 0;
3700  list<OutputPort*> plist = father->getSetOfOutputPort();
3701  list<OutputPort*>::iterator pos = plist.begin();
3702  for (; (*pos) != port; pos++)
3703  rang++;
3704  nbUp = plist.size() -rang;
3705  if (nbUp)
3706  comm2 = new CommandOrderOutputPorts(nodeName, portName, nbUp);
3707  }
3708  break;
3709  case INPUTDATASTREAMPORT:
3710  command = new CommandAddIDSPortFromCatalog(undoCata, typeName, nodeName, portName);
3711  break;
3712  case OUTPUTDATASTREAMPORT:
3713  command = new CommandAddODSPortFromCatalog(undoCata, typeName, nodeName, portName);
3714  break;
3715  }
3716  if (command)
3717  GuiContext::getCurrent()->getInvoc()->add(command);
3718  if (comm2)
3719  GuiContext::getCurrent()->getInvoc()->add(comm2);
3720  //save links
3721  list<SubjectLink*> lsl = getListOfSubjectLink();
3722  for (list<SubjectLink*>::iterator it = lsl.begin(); it != lsl.end(); ++it)
3723  {
3724  (*it)->registerUndoDestroy();
3725  }
3726 }
3727 
3728 
3729 // ----------------------------------------------------------------------------
3730 
3732  : SubjectDataPort(port, parent), _inputPort(port)
3733 {
3734  Node *node = _inputPort->getNode();
3735  if (ForLoop* forloop = dynamic_cast<ForLoop*>(node))
3736  {
3737  if (_inputPort->getName() == "nsteps") _destructible = false;
3738  }
3739  else if (WhileLoop* whileloop = dynamic_cast<WhileLoop*>(node))
3740  {
3741  if (_inputPort->getName() == "condition") _destructible = false;
3742  }
3743  else if (Switch* aSwitch = dynamic_cast<Switch*>(node))
3744  {
3745  if (_inputPort->getName() == "select") _destructible = false;
3746  }
3747  else if (ForEachLoopGen* foreach = dynamic_cast<ForEachLoopGen*>(node))
3748  {
3749  if (_inputPort->getName() == "nbBranches") _destructible = false;
3750  }
3751  else if (OptimizerLoop* optil = dynamic_cast<OptimizerLoop*>(node))
3752  {
3753  if (_inputPort->getName() == "nbBranches") _destructible = false;
3754  }
3755  else if (SplitterNode* split = dynamic_cast<SplitterNode*>(node))
3756  {
3757  if (_inputPort->getName() == "SmplsCollection") _destructible = false;
3758  }
3759 
3760 }
3761 
3763 {
3764  DEBTRACE("SubjectInputPort::~SubjectInputPort " << getName());
3765 }
3766 
3768 {
3769  if (_askRegisterUndo)
3770  {
3771  _askRegisterUndo = false;
3773  }
3774  localclean(command);
3775  SubjectDataPort::clean(command);
3776 }
3777 
3779 {
3780  DEBTRACE("SubjectInputPort::localClean ");
3781  if (_parent)
3782  {
3783  SubjectElementaryNode* elem = dynamic_cast<SubjectElementaryNode*>(_parent);
3784  if (elem) elem->removePort(this);
3785  }
3786 }
3787 
3788 bool SubjectInputPort::setValue(std::string value)
3789 {
3790  DEBTRACE("SubjectInputPort::setValue " << value);
3791  Proc *proc = GuiContext::getCurrent()->getProc();
3792  CommandSetInPortValue *command =
3793  new CommandSetInPortValue(proc->getChildName(getPort()->getNode()), getName(), value);
3794  if (command->execute())
3795  {
3796  GuiContext::getCurrent()->getInvoc()->add(command);
3797  return true;
3798  }
3799  else delete command;
3800  return false;
3801 }
3802 
3803 // ----------------------------------------------------------------------------
3804 
3806  : SubjectDataPort(port, parent), _outputPort(port)
3807 {
3808  if (DynParaLoop* dynloop = dynamic_cast<DynParaLoop*>(_outputPort->getNode()))
3809  {
3810  if (_outputPort == dynloop->edGetSamplePort()) _destructible = false;
3811  }
3812 }
3813 
3815 {
3816  DEBTRACE("SubjectOutputPort::~SubjectOutputPort " << getName());
3817 }
3818 
3820 {
3821  if (_askRegisterUndo)
3822  {
3823  _askRegisterUndo = false;
3825  }
3826  localclean(command);
3827  SubjectDataPort::clean(command);
3828 }
3829 
3831 {
3832  DEBTRACE("SubjectOutputPort::localClean ");
3833  if (_parent)
3834  {
3835  SubjectElementaryNode* elem = dynamic_cast<SubjectElementaryNode*>(_parent);
3836  if (elem) elem->removePort(this);
3837  }
3838 }
3839 
3840 bool SubjectOutputPort::setValue(std::string value)
3841 {
3842  DEBTRACE("SubjectOutputPort::setValue " << value);
3843  Proc *proc = GuiContext::getCurrent()->getProc();
3844  CommandSetOutPortValue *command =
3845  new CommandSetOutPortValue(proc->getChildName(getPort()->getNode()), getName(), value);
3846  if (command->execute())
3847  {
3848  GuiContext::getCurrent()->getInvoc()->add(command);
3849  return true;
3850  }
3851  else delete command;
3852  return false;
3853 }
3854 
3855 // ----------------------------------------------------------------------------
3856 
3858  Subject *parent)
3859  : SubjectDataPort(port, parent), _inputDataStreamPort(port)
3860 {
3861 }
3862 
3864 {
3865  DEBTRACE("SubjectInputDataStreamPort::~SubjectInputDataStreamPort " << getName());
3866 }
3867 
3868 std::map<std::string, std::string> SubjectInputDataStreamPort::getProperties()
3869 {
3871 }
3872 
3874 {
3875  std::vector<std::string> props;
3876  props.push_back("StorageLevel");
3877  //props.push_back("DependencyType");
3878  props.push_back("DateCalSchem");
3879  props.push_back("Alpha");
3880  props.push_back("DeltaT");
3881  props.push_back("InterpolationSchem");
3882  props.push_back("ExtrapolationSchem");
3883  return props;
3884 }
3885 
3886 bool SubjectInputDataStreamPort::setProperties(std::map<std::string, std::string> properties)
3887 {
3888  Proc *proc = GuiContext::getCurrent()->getProc();
3889  CommandSetDSPortProperties *command =
3890  new CommandSetDSPortProperties(proc->getChildName(getPort()->getNode()), getName(), true, properties);
3891  if (command->execute())
3892  {
3893  GuiContext::getCurrent()->getInvoc()->add(command);
3894  return true;
3895  }
3896  else delete command;
3897  return false;
3898 }
3899 
3901 {
3902  if (_askRegisterUndo)
3903  {
3904  _askRegisterUndo = false;
3906  }
3907  localclean(command);
3908  SubjectDataPort::clean(command);
3909 }
3910 
3912 {
3913  DEBTRACE("SubjectInputDataStreamPort::localClean ");
3914 }
3915 
3917 {
3918  DEBTRACE("SubjectInputDataStreamPort::registerUndoDestroy");
3920  map<string,string> properties = getProperties();
3921  if (properties.empty())
3922  return;
3923  Proc *proc = GuiContext::getCurrent()->getProc();
3924  SubjectNode *sno = dynamic_cast<SubjectNode*>(getParent());
3925  YASSERT(sno);
3926  Node *node = sno->getNode();
3927  string nodeName = proc->getChildName(node);
3928  string portName = getName();
3929  Command *command = new CommandSetDSPortProperties(nodeName, portName, true, properties);
3930  GuiContext::getCurrent()->getInvoc()->add(command);
3931 }
3932 
3933 // ----------------------------------------------------------------------------
3934 
3936  Subject *parent)
3937  : SubjectDataPort(port, parent), _outputDataStreamPort(port)
3938 {
3939 }
3940 
3942 {
3943  DEBTRACE("SubjectOutputDataStreamPort::~SubjectOutputDataStreamPort " << getName());
3944 }
3945 
3946 std::map<std::string, std::string> SubjectOutputDataStreamPort::getProperties()
3947 {
3949 }
3950 
3951 bool SubjectOutputDataStreamPort::setProperties(std::map<std::string, std::string> properties)
3952 {
3953  Proc *proc = GuiContext::getCurrent()->getProc();
3954  CommandSetDSPortProperties *command =
3955  new CommandSetDSPortProperties(proc->getChildName(getPort()->getNode()), getName(), false, properties);
3956  if (command->execute())
3957  {
3958  GuiContext::getCurrent()->getInvoc()->add(command);
3959  return true;
3960  }
3961  else delete command;
3962  return false;
3963 }
3964 
3966 {
3967  if (_askRegisterUndo)
3968  {
3969  _askRegisterUndo = false;
3971  }
3972  localclean(command);
3973  SubjectDataPort::clean(command);
3974 }
3975 
3977 {
3978  DEBTRACE("SubjectOutputDataStreamPort::localClean ");
3979 }
3980 
3982 {
3983  DEBTRACE("SubjectOutputDataStreamPort::registerUndoDestroy");
3985  map<string,string> properties = getProperties();
3986  if (properties.empty())
3987  return;
3988  Proc *proc = GuiContext::getCurrent()->getProc();
3989  SubjectNode *sno = dynamic_cast<SubjectNode*>(getParent());
3990  YASSERT(sno);
3991  Node *node = sno->getNode();
3992  string nodeName = proc->getChildName(node);
3993  string portName = getName();
3994  Command *command = new CommandSetDSPortProperties(nodeName, portName, false, properties);
3995  GuiContext::getCurrent()->getInvoc()->add(command);
3996 }
3997 
3998 // ----------------------------------------------------------------------------
3999 
4001  SubjectDataPort* outPort,
4002  SubjectNode* subInNode,
4003  SubjectDataPort* inPort,
4004  Subject *parent)
4005  : Subject(parent),
4006  _subOutNode(subOutNode), _outPort(outPort), _subInNode(subInNode), _inPort(inPort)
4007 {
4008  _name = "";
4009  ComposedNode *cla = ComposedNode::getLowestCommonAncestor(_subOutNode->getNode()->getFather(),
4010  _subInNode->getNode()->getFather());
4011  DEBTRACE(_subOutNode->getName() << "." << _outPort->getName());
4012  DEBTRACE(_subInNode->getName() << "." << _inPort->getName());
4013  DEBTRACE(cla->getName());
4014  _name += cla->getChildName(_subOutNode->getNode());
4015  _name += "." + _outPort->getName();
4016  _name += "->";
4017  _name += cla->getChildName(_subInNode->getNode());
4018  _name += "." + _inPort->getName();
4019  DEBTRACE("SubjectLink::SubjectLink " << _name);
4020 }
4021 
4023 {
4024  DEBTRACE("SubjectLink::~SubjectLink " << getName());
4027 }
4028 
4030 {
4031  if (_askRegisterUndo)
4032  {
4033  _askRegisterUndo = false;
4035  }
4036  localclean(command);
4037  Subject::clean(command);
4038 }
4039 
4041 {
4042  DEBTRACE("SubjectLink::localClean ");
4043  if (_parent)
4044  {
4045  DEBTRACE("clean link: " << _parent->getName() << " " << getName());
4046  SubjectComposedNode* father = dynamic_cast<SubjectComposedNode*>(_parent);
4047  YASSERT(father);
4048  father->removeLink(this); // --- clean subjects first
4049  _cla = dynamic_cast<ComposedNode*>(father->getNode());
4050  YASSERT(_cla);
4051  _outp = dynamic_cast<OutPort*>(_outPort->getPort());
4052  YASSERT(_outp);
4053  _inp = dynamic_cast<InPort*>(_inPort->getPort());
4054  YASSERT(_inp);
4055  if (isDestructible())
4057  }
4058 }
4059 
4061 {
4062  return _name;
4063 }
4064 
4065 std::map<std::string, std::string> SubjectLink::getProperties()
4066 {
4067  return getSubjectInPort()->getProperties();
4068 }
4069 
4070 std::vector<std::string> SubjectLink::knownProperties()
4071 {
4072  return getSubjectInPort()->knownProperties();
4073 }
4074 
4075 bool SubjectLink::setProperties(std::map<std::string, std::string> properties)
4076 {
4077  Proc *proc = GuiContext::getCurrent()->getProc();
4078  CommandSetLinkProperties *command =
4079  new CommandSetLinkProperties(proc->getChildName(getSubjectOutPort()->getPort()->getNode()), getSubjectOutPort()->getName(),
4080  proc->getChildName(getSubjectInPort()->getPort()->getNode()), getSubjectInPort()->getName(),
4081  properties);
4082  if (command->execute())
4083  {
4084  GuiContext::getCurrent()->getInvoc()->add(command);
4085  return true;
4086  }
4087  else delete command;
4088  return false;
4089 }
4090 
4092 {
4093  DEBTRACE("SubjectLink::registerUndoDestroy");
4094  Proc *proc = GuiContext::getCurrent()->getProc();
4095  Node *outn = getSubjectOutNode()->getNode();
4096  Node *inn = getSubjectInNode()->getNode();
4097  DataPort *outp = getSubjectOutPort()->getPort();
4098  DataPort *inp = getSubjectInPort()->getPort();
4099  CommandAddLink *command = new CommandAddLink(proc->getChildName(outn),
4100  outp->getName(),
4102  proc->getChildName(inn),
4103  inp->getName(),
4105  false);
4106  GuiContext::getCurrent()->getInvoc()->add(command);
4107 
4108  map<string, string> properties = getProperties();
4109  if (properties.empty())
4110  return;
4111 
4113  outp->getName(),
4114  proc->getChildName(inn),
4115  inp->getName(),
4116  properties);
4117  GuiContext::getCurrent()->getInvoc()->add(command2);
4118 }
4119 
4120 // ----------------------------------------------------------------------------
4121 
4123  SubjectNode* subInNode,
4124  Subject *parent)
4125  : Subject(parent),
4126  _subOutNode(subOutNode), _subInNode(subInNode)
4127 {
4128  _name = "";
4129  ComposedNode *cla = ComposedNode::getLowestCommonAncestor(_subOutNode->getNode()->getFather(),
4130  _subInNode->getNode()->getFather());
4133  DEBTRACE(cla->getName());
4134  _name += cla->getChildName(_subOutNode->getNode());
4135  _name += "-->>";
4136  _name += cla->getChildName(_subInNode->getNode());
4137  DEBTRACE("SubjectControlLink::SubjectControlLink " << _name);
4138 }
4139 
4141 {
4142  DEBTRACE("SubjectControlLink::~SubjectControlLink " << getName());
4143  if (isDestructible())
4144  {
4145  try
4146  {
4147 
4149  }
4150  catch (YACS::Exception &e)
4151  {
4152  DEBTRACE("------------------------------------------------------------------------------");
4153  DEBTRACE("SubjectControlLink::~SubjectControlLink: edRemoveLink YACS exception " << e.what());
4154  DEBTRACE("------------------------------------------------------------------------------");
4155  }
4156  }
4157 }
4158 
4160 {
4161  if (_askRegisterUndo)
4162  {
4163  _askRegisterUndo = false;
4165  }
4166  localclean(command);
4167  Subject::clean(command);
4168 }
4169 
4171 {
4172  DEBTRACE("SubjectControlLink::localClean ");
4173  if (_parent)
4174  {
4175  DEBTRACE("clean control link: " << _parent->getName() << " " << getName());
4176  SubjectComposedNode* father = dynamic_cast<SubjectComposedNode*>(_parent);
4177  YASSERT(father);
4178  father->removeControlLink(this); // --- clean subjects first
4179  _cla = dynamic_cast<ComposedNode*>(father->getNode());
4180  YASSERT(_cla);
4181  }
4182 }
4183 
4185 {
4186  return _name;
4187 }
4188 
4190 {
4191  DEBTRACE("SubjectControlLink::registerUndoDestroy");
4192  Proc *proc = GuiContext::getCurrent()->getProc();
4193  Node *outn = getSubjectOutNode()->getNode();
4194  Node *inn = getSubjectInNode()->getNode();
4195  CommandAddControlLink *command = new CommandAddControlLink(proc->getChildName(outn),
4196  proc->getChildName(inn));
4197  GuiContext::getCurrent()->getInvoc()->add(command);
4198 }
4199 
4200 // ----------------------------------------------------------------------------
4201 
4203  : Subject(parent), _compoInst(component)
4204 {
4205  _compoInst->incrRef();
4206  _subRefContainer = 0;
4207  _subServiceSet.clear();
4208  _subReferenceMap.clear();
4209 }
4210 
4212 {
4213  Proc* aProc = GuiContext::getCurrent()->getProc();
4214  if ( aProc )
4215  {
4218  }
4219  _compoInst->decrRef();
4220 }
4221 
4223 {
4224  if (_askRegisterUndo)
4225  {
4226  _askRegisterUndo = false;
4228  }
4229  localclean(command);
4230  Subject::clean(command);
4231 }
4232 
4234 {
4235  DEBTRACE("SubjectComponent::localClean " << this);
4236  Proc* aProc = GuiContext::getCurrent()->getProc();
4237  if ( aProc )
4238  {
4239  std::map<Node*, SubjectNode*>::iterator it = GuiContext::getCurrent()->_mapOfSubjectNode.begin();
4240  std::list<SubjectNode*> services;
4241  for ( ; it!=GuiContext::getCurrent()->_mapOfSubjectNode.end(); it++ )
4242  {
4243  if(ServiceNode* service=dynamic_cast<ServiceNode*>((*it).first))
4244  {
4245  if ( service->getComponent() == _compoInst )
4246  {
4247  services.push_back((*it).second);
4248  }
4249  }
4250  }
4251  while(!services.empty())
4252  {
4253  SubjectNode* son=services.front();
4254  services.pop_front();
4255  Subject* parent=son->getParent();
4256 // parent->update(REMOVE,son->getType(),son);
4257  parent->erase(son);
4258  parent->update(REMOVE,0,0);
4259  }
4260 
4261  Container* container = _compoInst->getContainer();
4262  if (!container) return;
4263  SubjectContainerBase *subContainer(0);
4264  YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(container));
4265  subContainer = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
4266  subContainer->removeSubComponentFromSet(this);
4267  }
4268 }
4269 
4271 {
4272  return _compoInst->getInstanceName();
4273 }
4274 
4275 std::pair<std::string, int> SubjectComponent::getKey()
4276 {
4277  std::pair<std::string, int> key = std::pair<std::string, int>(_compoInst->getCompoName(), _compoInst->getNumId());
4278  return key;
4279 }
4280 
4282 {
4283  return _compoInst;
4284 }
4285 
4291 {
4292  DEBTRACE("SubjectComponent::setContainer " << getName());
4293  Container* container = _compoInst->getContainer();
4294  if (container)
4295  {
4296  SubjectContainerBase *subContainer;
4297  if (GuiContext::getCurrent()->_mapOfSubjectContainer.count(container))
4298  subContainer = GuiContext::getCurrent()->_mapOfSubjectContainer[container];
4299  else
4300  subContainer =
4301  GuiContext::getCurrent()->getSubjectProc()->addSubjectContainer(container, container->getName());
4302  addSubjectReference(subContainer);
4303  if (_subRefContainer)
4304  subContainer->moveComponent(_subRefContainer);
4305  else
4306  _subRefContainer = subContainer->attachComponent(this);
4307  notifyServicesChange(ASSOCIATE, CONTAINER, subContainer);
4308  }
4309 }
4310 
4312 {
4313  DEBTRACE("SubjectComponent::associateToContainer " << getName() << " " << subcont->getName());
4316  if (command->execute())
4317  {
4318  if (!GuiContext::getCurrent()->isLoading()) // do not register command when loading a schema
4319  GuiContext::getCurrent()->getInvoc()->add(command);
4320  else delete command;
4321  return true;
4322  }
4323  else delete command;
4324  return false;
4325 }
4326 
4328 {
4329  DEBTRACE("SubjectComponent::attachService");
4330  SubjectReference *son = new SubjectReference(service, this);
4331  _subServiceSet.insert(service);
4332  _subReferenceMap[service] = son;
4333  update(ADDCHILDREF, SALOMENODE, son);
4334  return son;
4335 }
4336 
4338 {
4339  DEBTRACE("SubjectComponent::detachService");
4340  YASSERT(_subReferenceMap.count(service));
4341  SubjectReference *reference = _subReferenceMap[service];
4342  update(REMOVECHILDREF, SALOMENODE, reference);
4343  _subServiceSet.erase(service);
4344  _subReferenceMap.erase(service);
4345  service->removeSubRefComponent();
4346  erase(reference);
4347 }
4348 
4350 {
4351  DEBTRACE("SubjectComponent::moveService");
4352  SubjectComponent* oldcomp = dynamic_cast<SubjectComponent*>(reference->getParent());
4353  YASSERT(oldcomp);
4354 
4355  SubjectServiceNode* service = dynamic_cast<SubjectServiceNode*>(reference->getReference());
4356  oldcomp->removeSubServiceFromSet(service);
4357  _subServiceSet.insert(service);
4358  _subReferenceMap[service] = reference;
4359  oldcomp->update(CUT, SALOMENODE, reference);
4360  reference->reparent(this);
4361  update(PASTE, SALOMENODE, reference);
4362  if (!oldcomp->hasServices())
4363  Subject::erase(oldcomp);
4364 }
4365 
4367 {
4368  DEBTRACE("SubjectComponent::removeSubServiceFromSet " << getName() << " " << service->getName());
4369  _subServiceSet.erase(service);
4370  _subReferenceMap.erase(service);
4371 }
4372 
4374 {
4375  DEBTRACE("SubjectComponent::notifyServicesChange");
4376  set<SubjectServiceNode*>::iterator it = _subServiceSet.begin();
4377  for(; it != _subServiceSet.end(); ++it)
4378  {
4379  (*it)->update(event, type, son);
4380  }
4381 }
4382 
4383 bool SubjectComponent::setProperties(std::map<std::string, std::string> properties)
4384 {
4386  if (command->execute())
4387  {
4388  GuiContext::getCurrent()->getInvoc()->add(command);
4389  return true;
4390  }
4391  else delete command;
4392  return false;
4393 }
4394 
4395 std::map<std::string, std::string> SubjectComponent::getProperties()
4396 {
4397  return _compoInst->getProperties();
4398 }
4399 
4400 // ----------------------------------------------------------------------------
4401 
4403 {
4404  if(!container)
4405  return 0;
4406  if(!dynamic_cast<YACS::ENGINE::HomogeneousPoolContainer *>(container))
4407  return new SubjectContainer(container,parent);
4408  else
4409  return new SubjectHPContainer(dynamic_cast<YACS::ENGINE::HomogeneousPoolContainer *>(container),parent);
4410 }
4411 
4412 SubjectContainerBase::SubjectContainerBase(YACS::ENGINE::Container* container, Subject *parent):Subject(parent), _container(container)
4413 {
4414  _subComponentSet.clear();
4415  _subReferenceMap.clear();
4416 }
4417 
4419 {
4420  DEBTRACE("SubjectContainerBase::~SubjectContainerBase");
4421  Proc* aProc = GuiContext::getCurrent()->getProc();
4422  if ( aProc )
4423  {
4424  map<ComponentInstance*,SubjectComponent*> mapOfSubjectComponentCpy
4426  map<ComponentInstance*,SubjectComponent*>::iterator it = mapOfSubjectComponentCpy.begin();
4427  for ( ; it!=mapOfSubjectComponentCpy.end(); it++ )
4428  if ( (*it).first && (*it).first->getContainer() == _container )
4429  {
4430  (*it).first->setContainer(0);
4431  GuiContext::getCurrent()->getSubjectProc()->destroy((*it).second);
4432  }
4433 
4435  aProc->removeContainer(_container);
4436  }
4437 }
4438 
4439 std::map<std::string, std::string> SubjectContainerBase::getProperties()
4440 {
4441  return _container->getProperties();
4442 }
4443 
4444 bool SubjectContainerBase::setProperties(std::map<std::string, std::string> properties)
4445 {
4447  if (command->execute())
4448  {
4449  GuiContext::getCurrent()->getInvoc()->add(command);
4450  return true;
4451  }
4452  else
4453  delete command;
4454  return false;
4455 }
4456 
4457 bool SubjectContainerBase::setName(std::string name)
4458 {
4459  DEBTRACE("SubjectContainer::setName " << name);
4460  if (name == getName())
4461  return true;
4462  CommandRenameContainer* command = new CommandRenameContainer(getName(), name);
4463  if (command->execute())
4464  {
4465  GuiContext::getCurrent()->getInvoc()->add(command);
4466  return true;
4467  }
4468  else delete command;
4469  return false;
4470 }
4471 
4473 {
4474  DEBTRACE("SubjectContainer::attachComponent");
4475  SubjectReference *son = new SubjectReference(component, this);
4476  _subComponentSet.insert(component);
4477  _subReferenceMap[component] = son;
4478  update(ADDCHILDREF, COMPONENT, son);
4479  return son;
4480 }
4481 
4483 {
4484  DEBTRACE("SubjectContainer::detachComponent");
4485  YASSERT(_subReferenceMap.count(component));
4486  SubjectReference *reference = _subReferenceMap[component];
4487  update(REMOVECHILDREF, PYTHONNODE, reference);
4488  _subComponentSet.erase(component);
4489  _subReferenceMap.erase(component);
4490  erase(reference);
4491 }
4492 
4494 {
4495  DEBTRACE("SubjectContainer::moveComponent");
4496  SubjectContainer* oldcont = dynamic_cast<SubjectContainer*>(reference->getParent());
4497  YASSERT(oldcont);
4498  SubjectComponent* component = dynamic_cast<SubjectComponent*>(reference->getReference());
4499  _subComponentSet.insert(component);
4500  _subReferenceMap[component] = reference;
4501  oldcont->removeSubComponentFromSet(component);
4502  oldcont->update(CUT, COMPONENT, reference);
4503  reference->reparent(this);
4504  update(PASTE, COMPONENT, reference);
4505 }
4506 
4508 {
4509  DEBTRACE("SubjectContainer::removeSubComponentFromSet");
4510  _subComponentSet.erase(component);
4511  _subReferenceMap.erase(component);
4512 }
4513 
4515 {
4516  DEBTRACE("SubjectContainer::notifyComponentsChange");
4517  set<SubjectComponent*>::iterator it = _subComponentSet.begin();
4518  for(; it != _subComponentSet.end(); ++it)
4519  {
4520  (*it)->update(event, type, son);
4521  (*it)->notifyServicesChange(event, type, son);
4522  }
4523 }
4524 
4526 {
4527  if (_askRegisterUndo)
4528  {
4529  _askRegisterUndo = false;
4531  }
4532  localclean(command);
4533  Subject::clean(command);
4534 }
4535 
4537 {
4538  DEBTRACE("SubjectContainerBase::localClean ");
4539  Proc* aProc = GuiContext::getCurrent()->getProc();
4540  if ( aProc )
4541  {
4542  SubjectComponent* compo;
4543  map<ComponentInstance*,SubjectComponent*>::iterator it = GuiContext::getCurrent()->_mapOfSubjectComponent.begin();
4544  std::list<SubjectComponent*> compos;
4545  for ( ; it!=GuiContext::getCurrent()->_mapOfSubjectComponent.end(); it++ )
4546  if ( (*it).first && (*it).first->getContainer() == _container )
4547  {
4548  compo=(*it).second;
4549  (*it).first->setContainer(0);
4550  compos.push_back((*it).second);
4551  }
4552  while(!compos.empty())
4553  {
4554  compo=compos.front();
4555  compos.pop_front();
4558  }
4559  }
4560 }
4561 
4563 {
4564  return _container->getName();
4565 }
4566 
4567 // ----------------------------------------------------------------------------
4568 
4570 {
4571 }
4572 
4574 {
4575  DEBTRACE("SubjectContainer::registerUndoDestroy");
4576  Command *command = new CommandAddContainer(getName(),"");
4577  GuiContext::getCurrent()->getInvoc()->add(command);
4578 }
4579 
4580 // ----------------------------------------------------------------------------
4581 
4583 {
4584 }
4585 
4587 {
4588  if(!_container)
4589  return 0;
4590  else
4591  {
4593  if(!ret)
4594  throw Exception("Invalid container type in SubjectHPContainer !");
4595  return ret;
4596  }
4597 }
4598 
4600 {
4601  DEBTRACE("SubjectHPContainer::registerUndoDestroy");
4602  Command *command = new CommandAddHPContainer(getName(),"");
4603  GuiContext::getCurrent()->getInvoc()->add(command);
4604 }
4605 
4606 // ----------------------------------------------------------------------------
4607 
4609  : Subject(parent), _typeCode(typeCode), _alias(alias)
4610 {
4611 }
4612 
4614 {
4615 }
4616 
4618 {
4619  if (_askRegisterUndo)
4620  {
4621  _askRegisterUndo = false;
4623  }
4624  localclean(command);
4625  Subject::clean(command);
4626 }
4627 
4629 {
4630  DEBTRACE("SubjectDataType::localClean ");
4631 }
4632 
4634 {
4635  return _typeCode->name();
4636 }
4637 
4639 {
4640  return _alias;
4641 }
4642 
4644 {
4645  return _typeCode;
4646 }
4647 
4648 // ----------------------------------------------------------------------------
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Composed node to group elementary and composed nodes.
Definition: Bloc.hxx:36
bool edAddChild(Node *DISOWNnode)
Add a child node to the bloc.
Definition: Bloc.cxx:176
Class for CORBA Service Node.
Definition: CORBANode.hxx:45
class for YACS catalogs.
Definition: Catalog.hxx:42
std::map< std::string, TypeCode * > _typeMap
Definition: Catalog.hxx:49
Base class for all component instances.
virtual bool setContainer(Container *cont)
const std::string & getCompoName() const
const std::string & getInstanceName() const
Base class for all composed nodes.
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort() const
std::string getChildName(const Node *node) const
std::list< Node * > getAllRecursiveNodes()
Get all children nodes elementary and composed including this node.
std::list< OutputPort * > getLocalOutputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself
virtual std::list< Node * > edGetDirectDescendants() const =0
std::vector< std::pair< OutPort *, InPort * > > getSetOfInternalLinks() const
std::string getName() const
void edRemoveCFLink(Node *nodeS, Node *nodeE)
Remove a controlflow link.
std::list< InputPort * > getLocalInputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself
virtual void edRemoveChild(Node *node)
Remove a child node.
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort() const
virtual bool edAddDFLink(OutPort *start, InPort *end)
Connect an OutPort to an InPort and add the necessary control link.
virtual bool edAddChild(Node *DISOWNnode)
bool edAddCFLink(Node *nodeS, Node *nodeE)
Add a controlflow link between two nodes.
bool edAddLink(OutPort *start, InPort *end)
Add a dataflow link between two data ports.
void edRemoveLink(OutPort *start, InPort *end)
Remove a dataflow link.
Node * isInMyDescendance(Node *nodeToTest) const
Returns the parent of a node that is the direct child of this node.
virtual std::map< std::string, std::string > getProperties() const =0
virtual Container * cloneAlways() const =0
virtual std::string getName() const
Definition: Container.hxx:81
Class for C++ Nodes (in process component)
Definition: CppNode.hxx:47
Class for data parameters specification.
Definition: DataNode.hxx:38
virtual std::string getAsString()
returns port value as a string that can be used in a GUI for example
Definition: DataPort.cxx:84
TypeCode * edGetType() const
Definition: DataPort.hxx:53
std::string getName() const
Definition: DataPort.hxx:55
std::map< std::string, std::string > getProperties() const
Base class for dispatcher in observer pattern.
Definition: Dispatcher.hxx:74
virtual void addObserver(Observer *observer, Node *object, const std::string &event)
Definition: Dispatcher.cxx:125
Base class for dynamically (fully or semifully) built graphs.
Definition: DynParaLoop.hxx:41
InputPort * edGetNbOfBranchesPort()
Definition: DynParaLoop.hxx:83
void edRemoveChild(Node *node)
Remove a child node.
Base class for all calculation nodes.
std::list< OutputPort * > getSetOfOutputPort() const
std::list< InputPort * > getLocalInputPorts() const
std::list< InputPort * > getSetOfInputPort() const
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort() const
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort() const
std::list< OutputPort * > getLocalOutputPorts() const
Class for for loop node.
Definition: ForLoop.hxx:33
InputPort * edGetNbOfTimesInputPort()
Definition: ForLoop.hxx:45
std::list< OutGate * > getBackLinks()
Definition: InGate.cxx:134
Class for calculation node (script) inlined (and executed) in the schema.
Definition: InlineNode.hxx:44
virtual std::string getScript()
Definition: InlineNode.hxx:51
Base class for Input Ports.
Definition: InputPort.hxx:44
Base class for all nodes.
Definition: Node.hxx:70
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope() const =0
OutGate * getOutGate()
Definition: Node.hxx:124
virtual Node * getChildByName(const std::string &name) const =0
ComposedNode * getFather() const
Definition: Node.hxx:127
std::map< std::string, std::string > getPropertyMap()
Definition: Node.hxx:173
InGate * getInGate()
Definition: Node.hxx:123
Node * cloneWithoutCompAndContDeepCpy(ComposedNode *father, bool editionOnly=true) const
This method MUST NEVER BE VIRTUAL
Definition: Node.cxx:150
virtual int isValid()
indicates if the node is valid (returns 1) or not (returns 0)
Definition: Node.cxx:730
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope() const =0
const std::string & getName() const
Definition: Node.hxx:125
int getNumId()
return node instance identifiant, unique for each node instance
Definition: Node.cxx:643
virtual Proc * getProc()
Definition: Node.cxx:401
class to build optimization loops
bool isAlreadyInSet(InGate *inGate) const
Definition: OutGate.cxx:150
std::list< InGate * > edSetInGate() const
Definition: OutGate.cxx:112
Class for data out node.
Definition: OutNode.hxx:30
virtual bool isAlreadyLinkedWith(InPort *withp) const =0
Node * getNode() const
Definition: Port.hxx:46
Class for data in node.
Definition: PresetNode.hxx:31
Base class for all schema objects.
Definition: Proc.hxx:44
std::map< std::string, TypeCode * > typeMap
Definition: Proc.hxx:90
virtual void removeContainer(Container *cont)
Remove a container from the containerMap.
Definition: Proc.cxx:581
std::map< std::string, Container * > containerMap
Definition: Proc.hxx:91
std::map< std::string, ComponentInstance * > componentInstanceMap
Definition: Proc.hxx:92
std::map< std::string, std::string > getProperties() const
unsigned int getRefCnt() const
Definition: RefCounter.hxx:32
Catalog * getBuiltinCatalog()
Get the catalog of base nodes (elementary and composed)
Definition: Runtime.cxx:314
Class for Salome component Service Node.
Definition: CORBANode.hxx:68
Class for calculation node associated with a component service.
Definition: ServiceNode.hxx:35
virtual ComponentInstance * getComponent()
Return the associated component instance.
Control node that emulates the C switch.
Definition: Switch.hxx:85
InputPort * edGetConditionPort()
Definition: Switch.hxx:115
int getRankOfNode(Node *node) const
Definition: Switch.cxx:752
Base class for all type objects.
Definition: TypeCode.hxx:68
virtual const char * name() const
Definition: TypeCode.cxx:72
virtual TypeCode * clone() const
Definition: TypeCode.cxx:52
Class for a while loop.
Definition: WhileLoop.hxx:39
InputPort * edGetConditionPort()
Definition: WhileLoop.hxx:48
const char * what(void) const noexcept
Definition: Exception.cxx:50
SubjectContainerBase * getSubjectContainer()
SubjectInputDataStreamPort * getSubjectIDSPort()
YACS::HMI::SubjectNode * getSubjectNode()
SubjectOutputDataStreamPort * getSubjectODSPort()
virtual bool execute()
the command is executed a first time after its registration for undo redo, then on redo
Definition: commands.cxx:51
YACS::HMI::SubjectProc * getSubjectProc()
Definition: guiContext.hxx:52
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
std::string _lastErrorMessage
Definition: guiContext.hxx:79
std::map< std::pair< YACS::ENGINE::OutPort *, YACS::ENGINE::InPort * >, YACS::HMI::SubjectLink * > _mapOfSubjectLink
Definition: guiContext.hxx:72
std::map< YACS::ENGINE::Container *, YACS::HMI::SubjectContainerBase * > _mapOfSubjectContainer
Definition: guiContext.hxx:75
std::map< std::string, YACS::ENGINE::ComponentInstance * > _mapOfLastComponentInstance
Definition: guiContext.hxx:78
std::map< YACS::ENGINE::DataPort *, YACS::HMI::SubjectDataPort * > _mapOfSubjectDataPort
Definition: guiContext.hxx:71
std::map< std::pair< YACS::ENGINE::Node *, YACS::ENGINE::Node * >, YACS::HMI::SubjectControlLink * > _mapOfSubjectControlLink
Definition: guiContext.hxx:73
std::map< int, YACS::HMI::SubjectNode * > _mapOfExecSubjectNode
Definition: guiContext.hxx:77
YACS::HMI::ProcInvoc * getInvoc()
Definition: guiContext.hxx:51
YACS::ENGINE::Catalog * getCurrentCatalog()
Definition: guiContext.hxx:48
std::map< YACS::ENGINE::ComponentInstance *, YACS::HMI::SubjectComponent * > _mapOfSubjectComponent
Definition: guiContext.hxx:74
std::map< YACS::ENGINE::Node *, YACS::HMI::SubjectNode * > _mapOfSubjectNode
Definition: guiContext.hxx:68
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
std::map< std::string, YACS::HMI::SubjectDataType * > _mapOfSubjectDataType
Definition: guiContext.hxx:76
virtual void select(bool isSelected)
virtual void decrementSubjects(Subject *subject)
static std::map< int, std::string > _eventNameMap
std::set< Subject * > _subjectSet
virtual void update(GuiEvent event, int type, Subject *son)
virtual void incrementSubjects(Subject *subject)
static void setEventMap()
static std::string eventName(GuiEvent event)
void add(Command *command)
Definition: commands.cxx:156
YACS::ENGINE::Catalog * getUndoCata()
Definition: commands.hxx:67
YACS::ENGINE::Proc * getUndoProc()
Definition: commands.hxx:66
static TypeOfElem getTypeOfNode(YACS::ENGINE::Node *node)
virtual void clean(Command *command=0)
virtual void removeNode(SubjectNode *child)
virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
virtual void completeChildrenSubjectList(SubjectNode *son)
void localclean(Command *command=0)
virtual SubjectNode * addNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
std::set< SubjectNode * > _children
SubjectBloc(YACS::ENGINE::Bloc *bloc, Subject *parent)
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)
virtual SubjectNode * getChild(YACS::ENGINE::Node *node=0) const
SubjectCORBANode(YACS::ENGINE::CORBANode *corbaNode, Subject *parent)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
std::map< SubjectServiceNode *, SubjectReference * > _subReferenceMap
virtual TypeOfElem getType()
virtual void clean(Command *command=0)
virtual std::map< std::string, std::string > getProperties()
YACS::ENGINE::ComponentInstance * getComponent() const
YACS::ENGINE::ComponentInstance * _compoInst
virtual bool setProperties(std::map< std::string, std::string > properties)
virtual std::pair< std::string, int > getKey()
virtual void removeSubServiceFromSet(SubjectServiceNode *service)
std::set< SubjectServiceNode * > _subServiceSet
virtual SubjectReference * attachService(SubjectServiceNode *service)
SubjectReference * _subRefContainer
virtual void notifyServicesChange(GuiEvent event, int type, Subject *son)
virtual std::string getName()
virtual bool associateToContainer(SubjectContainerBase *subcont)
SubjectComponent(YACS::ENGINE::ComponentInstance *component, Subject *parent)
void localclean(Command *command=0)
virtual void detachService(SubjectServiceNode *service)
virtual void moveService(SubjectReference *reference)
virtual void removeExternalControlLinks()
virtual SubjectNode * addNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
SubjectControlLink * addSubjectControlLink(SubjectNode *sno, SubjectNode *sni)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
SubjectComposedNode(YACS::ENGINE::ComposedNode *composedNode, Subject *parent)
virtual void removeControlLink(SubjectControlLink *link)
virtual std::string getValue()
SubjectNode * addSubjectNode(YACS::ENGINE::Node *node, std::string name="", YACS::ENGINE::Catalog *catalog=0, std::string compo="", std::string type="")
virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
virtual void removeLink(SubjectLink *link)
SubjectLink * addSubjectLink(SubjectNode *sno, SubjectDataPort *spo, SubjectNode *sni, SubjectDataPort *spi)
static SubjectComposedNode * getLowestCommonAncestor(SubjectNode *snode1, SubjectNode *snode2)
Retrieves the lowest common ancestor of 2 nodes.
virtual SubjectNode * createNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst, int swCase=0)
virtual void completeChildrenSubjectList(SubjectNode *son)
YACS::ENGINE::ComposedNode * _composedNode
static SubjectContainerBase * New(YACS::ENGINE::Container *container, Subject *parent)
virtual bool setProperties(std::map< std::string, std::string > properties)
virtual void removeSubComponentFromSet(SubjectComponent *component)
virtual void notifyComponentsChange(GuiEvent event, int type, Subject *son)
void localclean(Command *command=0)
virtual YACS::ENGINE::Container * getContainer() const
virtual std::map< std::string, std::string > getProperties()
virtual bool setName(std::string name)
std::map< SubjectComponent *, SubjectReference * > _subReferenceMap
virtual void moveComponent(SubjectReference *reference)
virtual void clean(Command *command=0)
std::set< SubjectComponent * > _subComponentSet
virtual std::string getName()
virtual SubjectReference * attachComponent(SubjectComponent *component)
YACS::ENGINE::Container * _container
virtual void detachComponent(SubjectComponent *component)
SubjectContainerBase(YACS::ENGINE::Container *container, Subject *parent)
SubjectContainer(YACS::ENGINE::Container *container, Subject *parent)
SubjectCppNode(YACS::ENGINE::CppNode *cppNode, Subject *parent)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
SubjectDataNode(YACS::ENGINE::DataNode *dataNode, Subject *parent)
void localclean(Command *command=0)
void addSubjectLink(SubjectLink *subject)
std::list< SubjectLink * > _listSubjectLink
void setExecValue(std::string value)
static bool tryCreateLink(SubjectDataPort *subOutport, SubjectDataPort *subInport, bool control=true)
virtual bool setName(std::string name)
virtual void clean(Command *command=0)
void removeSubjectLink(SubjectLink *subject)
SubjectDataPort(YACS::ENGINE::DataPort *port, Subject *parent)
YACS::ENGINE::DataPort * _dataPort
std::list< SubjectLink * > getListOfSubjectLink()
virtual bool setValue(std::string value)
virtual std::string getName()
virtual YACS::ENGINE::DataPort * getPort()
virtual YACS::ENGINE::TypeCode * getTypeCode()
YACS::ENGINE::TypeCode * _typeCode
void localclean(Command *command=0)
SubjectDataType(YACS::ENGINE::TypeCode *typeCode, Subject *parent, std::string alias)
virtual std::string getAlias()
virtual std::string getName()
virtual void clean(Command *command=0)
virtual void clean(Command *command=NULL)
virtual SubjectNode * addNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
virtual SubjectNode * getChild(YACS::ENGINE::Node *node=NULL) const
YACS::ENGINE::DynParaLoop * _dynParaLoop
virtual std::string getValue()
virtual void removeNode(SubjectNode *child)
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)
virtual bool setNbBranches(std::string nbBranches)
void localclean(Command *command=NULL)
SubjectDynParaLoop(YACS::ENGINE::DynParaLoop *dynParaLoop, Subject *parent)
virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
virtual void completeChildrenSubjectList(SubjectNode *son)
virtual bool OrderDataPorts(SubjectDataPort *portToMove, int isUp)
SubjectElementaryNode(YACS::ENGINE::ElementaryNode *elementaryNode, Subject *parent)
void localclean(Command *command=0)
virtual SubjectDataPort * addInputPort(YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
virtual void clean(Command *command=0)
virtual SubjectDataPort * addIDSPort(YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
virtual void removePort(SubjectDataPort *port)
virtual SubjectDataPort * addODSPort(YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
YACS::ENGINE::ElementaryNode * _elementaryNode
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)
virtual SubjectDataPort * addOutputPort(YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
SubjectForEachLoop(YACS::ENGINE::ForEachLoopGen *forEachLoop, Subject *parent)
YACS::ENGINE::ForEachLoopGen * _forEachLoop
virtual void removeNode(SubjectNode *child)
virtual void completeChildrenSubjectList(SubjectNode *son)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
virtual SubjectNode * addNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
YACS::ENGINE::ForLoop * _forLoop
SubjectForLoop(YACS::ENGINE::ForLoop *forLoop, Subject *parent)
virtual void clean(Command *command=0)
virtual std::string getValue()
virtual void completeChildrenSubjectList(SubjectNode *son)
virtual bool setNbSteps(std::string nbSteps)
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)
void localclean(Command *command=0)
YACS::ENGINE::Container * getContainer() const
SubjectHPContainer(YACS::ENGINE::HomogeneousPoolContainer *container, Subject *parent)
virtual bool setScript(std::string script)
SubjectInlineNode(YACS::ENGINE::InlineNode *inlineNode, Subject *parent)
void localclean(Command *command=0)
YACS::ENGINE::InlineNode * _inlineNode
virtual std::string getScript()
virtual bool setExecutionMode(const std::string &mode)
virtual void clean(Command *command=0)
virtual bool setContainer(SubjectContainerBase *scont)
virtual void clean(Command *command=0)
YACS::ENGINE::InputDataStreamPort * _inputDataStreamPort
void localclean(Command *command=0)
virtual std::map< std::string, std::string > getProperties()
SubjectInputDataStreamPort(YACS::ENGINE::InputDataStreamPort *port, Subject *parent)
virtual std::vector< std::string > knownProperties()
virtual bool setProperties(std::map< std::string, std::string > properties)
SubjectInputPort(YACS::ENGINE::InputPort *port, Subject *parent)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
virtual bool setValue(std::string value)
YACS::ENGINE::InputPort * _inputPort
std::list< YACS::ENGINE::OutGate * > loutgate
virtual void removeExternalControlLinks()
void removeSubjectControlLink(SubjectControlLink *sub)
std::list< SubjectOutputPort * > _listSubjectOutputPort
virtual std::string getName()
virtual SubjectInputDataStreamPort * addSubjectIDSPort(YACS::ENGINE::InputDataStreamPort *port, std::string name="")
YACS::ENGINE::Node * _node
virtual bool reparent(Subject *parent)
virtual bool setProperties(std::map< std::string, std::string > properties)
friend class CommandAddIDSPortFromCatalog
virtual SubjectOutputPort * addSubjectOutputPort(YACS::ENGINE::OutputPort *port, std::string name="")
virtual bool setName(std::string name)
virtual void update(GuiEvent event, int type, Subject *son)
std::vector< std::pair< YACS::ENGINE::OutPort *, YACS::ENGINE::InPort * > > dataLinks
virtual void notifyObserver(YACS::ENGINE::Node *object, const std::string &event)
std::list< SubjectLink * > _listSubjectLink
SubjectControlLink * addSubjectControlLink(SubjectControlLink *sub)
virtual void restoreLinks()
std::vector< std::pair< YACS::ENGINE::OutPort *, YACS::ENGINE::InPort * > > dataflowLinks
void setExecState(int execState)
virtual bool copy(Subject *parent)
std::list< SubjectInputPort * > _listSubjectInputPort
std::list< SubjectControlLink * > getSubjectControlLinks() const
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)
virtual YACS::ENGINE::Node * getNode()
virtual bool putInComposedNode(std::string name, std::string type, bool toSaveRestoreLinks=true)
void localclean(Command *command=0)
friend class CommandAddInputPortFromCatalog
std::list< SubjectOutputDataStreamPort * > _listSubjectODSPort
virtual void clean(Command *command=0)
virtual SubjectInputPort * addSubjectInputPort(YACS::ENGINE::InputPort *port, std::string name="")
static bool tryCreateLink(SubjectNode *subOutNode, SubjectNode *subInNode)
std::list< SubjectInputDataStreamPort * > _listSubjectIDSPort
SubjectNode(YACS::ENGINE::Node *node, Subject *parent)
virtual std::map< std::string, std::string > getProperties()
std::list< SubjectControlLink * > _listSubjectControlLink
friend class CommandAddODSPortFromCatalog
virtual void removeExternalLinks()
virtual void saveLinks()
virtual SubjectOutputDataStreamPort * addSubjectODSPort(YACS::ENGINE::OutputDataStreamPort *port, std::string name="")
friend class CommandAddOutputPortFromCatalog
std::list< YACS::ENGINE::InGate * > singate
virtual void select(bool isSelected)
virtual void update(GuiEvent event, int type, Subject *son)
SubjectOptimizerLoop(YACS::ENGINE::OptimizerLoop *optimizerLoop, Subject *parent)
virtual bool setAlgorithm(const std::string &alglib, const std::string &symbol)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
SubjectOutNode(YACS::ENGINE::OutNode *outNode, Subject *parent)
virtual bool setProperties(std::map< std::string, std::string > properties)
YACS::ENGINE::OutputDataStreamPort * _outputDataStreamPort
virtual std::map< std::string, std::string > getProperties()
SubjectOutputDataStreamPort(YACS::ENGINE::OutputDataStreamPort *port, Subject *parent)
virtual void clean(Command *command=0)
YACS::ENGINE::OutputPort * _outputPort
virtual void clean(Command *command=0)
void localclean(Command *command=0)
virtual bool setValue(std::string value)
SubjectOutputPort(YACS::ENGINE::OutputPort *port, Subject *parent)
SubjectPresetNode(YACS::ENGINE::PresetNode *presetNode, Subject *parent)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
std::vector< Subject * > _postEraseList
YACS::ENGINE::Proc * _proc
SubjectProc(YACS::ENGINE::Proc *proc, Subject *parent)
virtual SubjectContainerBase * addHPContainer(std::string name, std::string ref="")
SubjectContainerBase * addSubjectContainer(YACS::ENGINE::Container *cont, std::string name="")
virtual SubjectComponent * addComponent(std::string compoName, std::string containerName="")
virtual bool addDataType(YACS::ENGINE::Catalog *catalog, std::string typeName)
virtual void clean(Command *command=0)
virtual SubjectContainerBase * addContainer(std::string name, std::string ref="")
void addPostErase(Subject *sub)
SubjectDataType * addSubjectDataType(YACS::ENGINE::TypeCode *type, std::string alias)
void loadTypes()
Load types for a SubjectProc.
SubjectDataType * addComSubjectDataType(YACS::ENGINE::TypeCode *type, std::string alias)
void localclean(Command *command=0)
void removeSubjectContainer(SubjectContainerBase *scont)
SubjectComponent * addSubjectComponent(YACS::ENGINE::ComponentInstance *compo)
void removeSubjectDataType(std::string typeName)
SubjectPyFuncNode(YACS::ENGINE::PyFuncNode *pyFuncNode, Subject *parent)
virtual bool setFunctionName(std::string funcName)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
SubjectPythonNode(YACS::ENGINE::PythonNode *pythonNode, Subject *parent)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
SubjectReference(Subject *ref, Subject *parent)
void localclean(Command *command=0)
virtual void reparent(Subject *parent)
virtual Subject * getReference() const
virtual std::string getName()
SubjectSalomeNode(YACS::ENGINE::SalomeNode *salomeNode, Subject *parent)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
SubjectSalomePythonNode(YACS::ENGINE::SalomePythonNode *salomePythonNode, Subject *parent)
SubjectReference * _subjectReference
void localclean(Command *command=0)
virtual void clean(Command *command=0)
SubjectReference * _subRefComponent
virtual SubjectReference * getSubjectReference()
virtual void setComponentFromCatalog(YACS::ENGINE::Catalog *catalog, std::string compo, std::string service)
friend class CommandAddComponentFromCatalog
YACS::ENGINE::ServiceNode * _serviceNode
virtual void removeSubRefComponent()
friend class CommandAssociateServiceToComponent
virtual bool associateToComponent(SubjectComponent *subcomp)
virtual void addSubjectReference(Subject *ref)
SubjectServiceNode(YACS::ENGINE::ServiceNode *serviceNode, Subject *parent)
virtual std::string getName()
void localclean(Command *command=0)
SubjectSplitterNode(YACS::ENGINE::SplitterNode *splitterNode, Subject *parent)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
SubjectStudyInNode(YACS::ENGINE::StudyInNode *studyInNode, Subject *parent)
virtual void clean(Command *command=0)
SubjectStudyOutNode(YACS::ENGINE::StudyOutNode *studyOutNode, Subject *parent)
void localclean(Command *command=0)
virtual void clean(Command *command=0)
virtual std::string getValue()
virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
virtual void removeNode(SubjectNode *son)
virtual SubjectNode * getChild(YACS::ENGINE::Node *node=0) const
virtual SubjectNode * addNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst, int swCase, bool replace=false)
YACS::ENGINE::Switch * _switch
virtual bool setSelect(std::string select)
std::map< int, SubjectNode * > getBodyMap()
virtual void completeChildrenSubjectList(SubjectNode *son)
virtual bool setCase(std::string caseId, SubjectNode *snode)
std::map< int, SubjectNode * > _bodyMap
virtual void clean(Command *command=0)
void localclean(Command *command=0)
SubjectSwitch(YACS::ENGINE::Switch *aSwitch, Subject *parent)
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)
virtual std::string getValue()
virtual void completeChildrenSubjectList(SubjectNode *son)
virtual bool setCondition(std::string condition)
SubjectWhileLoop(YACS::ENGINE::WhileLoop *whileLoop, Subject *parent)
virtual void clean(Command *command=0)
YACS::ENGINE::WhileLoop * _whileLoop
virtual SubjectNode * addNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)
virtual void houseKeepingAfterCutPaste(bool isCut, SubjectNode *son)
void localclean(Command *command=0)
SubjectXmlNode(YACS::ENGINE::XmlNode *xmlNode, Subject *parent)
virtual void clean(Command *command=0)
void localclean(Command *command=0)
std::string _progress
virtual void clean(Command *command=0)
virtual void loadLinks()
virtual void update(GuiEvent event, int type, Subject *son)
static void erase(Subject *sub, Command *command=0, bool post=false)
virtual bool setName(std::string name)
virtual Subject * getParent()
virtual bool setProperties(std::map< std::string, std::string > properties)
virtual void setProgress(std::string newProgress)
virtual std::string getName()
void localclean(Command *command=0)
virtual void loadChildren()
virtual std::vector< std::string > knownProperties()
virtual bool destroy(Subject *son)
From user action in Ihm, destroy an object.
virtual void setParent(Subject *son)
friend class CommandReparentNode
std::set< GuiObserver * > _setObs
virtual TypeOfElem getType()
virtual void attach(GuiObserver *obs)
virtual void addSubjectReference(Subject *ref)
virtual void detach(GuiObserver *obs)
virtual void select(bool isSelected)
virtual std::map< std::string, std::string > getProperties()
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()
@ OUTPUTDATASTREAMPORT
@ INPUTDATASTREAMPORT
@ UNDEFINED
Definition: define.hxx:35
def ref(target, callback=None)
Definition: CONNECTOR.py:120