Version: 9.15.0
YACS::HMI::CommandSetDSPortProperties Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetDSPortProperties:
Collaboration diagram for YACS::HMI::CommandSetDSPortProperties:

Public Member Functions

 CommandSetDSPortProperties (std::string node, std::string port, bool isInport, 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 _nodeName
 
std::string _portName
 
bool _isInport
 
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 606 of file commandsProc.hxx.

Constructor & Destructor Documentation

◆ CommandSetDSPortProperties()

CommandSetDSPortProperties::CommandSetDSPortProperties ( std::string  node,
std::string  port,
bool  isInport,
std::map< std::string, std::string >  properties 
)

Definition at line 3437 of file commandsProc.cxx.

3439  : Command(), _nodeName(node), _portName(port), _isInport(isInport), _properties(properties)
3440 {
3441  DEBTRACE("CommandSetDSPortProperties::CommandSetDSPortProperties " << node << "." << port << " " << isInport);
3442  _oldProp.clear();
3443 }
#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 CommandSetDSPortProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3445 of file commandsProc.cxx.

3446 {
3447  string s = "false";
3448  if (_isInport) s = "true";
3449  string ret ="CommandSetDSPortProperties " + _nodeName + " " + _portName + " " + s;
3450  return ret;
3451 }

References _isInport, _nodeName, and _portName.

◆ localExecute()

bool CommandSetDSPortProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3453 of file commandsProc.cxx.

3454 {
3455  DEBTRACE("CommandSetDSPortProperties::localExecute");
3456  try
3457  {
3458  Proc* proc = GuiContext::getCurrent()->getProc();
3459  Node* node = proc->getChildByName(_nodeName);
3460  DataStreamPort* DSPort = 0;
3461  if (_isInport)
3462  DSPort = node->getInputDataStreamPort(_portName);
3463  else
3464  DSPort = node->getOutputDataStreamPort(_portName);
3465  _oldProp = DSPort->getProperties();
3466  DSPort->setProperties(_properties);
3467  return true;
3468  }
3469  catch (Exception& ex)
3470  {
3471  DEBTRACE("CommandSetDSPortProperties::localExecute() : " << ex.what());
3472  setErrorMsg(ex);
3473  return false;
3474  }
3475 }
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
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
void setErrorMsg(YACS::Exception &ex)

References _isInport, _nodeName, _oldProp, _portName, _properties, 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(), and YACS::ENGINE::DataStreamPort::setProperties().

◆ localReverse()

bool CommandSetDSPortProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3477 of file commandsProc.cxx.

3478 {
3479  DEBTRACE("CommandSetDSPortProperties::localReverse");
3480  try
3481  {
3482  Proc* proc = GuiContext::getCurrent()->getProc();
3483  Node* node = proc->getChildByName(_nodeName);
3484  DataStreamPort* DSPort = 0;
3485  if (_isInport)
3486  DSPort = node->getInputDataStreamPort(_portName);
3487  else
3488  DSPort = node->getOutputDataStreamPort(_portName);
3489  DSPort->setProperties(_oldProp);
3490  return true;
3491  }
3492  catch (Exception& ex)
3493  {
3494  DEBTRACE("CommandSetDSPortProperties::localReverse() : " << ex.what());
3495  setErrorMsg(ex);
3496  return false;
3497  }
3498 }

References _isInport, _nodeName, _oldProp, _portName, DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Node::getInputDataStreamPort(), YACS::ENGINE::Node::getOutputDataStreamPort(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), and YACS::ENGINE::DataStreamPort::setProperties().

Member Data Documentation

◆ _isInport

bool YACS::HMI::CommandSetDSPortProperties::_isInport
protected

Definition at line 617 of file commandsProc.hxx.

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

◆ _nodeName

std::string YACS::HMI::CommandSetDSPortProperties::_nodeName
protected

Definition at line 615 of file commandsProc.hxx.

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

◆ _oldProp

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

Definition at line 619 of file commandsProc.hxx.

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

◆ _portName

std::string YACS::HMI::CommandSetDSPortProperties::_portName
protected

Definition at line 616 of file commandsProc.hxx.

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

◆ _properties

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

Definition at line 618 of file commandsProc.hxx.

Referenced by localExecute().


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