Version: 8.3.0
YACS::HMI::SubjectComposedNode Class Reference

#include <guiObservers.hxx>

Inheritance diagram for YACS::HMI::SubjectComposedNode:
Collaboration diagram for YACS::HMI::SubjectComposedNode:

Public Member Functions

 SubjectComposedNode (YACS::ENGINE::ComposedNode *composedNode, Subject *parent)
 
virtual ~SubjectComposedNode ()
 
virtual SubjectNodeaddNode (YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
 
virtual SubjectNodegetChild (YACS::ENGINE::Node *node=0) const
 
virtual void loadChildren ()
 
virtual void loadLinks ()
 
virtual void completeChildrenSubjectList (SubjectNode *son)
 
SubjectNodeaddSubjectNode (YACS::ENGINE::Node *node, std::string name="", YACS::ENGINE::Catalog *catalog=0, std::string compo="", std::string type="")
 
SubjectLinkaddSubjectLink (SubjectNode *sno, SubjectDataPort *spo, SubjectNode *sni, SubjectDataPort *spi)
 
SubjectControlLinkaddSubjectControlLink (SubjectNode *sno, SubjectNode *sni)
 
virtual void removeLink (SubjectLink *link)
 
virtual void removeControlLink (SubjectControlLink *link)
 
virtual void removeExternalControlLinks ()
 
virtual void houseKeepingAfterCutPaste (bool isCut, SubjectNode *son)
 
virtual bool hasValue ()
 
virtual std::string getValue ()
 
virtual void clean (Command *command=0)
 
void localclean (Command *command=0)
 
- Public Member Functions inherited from YACS::HMI::SubjectNode
 SubjectNode (YACS::ENGINE::Node *node, Subject *parent)
 
virtual ~SubjectNode ()
 
virtual bool setProperties (std::map< std::string, std::string > properties)
 
virtual std::map< std::string,
std::string > 
getProperties ()
 
virtual bool reparent (Subject *parent)
 
virtual bool copy (Subject *parent)
 
virtual std::string getName ()
 
virtual bool setName (std::string name)
 
virtual YACS::ENGINE::NodegetNode ()
 
void registerUndoDestroy ()
 
SubjectControlLinkaddSubjectControlLink (SubjectControlLink *sub)
 
void removeSubjectControlLink (SubjectControlLink *sub)
 
std::list< SubjectLink * > getSubjectLinks () const
 
std::list< SubjectControlLink * > getSubjectControlLinks () const
 
std::list< SubjectInputPort * > getSubjectInputPorts () const
 
std::list< SubjectOutputPort * > getSubjectOutputPorts () const
 
std::list
< SubjectInputDataStreamPort * > 
getSubjectInputDataStreamPorts () const
 
std::list
< SubjectOutputDataStreamPort * > 
getSubjectOutputDataStreamPorts () const
 
void localclean (Command *command=0)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual void recursiveUpdate (GuiEvent event, int type, Subject *son)
 
virtual void removeExternalLinks ()
 
virtual void saveLinks ()
 
virtual void restoreLinks ()
 
virtual bool putInComposedNode (std::string name, std::string type, bool toSaveRestoreLinks=true)
 
virtual int isValid ()
 
void setExecState (int execState)
 
- Public Member Functions inherited from YACS::HMI::Subject
 Subject (Subject *parent=0)
 
virtual ~Subject ()
 
virtual void attach (GuiObserver *obs)
 
virtual void detach (GuiObserver *obs)
 
virtual void select (bool isSelected)
 
virtual std::vector< std::string > knownProperties ()
 
virtual SubjectgetParent ()
 
virtual void setParent (Subject *son)
 
virtual bool destroy (Subject *son)
 From user action in Ihm, destroy an object. More...
 
virtual void addSubjectReference (Subject *ref)
 
void localclean (Command *command=0)
 
void registerUndoDestroy ()
 
void askRegisterUndoDestroy ()
 
bool isDestructible ()
 
virtual TypeOfElem getType ()
 
virtual void setProgress (std::string newProgress)
 
virtual std::string getProgress ()
 
- Public Member Functions inherited from YACS::ENGINE::Observer
virtual void notifyObserver2 (Node *object, const std::string &event, void *something)
 
virtual ~Observer ()
 

Static Public Member Functions

static SubjectComposedNodegetLowestCommonAncestor (SubjectNode *snode1, SubjectNode *snode2)
 Retrieves the lowest common ancestor of 2 nodes. More...
 
- Static Public Member Functions inherited from YACS::HMI::SubjectNode
static bool tryCreateLink (SubjectNode *subOutNode, SubjectNode *subInNode)
 
- Static Public Member Functions inherited from YACS::HMI::Subject
static void erase (Subject *sub, Command *command=0, bool post=false)
 

Protected Member Functions

virtual SubjectNodecreateNode (YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst, int swCase=0)
 
- Protected Member Functions inherited from YACS::HMI::SubjectNode
virtual SubjectInputPortaddSubjectInputPort (YACS::ENGINE::InputPort *port, std::string name="")
 
virtual SubjectOutputPortaddSubjectOutputPort (YACS::ENGINE::OutputPort *port, std::string name="")
 
virtual
SubjectInputDataStreamPort
addSubjectIDSPort (YACS::ENGINE::InputDataStreamPort *port, std::string name="")
 
virtual
SubjectOutputDataStreamPort
addSubjectODSPort (YACS::ENGINE::OutputDataStreamPort *port, std::string name="")
 
virtual void notifyObserver (YACS::ENGINE::Node *object, const std::string &event)
 

Protected Attributes

YACS::ENGINE::ComposedNode_composedNode
 
- Protected Attributes inherited from YACS::HMI::SubjectNode
YACS::ENGINE::Node_node
 
std::list< SubjectInputPort * > _listSubjectInputPort
 
std::list< SubjectOutputPort * > _listSubjectOutputPort
 
std::list
< SubjectInputDataStreamPort * > 
_listSubjectIDSPort
 
std::list
< SubjectOutputDataStreamPort * > 
_listSubjectODSPort
 
std::list< SubjectLink * > _listSubjectLink
 
std::list< SubjectControlLink * > _listSubjectControlLink
 
int _execState
 
std::list
< YACS::ENGINE::OutGate * > 
loutgate
 
std::list< YACS::ENGINE::InGate * > singate
 
std::vector< std::pair
< YACS::ENGINE::OutPort
*, YACS::ENGINE::InPort * > > 
dataLinks
 
std::vector< std::pair
< YACS::ENGINE::OutPort
*, YACS::ENGINE::InPort * > > 
dataflowLinks
 
- Protected Attributes inherited from YACS::HMI::Subject
std::set< GuiObserver * > _setObs
 
Subject_parent
 
bool _destructible
 
bool _askRegisterUndo
 
std::string _progress
 

Detailed Description

Definition at line 347 of file guiObservers.hxx.

Constructor & Destructor Documentation

SubjectComposedNode::SubjectComposedNode ( YACS::ENGINE::ComposedNode composedNode,
Subject parent 
)

Definition at line 1316 of file guiObservers.cxx.

1318  : SubjectNode(composedNode, parent), _composedNode(composedNode)
1319 {
1320 }
SubjectComposedNode::~SubjectComposedNode ( )
virtual

all generic destruction is done in generic class SubjectNode

Definition at line 1325 of file guiObservers.cxx.

References DEBTRACE, and YACS::HMI::SubjectNode::getName().

1326 {
1327  DEBTRACE("SubjectComposedNode::~SubjectComposedNode " << getName());
1328 }

Member Function Documentation

SubjectNode * SubjectComposedNode::addNode ( YACS::ENGINE::Catalog catalog,
std::string  compo,
std::string  type,
std::string  name,
bool  newCompoInst 
)
virtual

Reimplemented in YACS::HMI::SubjectDynParaLoop, YACS::HMI::SubjectWhileLoop, YACS::HMI::SubjectForLoop, and YACS::HMI::SubjectBloc.

Definition at line 1346 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, DEBTRACE, and YACS::HMI::GuiContext::getCurrent().

Referenced by YACS::HMI::GuiEditor::_createNode(), and gui.GraphViewer.GraphViewer::popup().

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 }
SubjectControlLink * SubjectComposedNode::addSubjectControlLink ( SubjectNode sno,
SubjectNode sni 
)

Definition at line 1551 of file guiObservers.cxx.

References YACS::HMI::SubjectNode::_listSubjectControlLink, YACS::HMI::GuiContext::_mapOfSubjectControlLink, YACS::HMI::ADDCONTROLLINK, YACS::HMI::SubjectNode::addSubjectControlLink(), YACS::HMI::CONTROLLINK, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::SubjectNode::getName(), YACS::HMI::SubjectControlLink::getName(), YACS::HMI::SubjectNode::getNode(), and YACS::HMI::SubjectNode::update().

Referenced by loadLinks(), YACS::HMI::CommandAddLink::localExecute(), YACS::HMI::CommandAddControlLink::localExecute(), and YACS::HMI::SubjectNode::restoreLinks().

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 }
SubjectLink * SubjectComposedNode::addSubjectLink ( SubjectNode sno,
SubjectDataPort spo,
SubjectNode sni,
SubjectDataPort spi 
)

Definition at line 1508 of file guiObservers.cxx.

References YACS::HMI::SubjectNode::_listSubjectLink, YACS::HMI::GuiContext::_mapOfSubjectLink, YACS::HMI::ADDLINK, YACS::HMI::SubjectDataPort::addSubjectLink(), YACS::HMI::DATALINK, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::SubjectNode::getName(), YACS::HMI::SubjectLink::getName(), YACS::HMI::SubjectDataPort::getPort(), YACS::HMI::UPDATE, YACS::HMI::Subject::update(), and YACS::HMI::SubjectNode::update().

Referenced by loadLinks(), YACS::HMI::CommandAddLink::localExecute(), and YACS::HMI::SubjectNode::restoreLinks().

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 }
SubjectNode * SubjectComposedNode::addSubjectNode ( YACS::ENGINE::Node node,
std::string  name = "",
YACS::ENGINE::Catalog catalog = 0,
std::string  compo = "",
std::string  type = "" 
)

Definition at line 1385 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfExecSubjectNode, YACS::HMI::GuiContext::_mapOfSubjectNode, YACS::HMI::ADD, YACS::HMI::BLOC, completeChildrenSubjectList(), YACS::HMI::CORBANODE, YACS::HMI::CPPNODE, DEBTRACE, YACS::HMI::FOREACHLOOP, YACS::HMI::FORLOOP, YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::getNumId(), YACS::HMI::ProcInvoc::getTypeOfNode(), YACS::HMI::OPTIMIZERLOOP, YACS::HMI::OUTNODE, YACS::HMI::PRESETNODE, YACS::HMI::PYFUNCNODE, YACS::HMI::PYTHONNODE, YACS::HMI::SALOMENODE, YACS::HMI::SALOMEPYTHONNODE, YACS::HMI::SubjectNode::setName(), YACS::HMI::SPLITTERNODE, YACS::HMI::STUDYINNODE, YACS::HMI::STUDYOUTNODE, YACS::HMI::SWITCH, YACS::HMI::SubjectNode::update(), YACS::HMI::WHILELOOP, YACS::HMI::XMLNODE, and YASSERT.

Referenced by loadChildren(), YACS::HMI::CommandAddNodeFromCatalog::localExecute(), YACS::HMI::CommandPutInComposedNode::localExecute(), and YACS::HMI::CommandCopyNode::localExecute().

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::ForEachLoop*>(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 }
void SubjectComposedNode::clean ( Command command = 0)
virtual
void SubjectComposedNode::completeChildrenSubjectList ( SubjectNode son)
virtual
SubjectNode * SubjectComposedNode::createNode ( YACS::ENGINE::Catalog catalog,
std::string  compo,
std::string  type,
std::string  name,
bool  newCompoInst,
int  swCase = 0 
)
protectedvirtual

Definition at line 1358 of file guiObservers.cxx.

References YACS::HMI::SubjectNode::_node, YACS::HMI::Invocator::add(), YACS::HMI::Command::execute(), YACS::ENGINE::ComposedNode::getChildName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), YACS::HMI::CommandAddNodeFromCatalog::getNode(), YACS::HMI::GuiContext::getProc(), and YACS::HMI::CommandAddNodeFromCatalog::getSubjectNode().

Referenced by YACS::HMI::SubjectBloc::addNode(), YACS::HMI::SubjectForLoop::addNode(), YACS::HMI::SubjectWhileLoop::addNode(), YACS::HMI::SubjectSwitch::addNode(), and YACS::HMI::SubjectDynParaLoop::addNode().

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 }
virtual SubjectNode* YACS::HMI::SubjectComposedNode::getChild ( YACS::ENGINE::Node node = 0) const
inlinevirtual
SubjectComposedNode * SubjectComposedNode::getLowestCommonAncestor ( SubjectNode snode1,
SubjectNode snode2 
)
static

Retrieves the lowest common ancestor of 2 nodes.

Note
Retrieves the lowest common ancestor of 'node1' AND 'node2'. If 'node1' or 'node2' are both or indiscriminately instances of ComposedNode and that 'node1' is in descendance of 'node2' (resp. 'node2' in descendance of 'node1') 'node2' is returned (resp. 'node1').
Exceptions
Exception: if 'node1' and 'node2' do not share the same genealogy.
Returns
The lowest common ancestor if it exists.

Definition at line 1681 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectNode, YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Node::getFather(), and YACS::HMI::SubjectNode::getNode().

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 }
std::string SubjectComposedNode::getValue ( )
virtual
bool SubjectComposedNode::hasValue ( )
virtual

used in derived classes using a counter, a selector, or a condition: ForLoop, ForEachLoop, Switch, WhileLoop.

Reimplemented in YACS::HMI::SubjectDynParaLoop, YACS::HMI::SubjectSwitch, YACS::HMI::SubjectWhileLoop, and YACS::HMI::SubjectForLoop.

