Version: 9.16.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...
 
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

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::CommandSetForLoopSteps ( std::string  forLoop,
std::string  value 
)

Definition at line 2585 of file commandsProc.cxx.

2587 : Command(), _forLoop(forLoop), _value(value)
2588{
2589 DEBTRACE("CommandSetForLoopSteps::CommandSetForLoopSteps");
2590 _oldValue = 0;
2591}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31

References _oldValue, and DEBTRACE.

Member Function Documentation

◆ dump()

std::string CommandSetForLoopSteps::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 2594 of file commandsProc.cxx.

2595{
2596 string ret ="CommandSetForLoopSteps " + _forLoop + " " + _value;
2597 return ret;
2598}

References _forLoop, and _value.

◆ localExecute()

bool CommandSetForLoopSteps::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2600 of file commandsProc.cxx.

2601{
2602 DEBTRACE("CommandSetForLoopSteps::localExecute");
2603 try
2604 {
2605 DEBTRACE("CommandSetForLoopSteps::localExecute");
2606 Proc* proc = GuiContext::getCurrent()->getProc();
2607 ForLoop* forLoop = dynamic_cast<ForLoop*>(proc->getChildByName(_forLoop));
2608 InputPort *nbSteps = forLoop->edGetNbOfTimesInputPort();
2609 _oldValue = atoi(forLoop->edGetNbOfTimesInputPort()->getAsString().c_str());
2610 int val = atoi(_value.c_str());
2611 nbSteps->edInit(val);
2612 YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(forLoop));
2614 snode->update(SETVALUE, 0, snode);
2615 return true;
2616 }
2617 catch (Exception& ex)
2618 {
2619 DEBTRACE("CommandSetForLoopSteps::localExecute() : " << ex.what());
2620 setErrorMsg(ex);
2621 return false;
2622 }
2623}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
Node * getChildByName(const std::string &name) const
virtual std::string getAsString()
returns port value as a string that can be used in a GUI for example
Definition: DataPort.cxx:84
Class for for loop node.
Definition: ForLoop.hxx:33
InputPort * edGetNbOfTimesInputPort()
Definition: ForLoop.hxx:45
Base class for Input Ports.
Definition: InputPort.hxx:44
void edInit(T value)
Definition: InputPort.hxx:129
Base class for all schema objects.
Definition: Proc.hxx:44
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
std::map< YACS::ENGINE::Node *, YACS::HMI::SubjectNode * > _mapOfSubjectNode
Definition: guiContext.hxx:70
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
virtual void update(GuiEvent event, int type, Subject *son)
void setErrorMsg(YACS::Exception &ex)

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

◆ localReverse()

bool CommandSetForLoopSteps::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2625 of file commandsProc.cxx.

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

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

Member Data Documentation

◆ _forLoop

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

Definition at line 451 of file commandsProc.hxx.

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

◆ _oldValue

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

Definition at line 453 of file commandsProc.hxx.

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

◆ _value

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: