Version: 8.3.0
YACS::HMI::CommandAddIDSPortFromCatalog Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandAddIDSPortFromCatalog:
Collaboration diagram for YACS::HMI::CommandAddIDSPortFromCatalog:

Public Member Functions

 CommandAddIDSPortFromCatalog (YACS::ENGINE::Catalog *catalog, std::string type, std::string node, std::string name)
 
YACS::ENGINE::InputDataStreamPortgetIDSPort ()
 
SubjectInputDataStreamPortgetSubjectIDSPort ()
 
- Public Member Functions inherited from YACS::HMI::Command
 Command ()
 
virtual bool execute ()
 the command is executed a first time after its registration for undo redo, then on redo More...
 
virtual bool reverse (bool isNormal=true)
 Reverse action: undo. More...
 
virtual bool executeSubOnly ()
 execute only sub commands in a reverse action More...
 
std::string recursiveDump (int level=0)
 
void addSubCommand (Command *command)
 
bool isNormalReverse ()
 

Protected Member Functions

virtual bool localExecute ()
 
virtual bool localReverse ()
 
virtual std::string dump ()
 

Protected Attributes

YACS::ENGINE::Catalog_catalog
 
std::string _typePort
 
std::string _node
 
std::string _name
 
YACS::ENGINE::InputDataStreamPort_IDSPort
 
SubjectInputDataStreamPort_sip
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 303 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandAddIDSPortFromCatalog::CommandAddIDSPortFromCatalog ( YACS::ENGINE::Catalog catalog,
std::string  type,
std::string  node,
std::string  name 
)

Definition at line 1399 of file commandsProc.cxx.

References _IDSPort, and _sip.

1403  : Command(), _catalog(catalog), _typePort(type), _node(node), _name(name)
1404 {
1405  _IDSPort = 0;
1406  _sip = 0;
1407 }

Member Function Documentation

std::string CommandAddIDSPortFromCatalog::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 1409 of file commandsProc.cxx.

References _name, _node, _typePort, and PMMLBasicsTestLauncher::ret.

1410 {
1411  string ret ="CommandAddIDSPortFromCatalog " + _typePort + " " + _node + " " + _name;
1412  return ret;
1413 }
YACS::ENGINE::InputDataStreamPort * CommandAddIDSPortFromCatalog::getIDSPort ( )

Definition at line 1415 of file commandsProc.cxx.

References _IDSPort, and DEBTRACE.

1416 {
1417  DEBTRACE("CommandAddIDSPortFromCatalog");
1418  return _IDSPort;
1419 }
SubjectInputDataStreamPort * CommandAddIDSPortFromCatalog::getSubjectIDSPort ( )

Definition at line 1421 of file commandsProc.cxx.

References _sip.

Referenced by YACS::HMI::SubjectElementaryNode::addIDSPort().

1422 {
1423  return _sip;
1424 }
bool CommandAddIDSPortFromCatalog::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1426 of file commandsProc.cxx.

References _catalog, _IDSPort, YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectNode, _name, _node, _sip, YACS::ENGINE::Catalog::_typeMap, _typePort, DEBTRACE, YACS::ENGINE::ElementaryNode::edAddInputDataStreamPort(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::Exception::what(), and YASSERT.

1427 {
1428  DEBTRACE("CommandAddIDSPortFromCatalog::localExecute");
1429  InputDataStreamPort *son = 0;
1430  try
1431  {
1432  Proc* proc = GuiContext::getCurrent()->getProc();
1433  Node* node = proc->getChildByName(_node);
1434  ElementaryNode* father =dynamic_cast<ElementaryNode*> (node);
1435  if (father)
1436  {
1437  if (_catalog->_typeMap.count(_typePort))
1439  else
1440  {
1441  DEBTRACE(_typePort << " not found in catalog");
1442  GuiContext::getCurrent()->_lastErrorMessage = _typePort + " not found in catalog";
1443  }
1444  }
1445  _IDSPort = son;
1446  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
1448  _sip = snode->addSubjectIDSPort(son, _name);
1449  }
1450  catch (Exception& ex)
1451  {
1452  DEBTRACE("CommandAddIDSPortFromCatalog::localExecute() : " << ex.what());
1453  setErrorMsg(ex);
1454  if (son) delete son;
1455  _IDSPort = 0;
1456  }
1457  return (_IDSPort != 0);
1458 }
bool CommandAddIDSPortFromCatalog::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1460 of file commandsProc.cxx.

References _IDSPort, YACS::HMI::GuiContext::_mapOfSubjectDataPort, _name, _node, _sip, DEBTRACE, YACS::HMI::Subject::erase(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::ElementaryNode::getInputDataStreamPort(), YACS::HMI::Subject::getParent(), YACS::HMI::GuiContext::getProc(), YACS::HMI::REMOVE, YACS::HMI::Subject::select(), setErrorMsg(), YACS::HMI::Subject::update(), YACS::Exception::what(), and YASSERT.

1461 {
1462  DEBTRACE("CommandAddIDSPortFromCatalog::localReverse");
1463  try
1464  {
1465  Proc* proc = GuiContext::getCurrent()->getProc();
1466  Node *node = proc->getChildByName(_node);
1467  ElementaryNode* enode = dynamic_cast<ElementaryNode*>(node);
1468  YASSERT(enode);
1470  YASSERT(_IDSPort);
1471  YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_IDSPort));
1473  YASSERT(_sip);
1474 
1475  Subject *father=_sip->getParent();
1476  Subject::erase(_sip);
1477  _IDSPort =0;
1478  _sip = 0;
1479  if (father)
1480  {
1481  DEBTRACE("REMOVE");
1482  father->select(true);
1483  father->update(REMOVE,0,0);
1484  }
1485  return true;
1486  }
1487  catch (Exception& ex)
1488  {
1489  DEBTRACE("CommandAddIDSPortFromCatalog::localReverse(): " << ex.what());
1490  setErrorMsg(ex);
1491  return false;
1492  }
1493 }

Member Data Documentation

YACS::ENGINE::Catalog* YACS::HMI::CommandAddIDSPortFromCatalog::_catalog
protected

Definition at line 316 of file commandsProc.hxx.

Referenced by localExecute().

YACS::ENGINE::InputDataStreamPort* YACS::HMI::CommandAddIDSPortFromCatalog::_IDSPort
protected
std::string YACS::HMI::CommandAddIDSPortFromCatalog::_name
protected

Definition at line 319 of file commandsProc.hxx.

Referenced by dump(), localExecute(), and localReverse().

std::string YACS::HMI::CommandAddIDSPortFromCatalog::_node
protected

Definition at line 318 of file commandsProc.hxx.

Referenced by dump(), localExecute(), and localReverse().

SubjectInputDataStreamPort* YACS::HMI::CommandAddIDSPortFromCatalog::_sip
protected
std::string YACS::HMI::CommandAddIDSPortFromCatalog::_typePort
protected

Definition at line 317 of file commandsProc.hxx.

Referenced by dump(), and localExecute().


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