Definition at line 1694 of file guiObservers.cxx.

Referenced by YACS::HMI::SchemaComposedNodeItem::SchemaComposedNodeItem(), and YACS::HMI::SchemaComposedNodeItem::update().

1695 {
1696  return false;
1697 }
void SubjectComposedNode::loadChildren ( )
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 1475 of file guiObservers.cxx.

References _composedNode, YACS::HMI::SubjectNode::addSubjectInputPort(), addSubjectNode(), YACS::HMI::SubjectNode::addSubjectOutputPort(), YACS::ENGINE::ComposedNode::edGetDirectDescendants(), YACS::ENGINE::Node::getChildByName(), YACS::ENGINE::ComposedNode::getLocalInputPorts(), YACS::ENGINE::ComposedNode::getLocalOutputPorts(), YACS::ENGINE::ComposedNode::getSetOfInputDataStreamPort(), YACS::ENGINE::ComposedNode::getSetOfOutputDataStreamPort(), and YACS::HMI::Subject::loadChildren().

Referenced by YACS::HMI::SubjectProc::loadProc().

1476 {
1477  list<Node *> setOfNode= _composedNode->edGetDirectDescendants();
1478  if (ForEachLoop *feloop = dynamic_cast<ForEachLoop*>(_composedNode))
1479  {
1480  Node *node2Insert=feloop->getChildByName(ForEachLoop::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 }
void SubjectComposedNode::loadLinks ( )
virtual

loadLinks is used when an existing scheme has been loaded in memory, to create gui representation. Gui representation of links is done after node representation (loadChildren). Proc is explored recursively to find the composedNodes and create the corresponding links representation, from bottom to top. For each composedNode, data links representation are created first and stored in a map to avoid double representation. Then control links representation are created.

Reimplemented from YACS::HMI::Subject.

Definition at line 1619 of file guiObservers.cxx.

References _composedNode, YACS::HMI::GuiContext::_mapOfSubjectDataPort, YACS::HMI::GuiContext::_mapOfSubjectLink, YACS::HMI::GuiContext::_mapOfSubjectNode, addSubjectControlLink(), addSubjectLink(), DEBTRACE, YACS::ENGINE::ComposedNode::edGetDirectDescendants(), YACS::ENGINE::OutGate::edSetInGate(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Port::getNode(), YACS::ENGINE::ComposedNode::getSetOfInternalLinks(), loadLinks(), and YASSERT.

Referenced by loadLinks(), and YACS::HMI::SubjectProc::loadProc().

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 }
void SubjectComposedNode::localclean ( Command command = 0)

Definition at line 1341 of file guiObservers.cxx.

References DEBTRACE.

Referenced by clean().

1342 {
1343  DEBTRACE("SubjectComposedNode::localClean ");
1344 }
void SubjectComposedNode::removeControlLink ( SubjectControlLink link)
virtual

Definition at line 1571 of file guiObservers.cxx.

References YACS::HMI::SubjectNode::_listSubjectControlLink, YACS::HMI::GuiContext::_mapOfSubjectControlLink, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Node::getName(), YACS::HMI::SubjectNode::getName(), YACS::HMI::SubjectNode::getNode(), YACS::HMI::SubjectControlLink::getSubjectInNode(), YACS::HMI::SubjectControlLink::getSubjectOutNode(), and YACS::HMI::SubjectNode::removeSubjectControlLink().

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 }
void SubjectComposedNode::removeExternalControlLinks ( )
virtual

Reimplemented from YACS::HMI::SubjectNode.

Definition at line 1589 of file guiObservers.cxx.

References DEBTRACE, YACS::HMI::Subject::erase(), YACS::HMI::SubjectNode::getName(), YACS::HMI::SubjectNode::getNode(), YACS::HMI::SubjectNode::getSubjectControlLinks(), and YACS::ENGINE::ComposedNode::isInMyDescendance().

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 }
void SubjectComposedNode::removeLink ( SubjectLink link)
virtual

Definition at line 1533 of file guiObservers.cxx.

References YACS::HMI::SubjectNode::_listSubjectLink, YACS::HMI::GuiContext::_mapOfSubjectLink, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::DataPort::getName(), YACS::HMI::SubjectLink::getName(), YACS::HMI::SubjectDataPort::getPort(), YACS::HMI::SubjectLink::getSubjectInPort(), YACS::HMI::SubjectLink::getSubjectOutPort(), and YACS::HMI::SubjectDataPort::removeSubjectLink().

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 }

Member Data Documentation

YACS::ENGINE::ComposedNode* YACS::HMI::SubjectComposedNode::_composedNode
protected

Definition at line 388 of file guiObservers.hxx.

Referenced by loadChildren(), and loadLinks().


The documentation for this class was generated from the following files: