Version: 8.3.0
YACS::HMI::CommandSetSwitchSelect Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetSwitchSelect:
Collaboration diagram for YACS::HMI::CommandSetSwitchSelect:

Public Member Functions

 CommandSetSwitchSelect (std::string aSwitch, std::string value)
 
- 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 _switch
 
std::string _value
 
std::string _oldValue
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 411 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetSwitchSelect::CommandSetSwitchSelect ( std::string  aSwitch,
std::string  value 
)

Definition at line 2437 of file commandsProc.cxx.

References _oldValue, and DEBTRACE.

2439  : Command(), _switch(aSwitch), _value(value)
2440 {
2441  DEBTRACE("CommandSetSwitchSelect::CommandSetSwitchSelect");
2442  _oldValue = "0";
2443 }

Member Function Documentation

std::string CommandSetSwitchSelect::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 2445 of file commandsProc.cxx.

References _switch, _value, and PMMLBasicsTestLauncher::ret.

2446 {
2447  string ret ="CommandSetSwitchSelect " + _switch + " " + _value;
2448  return ret;
2449 }
bool CommandSetSwitchSelect::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2451 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectNode, _oldValue, _switch, _value, DEBTRACE, YACS::ENGINE::Switch::edGetConditionPort(), YACS::ENGINE::InputPort::edInit(), YACS::ENGINE::DataPort::getAsString(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SETSELECT, YACS::Exception::what(), and YASSERT.

2452 {
2453  DEBTRACE("CommandSetSwitchSelect::localExecute");
2454  try
2455  {
2456  Proc* proc = GuiContext::getCurrent()->getProc();
2457  Switch* aSwitch = dynamic_cast<Switch*>(proc->getChildByName(_switch));
2458  InputPort *condPort = aSwitch->edGetConditionPort();
2459  _oldValue = condPort->getAsString();
2460  if (_oldValue == "None") _oldValue = "0";
2461  int val = atoi(_value.c_str());
2462  condPort->edInit(val);
2463  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(aSwitch));
2465  snode->update(SETSELECT, 0, snode);
2466  }
2467  catch (Exception& ex)
2468  {
2469  DEBTRACE("CommandSetSwitchSelect::localExecute() : " << ex.what());
2470  setErrorMsg(ex);
2471  return false;
2472  }
2473 }
bool CommandSetSwitchSelect::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2475 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectNode, _oldValue, _switch, DEBTRACE, YACS::ENGINE::Switch::edGetConditionPort(), YACS::ENGINE::InputPort::edInit(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SETSELECT, YACS::Exception::what(), and YASSERT.

2476 {
2477  DEBTRACE("CommandSetSwitchSelect::localReverse");
2478  try
2479  {
2480  Proc* proc = GuiContext::getCurrent()->getProc();
2481  Switch* aSwitch = dynamic_cast<Switch*>(proc->getChildByName(_switch));
2482  InputPort *condPort = aSwitch->edGetConditionPort();
2483  int val = atoi(_oldValue.c_str());
2484  condPort->edInit(val);
2485  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(aSwitch));
2487  snode->update(SETSELECT, 0, snode);
2488  }
2489  catch (Exception& ex)
2490  {
2491  DEBTRACE("CommandSetSwitchSelect::localReverse() : " << ex.what());
2492  setErrorMsg(ex);
2493  return false;
2494  }
2495 }

Member Data Documentation

std::string YACS::HMI::CommandSetSwitchSelect::_oldValue
protected

Definition at line 422 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetSwitchSelect::_switch
protected

Definition at line 420 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetSwitchSelect::_value
protected

Definition at line 421 of file commandsProc.hxx.

Referenced by dump(), and localExecute().


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