Version: 9.15.0
YACS::HMI::CommandSetLinkProperties Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetLinkProperties:
Collaboration diagram for YACS::HMI::CommandSetLinkProperties:

Public Member Functions

 CommandSetLinkProperties (std::string startnode, std::string startport, std::string endnode, std::string endport, std::map< std::string, std::string > properties)
 
- 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

std::string _startNodeName
 
std::string _startPortName
 
std::string _endNodeName
 
std::string _endPortName
 
std::map< std::string, std::string > _properties
 
std::map< std::string, std::string > _oldProp
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 622 of file commandsProc.hxx.

Constructor & Destructor Documentation

◆ CommandSetLinkProperties()

CommandSetLinkProperties::CommandSetLinkProperties ( std::string  startnode,
std::string  startport,
std::string  endnode,
std::string  endport,
std::map< std::string, std::string >  properties 
)

Definition at line 3502 of file commandsProc.cxx.

3505  : Command(), _startNodeName(startnode), _startPortName(startport),
3506  _endNodeName(endnode), _endPortName(endport),
3507  _properties(properties)
3508 {
3509  DEBTRACE("CommandSetLinkProperties::CommandSetLinkProperties " );
3510  _oldProp.clear();
3511 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::map< std::string, std::string > _properties
std::map< std::string, std::string > _oldProp

References _oldProp, and DEBTRACE.

Member Function Documentation

◆ dump()

std::string CommandSetLinkProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3513 of file commandsProc.cxx.

3514 {
3515  string ret ="CommandSetLinkProperties " + _startNodeName + " " + _startPortName + " " + _endNodeName + " " + _endPortName;
3516  return ret;
3517 }

References _endNodeName, _endPortName, _startNodeName, and _startPortName.

◆ localExecute()

bool CommandSetLinkProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3519 of file commandsProc.cxx.

3520 {
3521  DEBTRACE("CommandSetLinkProperties::localExecute");
3522  try
3523  {
3524  Proc* proc = GuiContext::getCurrent()->getProc();
3525  Node* node;
3526  InputDataStreamPort* inDSPort = 0;
3527  OutputDataStreamPort* outDSPort = 0;
3528 
3529  node = proc->getChildByName(_startNodeName);
3530  outDSPort = node->getOutputDataStreamPort(_startPortName);
3531  outDSPort->setProperties(_properties);
3532 
3533  node = proc->getChildByName(_endNodeName);
3534  inDSPort = node->getInputDataStreamPort(_endPortName);
3535  _oldProp = inDSPort->getProperties();
3536  inDSPort->setProperties(_properties);
3537 
3538  std::pair<OutPort*,InPort*> keymap = std::pair<OutPort*,InPort*>(outDSPort,inDSPort);
3540  subject->update(SETVALUE, 0, subject);
3541  return true;
3542  }
3543  catch (Exception& ex)
3544  {
3545  DEBTRACE("CommandSetDSPortProperties::localExecute() : " << ex.what());
3546  setErrorMsg(ex);
3547  return false;
3548  }
3549 }
Node * getChildByName(const std::string &name) const
std::map< std::string, std::string > getProperties() const
virtual void setProperties(std::map< std::string, std::string > properties)
Set the values of all properties of the port.
Base class for all nodes.
Definition: Node.hxx:70
virtual InputDataStreamPort * getInputDataStreamPort(const std::string &name) const =0
virtual OutputDataStreamPort * getOutputDataStreamPort(const std::string &name) const =0
Base class for all schema objects.
Definition: Proc.hxx:44
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
std::map< std::pair< YACS::ENGINE::OutPort *, YACS::ENGINE::InPort * >, YACS::HMI::SubjectLink * > _mapOfSubjectLink
Definition: guiContext.hxx:72
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
virtual void update(GuiEvent event, int type, Subject *son)
void setErrorMsg(YACS::Exception &ex)

References _endNodeName, _endPortName, YACS::HMI::GuiContext::_mapOfSubjectLink, _oldProp, _properties, _startNodeName, _startPortName, DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Node::getInputDataStreamPort(), YACS::ENGINE::Node::getOutputDataStreamPort(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::DataStreamPort::getProperties(), setErrorMsg(), YACS::ENGINE::DataStreamPort::setProperties(), YACS::HMI::SETVALUE, and YACS::HMI::Subject::update().

◆ localReverse()

bool CommandSetLinkProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3551 of file commandsProc.cxx.

3552 {
3553  DEBTRACE("CommandSetLinkProperties::localReverse");
3554  try
3555  {
3556  Proc* proc = GuiContext::getCurrent()->getProc();
3557  Node* node;
3558  InputDataStreamPort* inDSPort = 0;
3559  OutputDataStreamPort* outDSPort = 0;
3560 
3561  node = proc->getChildByName(_startNodeName);
3562  outDSPort = node->getOutputDataStreamPort(_startPortName);
3563  outDSPort->setProperties(_properties);
3564 
3565  node = proc->getChildByName(_endNodeName);
3566  inDSPort = node->getInputDataStreamPort(_endPortName);
3567  inDSPort->setProperties(_oldProp);
3568 
3569  std::pair<OutPort*,InPort*> keymap = std::pair<OutPort*,InPort*>(outDSPort,inDSPort);
3571  subject->update(SETVALUE, 0, subject);
3572  return true;
3573  }
3574  catch (Exception& ex)
3575  {
3576  DEBTRACE("CommandSetDSPortProperties::localReverse() : " << ex.what());
3577  setErrorMsg(ex);
3578  return false;
3579  }
3580 }

References _endNodeName, _endPortName, YACS::HMI::GuiContext::_mapOfSubjectLink, _oldProp, _properties, _startNodeName, _startPortName, DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Node::getInputDataStreamPort(), YACS::ENGINE::Node::getOutputDataStreamPort(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::ENGINE::DataStreamPort::setProperties(), YACS::HMI::SETVALUE, and YACS::HMI::Subject::update().

Member Data Documentation

◆ _endNodeName

std::string YACS::HMI::CommandSetLinkProperties::_endNodeName
protected

Definition at line 634 of file commandsProc.hxx.

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

◆ _endPortName

std::string YACS::HMI::CommandSetLinkProperties::_endPortName
protected

Definition at line 635 of file commandsProc.hxx.

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

◆ _oldProp

std::map<std::string,std::string> YACS::HMI::CommandSetLinkProperties::_oldProp
protected

Definition at line 637 of file commandsProc.hxx.

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

◆ _properties

std::map<std::string,std::string> YACS::HMI::CommandSetLinkProperties::_properties
protected

Definition at line 636 of file commandsProc.hxx.

Referenced by localExecute(), and localReverse().

◆ _startNodeName

std::string YACS::HMI::CommandSetLinkProperties::_startNodeName
protected

Definition at line 632 of file commandsProc.hxx.

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

◆ _startPortName

std::string YACS::HMI::CommandSetLinkProperties::_startPortName
protected

Definition at line 633 of file commandsProc.hxx.

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


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