Version: 8.3.0
YACS::HMI::CommandAddODSPortFromCatalog Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandAddODSPortFromCatalog:
Collaboration diagram for YACS::HMI::CommandAddODSPortFromCatalog:

Public Member Functions

 CommandAddODSPortFromCatalog (YACS::ENGINE::Catalog *catalog, std::string type, std::string node, std::string name)
 
YACS::ENGINE::OutputDataStreamPortgetODSPort ()
 
SubjectOutputDataStreamPortgetSubjectODSPort ()
 
- 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::OutputDataStreamPort_ODSPort
 
SubjectOutputDataStreamPort_sop
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 324 of file commandsProc.hxx.

Constructor & Destructor Documentation

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

Definition at line 1497 of file commandsProc.cxx.

References _ODSPort, _sop, and DEBTRACE.

1501  : Command(), _catalog(catalog), _typePort(type), _node(node), _name(name)
1502 {
1503  DEBTRACE("CommandAddODSPortFromCatalog");
1504  _ODSPort = 0;
1505  _sop = 0;
1506 }

Member Function Documentation

std::string CommandAddODSPortFromCatalog::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 1508 of file commandsProc.cxx.

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

1509 {
1510  string ret ="CommandAddODSPortFromCatalog " + _typePort + " " + _node + " " + _name;
1511  return ret;
1512 }
YACS::ENGINE::OutputDataStreamPort * CommandAddODSPortFromCatalog::getODSPort ( )

Definition at line 1514 of file commandsProc.cxx.

References _ODSPort.

1515 {
1516  return _ODSPort;
1517 }
SubjectOutputDataStreamPort * CommandAddODSPortFromCatalog::getSubjectODSPort ( )

Definition at line 1519 of file commandsProc.cxx.

References _sop.

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

1520 {
1521  return _sop;
1522 }
bool CommandAddODSPortFromCatalog::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1524 of file commandsProc.cxx.

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

1525 {
1526  DEBTRACE("CommandAddODSPortFromCatalog::localExecute");
1527  OutputDataStreamPort *son = 0;
1528  try
1529  {
1530  Proc* proc = GuiContext::getCurrent()->getProc();
1531  Node* node = proc->getChildByName(_node);
1532  ElementaryNode* father =dynamic_cast<ElementaryNode*> (node);
1533  if (father)
1534  {
1535  if (_catalog->_typeMap.count(_typePort))
1537  else
1538  {
1539  DEBTRACE(_typePort << " not found in catalog");
1540  GuiContext::getCurrent()->_lastErrorMessage = _typePort + " not found in catalog";
1541  }
1542  }
1543  _ODSPort = son;
1544  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
1546  _sop = snode->addSubjectODSPort(son, _name);
1547  }
1548  catch (Exception& ex)
1549  {
1550  DEBTRACE("CommandAddODSPortFromCatalog::localExecute() : " << ex.what());
1551  setErrorMsg(ex);
1552  if (son) delete son;
1553  _ODSPort = 0;
1554  }
1555  return (_ODSPort != 0);
1556 }
bool CommandAddODSPortFromCatalog::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1558 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectDataPort, _name, _node, _ODSPort, _sop, DEBTRACE, YACS::HMI::Subject::erase(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::ElementaryNode::getOutputDataStreamPort(), 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.

1559 {
1560  DEBTRACE("CommandAddODSPortFromCatalog::localReverse");
1561  try
1562  {
1563  Proc* proc = GuiContext::getCurrent()->getProc();
1564  Node *node = proc->getChildByName(_node);
1565  ElementaryNode* enode = dynamic_cast<ElementaryNode*>(node);
1566  YASSERT(enode);
1568  YASSERT(_ODSPort);
1569  YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_ODSPort));
1571  YASSERT(_sop);
1572 
1573  Subject *father=_sop->getParent();
1574  Subject::erase(_sop);
1575  _sop = 0;
1576  _ODSPort = 0;
1577  if (father)
1578  {
1579  DEBTRACE("REMOVE");
1580  father->select(true);
1581  father->update(REMOVE,0,0);
1582  }
1583  return true;
1584  }
1585  catch (Exception& ex)
1586  {
1587  DEBTRACE("CommandAddODSPortFromCatalog::localReverse(): " << ex.what());
1588  setErrorMsg(ex);
1589  return false;
1590  }
1591 }

Member Data Documentation

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

Definition at line 337 of file commandsProc.hxx.

Referenced by localExecute().

std::string YACS::HMI::CommandAddODSPortFromCatalog::_name
protected

Definition at line 340 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandAddODSPortFromCatalog::_node
protected

Definition at line 339 of file commandsProc.hxx.

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

YACS::ENGINE::OutputDataStreamPort* YACS::HMI::CommandAddODSPortFromCatalog::_ODSPort
protected
SubjectOutputDataStreamPort* YACS::HMI::CommandAddODSPortFromCatalog::_sop
protected
std::string YACS::HMI::CommandAddODSPortFromCatalog::_typePort
protected

Definition at line 338 of file commandsProc.hxx.

Referenced by dump(), and localExecute().


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