Version: 8.3.0
YACS::HMI::CommandSetForLoopSteps Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetForLoopSteps:
Collaboration diagram for YACS::HMI::CommandSetForLoopSteps:

Public Member Functions

 CommandSetForLoopSteps (std::string forLoop, 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 _forLoop
 
std::string _value
 
int _oldValue
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 442 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetForLoopSteps::CommandSetForLoopSteps ( std::string  forLoop,
std::string  value 
)

Definition at line 2583 of file commandsProc.cxx.

References _oldValue, and DEBTRACE.

2585  : Command(), _forLoop(forLoop), _value(value)
2586 {
2587  DEBTRACE("CommandSetForLoopSteps::CommandSetForLoopSteps");
2588  _oldValue = 0;
2589 }

Member Function Documentation

std::string CommandSetForLoopSteps::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 2592 of file commandsProc.cxx.

References _forLoop, _value, and PMMLBasicsTestLauncher::ret.

2593 {
2594  string ret ="CommandSetForLoopSteps " + _forLoop + " " + _value;
2595  return ret;
2596 }
bool CommandSetForLoopSteps::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2598 of file commandsProc.cxx.

References _forLoop, YACS::HMI::GuiContext::_mapOfSubjectNode, _oldValue, _value, DEBTRACE, YACS::ENGINE::ForLoop::edGetNbOfTimesInputPort(), YACS::ENGINE::InputPort::edInit(), YACS::ENGINE::DataPort::getAsString(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SETVALUE, YACS::Exception::what(), and YASSERT.

2599 {
2600  DEBTRACE("CommandSetForLoopSteps::localExecute");
2601  try
2602  {
2603  DEBTRACE("CommandSetForLoopSteps::localExecute");
2604  Proc* proc = GuiContext::getCurrent()->getProc();
2605  ForLoop* forLoop = dynamic_cast<ForLoop*>(proc->getChildByName(_forLoop));
2606  InputPort *nbSteps = forLoop->edGetNbOfTimesInputPort();
2607  _oldValue = atoi(forLoop->edGetNbOfTimesInputPort()->getAsString().c_str());
2608  int val = atoi(_value.c_str());
2609  nbSteps->edInit(val);
2610  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(forLoop));
2612  snode->update(SETVALUE, 0, snode);
2613  return true;
2614  }
2615  catch (Exception& ex)
2616  {
2617  DEBTRACE("CommandSetForLoopSteps::localExecute() : " << ex.what());
2618  setErrorMsg(ex);
2619  return false;
2620  }
2621 }
bool CommandSetForLoopSteps::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2623 of file commandsProc.cxx.

References _forLoop, YACS::HMI::GuiContext::_mapOfSubjectNode, _oldValue, DEBTRACE, YACS::ENGINE::ForLoop::edGetNbOfTimesInputPort(), YACS::ENGINE::InputPort::edInit(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SETVALUE, YACS::Exception::what(), and YASSERT.

2624 {
2625  DEBTRACE("CommandSetForLoopSteps::localReverse");
2626  try
2627  {
2628  DEBTRACE("CommandSetForLoopSteps::localReverse");
2629  Proc* proc = GuiContext::getCurrent()->getProc();
2630  ForLoop* forLoop = dynamic_cast<ForLoop*>(proc->getChildByName(_forLoop));
2631  InputPort *nbSteps = forLoop->edGetNbOfTimesInputPort();
2632  nbSteps->edInit(_oldValue);
2633  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(forLoop));
2635  snode->update(SETVALUE, 0, snode);
2636  return true;
2637  }
2638  catch (Exception& ex)
2639  {
2640  DEBTRACE("CommandSetForLoopSteps::localReverse() : " << ex.what());
2641  setErrorMsg(ex);
2642  return false;
2643  }
2644 }

Member Data Documentation

std::string YACS::HMI::CommandSetForLoopSteps::_forLoop
protected

Definition at line 451 of file commandsProc.hxx.

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

int YACS::HMI::CommandSetForLoopSteps::_oldValue
protected

Definition at line 453 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetForLoopSteps::_value
protected

Definition at line 452 of file commandsProc.hxx.

Referenced by dump(), and localExecute().


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