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

Definition at line 1399 of file commandsProc.cxx.

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

References _IDSPort, and _sip.

Member Function Documentation

◆ dump()

std::string CommandAddIDSPortFromCatalog::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 1409 of file commandsProc.cxx.

1410{
1411 string ret ="CommandAddIDSPortFromCatalog " + _typePort + " " + _node + " " + _name;
1412 return ret;
1413}

References _name, _node, and _typePort.

◆ getIDSPort()

YACS::ENGINE::InputDataStreamPort * CommandAddIDSPortFromCatalog::getIDSPort ( )

Definition at line 1415 of file commandsProc.cxx.

1416{
1417 DEBTRACE("CommandAddIDSPortFromCatalog");
1418 return _IDSPort;
1419}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31

References _IDSPort, and DEBTRACE.

◆ getSubjectIDSPort()

SubjectInputDataStreamPort * CommandAddIDSPortFromCatalog::getSubjectIDSPort ( )

Definition at line 1421 of file commandsProc.cxx.

1422{
1423 return _sip;
1424}

References _sip.

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

◆ localExecute()

bool CommandAddIDSPortFromCatalog::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1426 of file commandsProc.cxx.

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}
#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 InputDataStreamPort * edAddInputDataStreamPort(const std::string &inputPortDSName, 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 SubjectInputDataStreamPort * addSubjectIDSPort(YACS::ENGINE::InputDataStreamPort *port, std::string name="")
void setErrorMsg(YACS::Exception &ex)

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

◆ localReverse()

bool CommandAddIDSPortFromCatalog::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 1460 of file commandsProc.cxx.

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);
1471 YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(_IDSPort));
1473 YASSERT(_sip);
1474
1475 Subject *father=_sip->getParent();
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}
InputDataStreamPort * getInputDataStreamPort(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 _IDSPort, YACS::HMI::GuiContext::_mapOfSubjectDataPort, _name, _node, _sip, DEBTRACE, YACS::HMI::Subject::erase(), testCppPluginInvokation::ex, 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(), and YASSERT.

Member Data Documentation

◆ _catalog

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

Definition at line 316 of file commandsProc.hxx.

Referenced by localExecute().

◆ _IDSPort

YACS::ENGINE::InputDataStreamPort* YACS::HMI::CommandAddIDSPortFromCatalog::_IDSPort
protected

◆ _name

std::string YACS::HMI::CommandAddIDSPortFromCatalog::_name
protected

Definition at line 319 of file commandsProc.hxx.

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

◆ _node

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

Definition at line 318 of file commandsProc.hxx.

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

◆ _sip

SubjectInputDataStreamPort* YACS::HMI::CommandAddIDSPortFromCatalog::_sip
protected

◆ _typePort

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: