Version: 9.16.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...
 
virtual std::string dump ()
 
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 ()
 
virtual bool localExecute ()=0
 
virtual bool localReverse ()=0
 

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::CommandAddODSPortFromCatalog ( YACS::ENGINE::Catalog catalog,
std::string  type,
std::string  node,
std::string  name 
)

Definition at line 1497 of file commandsProc.cxx.

1501 : Command(), _catalog(catalog), _typePort(type), _node(node), _name(name)
1502{
1503 DEBTRACE("CommandAddODSPortFromCatalog");
1504 _ODSPort = 0;
1505 _sop = 0;
1506}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
SubjectOutputDataStreamPort * _sop
YACS::ENGINE::OutputDataStreamPort * _ODSPort

References _ODSPort, _sop, and DEBTRACE.

Member Function Documentation

◆ dump()

std::string CommandAddODSPortFromCatalog::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 1508 of file commandsProc.cxx.

1509{
1510 string ret ="CommandAddODSPortFromCatalog " + _typePort + " " + _node + " " + _name;
1511 return ret;
1512}

References _name, _node, and _typePort.

◆ getODSPort()

YACS::ENGINE::OutputDataStreamPort * CommandAddODSPortFromCatalog::getODSPort ( )

Definition at line 1514 of file commandsProc.cxx.

1515{
1516 return _ODSPort;
1517}

References _ODSPort.

◆ getSubjectODSPort()

SubjectOutputDataStreamPort * CommandAddODSPortFromCatalog::getSubjectODSPort ( )

Definition at line 1519 of file commandsProc.cxx.

1520{
1521 return _sop;
1522}

References _sop.

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

◆ localExecute()

bool CommandAddODSPortFromCatalog::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1524 of file commandsProc.cxx.

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}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
std::map< std::string, TypeCode * > _typeMap
Definition: Catalog.hxx:49
Node * getChildByName(const std::string &name) const
Base class for all calculation nodes.
virtual OutputDataStreamPort * edAddOutputDataStreamPort(const std::string &outputPortDSName, TypeCode *type)
Base class for all nodes.
Definition: Node.hxx:70
Base class for all schema objects.
Definition: Proc.hxx:44
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
std::string _lastErrorMessage
Definition: guiContext.hxx:79
std::map< YACS::ENGINE::Node *, YACS::HMI::SubjectNode * > _mapOfSubjectNode
Definition: guiContext.hxx:70
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
virtual SubjectOutputDataStreamPort * addSubjectODSPort(YACS::ENGINE::OutputDataStreamPort *port, std::string name="")
void setErrorMsg(YACS::Exception &ex)

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

◆ localReverse()

bool CommandAddODSPortFromCatalog::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1558 of file commandsProc.cxx.

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);
1569 YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_ODSPort));
1571 YASSERT(_sop);
1572
1573 Subject *father=_sop->getParent();
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}
OutputDataStreamPort * getOutputDataStreamPort(const std::string &name) const
std::map< YACS::ENGINE::DataPort *, YACS::HMI::SubjectDataPort * > _mapOfSubjectDataPort
Definition: guiContext.hxx:71
virtual void update(GuiEvent event, int type, Subject *son)
static void erase(Subject *sub, Command *command=0, bool post=false)
virtual Subject * getParent()
virtual void select(bool isSelected)

References YACS::HMI::GuiContext::_mapOfSubjectDataPort, _name, _node, _ODSPort, _sop, DEBTRACE, YACS::HMI::Subject::erase(), testCppPluginInvokation::ex, 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(), and YASSERT.

Member Data Documentation

◆ _catalog

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

Definition at line 337 of file commandsProc.hxx.

Referenced by localExecute().

◆ _name

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

Definition at line 340 of file commandsProc.hxx.

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

◆ _node

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

Definition at line 339 of file commandsProc.hxx.

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

◆ _ODSPort

YACS::ENGINE::OutputDataStreamPort* YACS::HMI::CommandAddODSPortFromCatalog::_ODSPort
protected

◆ _sop

SubjectOutputDataStreamPort* YACS::HMI::CommandAddODSPortFromCatalog::_sop
protected

◆ _typePort

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: