Version: 8.3.0
YACS::HMI::CommandSetWhileCondition Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetWhileCondition:
Collaboration diagram for YACS::HMI::CommandSetWhileCondition:

Public Member Functions

 CommandSetWhileCondition (std::string whileLoop, 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 _whileLoop
 
std::string _value
 
bool _oldValue
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 456 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetWhileCondition::CommandSetWhileCondition ( std::string  whileLoop,
std::string  value 
)

Definition at line 2648 of file commandsProc.cxx.

References _oldValue, and DEBTRACE.

2650  : Command(), _whileLoop(whileLoop), _value(value)
2651 {
2652  DEBTRACE("CommandSetWhileCondition::CommandSetWhileCondition");
2653  _oldValue = 0;
2654 }

Member Function Documentation

std::string CommandSetWhileCondition::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 2656 of file commandsProc.cxx.

References _value, _whileLoop, and PMMLBasicsTestLauncher::ret.

2657 {
2658  string ret ="CommandSetWhileCondition " + _whileLoop + " " + _value;
2659  return ret;
2660 }
bool CommandSetWhileCondition::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2662 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectNode, _oldValue, _value, _whileLoop, DEBTRACE, YACS::ENGINE::WhileLoop::edGetConditionPort(), 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.

2663 {
2664  DEBTRACE("CommandSetWhileCondition::localExecute");
2665  try
2666  {
2667  Proc* proc = GuiContext::getCurrent()->getProc();
2668  WhileLoop* whileLoop = dynamic_cast<WhileLoop*>(proc->getChildByName(_whileLoop));
2669  InputPort *cond = whileLoop->edGetConditionPort();
2670  _oldValue = atoi(whileLoop->edGetConditionPort()->getAsString().c_str());
2671  bool val = atoi(_value.c_str());
2672  cond->edInit(val);
2673  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(whileLoop));
2674  SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[whileLoop];
2675  snode->update(SETVALUE, 0, snode);
2676  return true;
2677  }
2678  catch (Exception& ex)
2679  {
2680  DEBTRACE("CommandSetWhileCondition::localExecute() : " << ex.what());
2681  setErrorMsg(ex);
2682  return false;
2683  }
2684 }
bool CommandSetWhileCondition::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2686 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectNode, _oldValue, _whileLoop, DEBTRACE, YACS::ENGINE::WhileLoop::edGetConditionPort(), 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.

2687 {
2688  DEBTRACE("CommandSetWhileCondition::localReverse");
2689  try
2690  {
2691  Proc* proc = GuiContext::getCurrent()->getProc();
2692  WhileLoop* whileLoop = dynamic_cast<WhileLoop*>(proc->getChildByName(_whileLoop));
2693  InputPort *cond = whileLoop->edGetConditionPort();
2694  cond->edInit(_oldValue);
2695  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(whileLoop));
2696  SubjectNode *snode = GuiContext::getCurrent()->_mapOfSubjectNode[whileLoop];
2697  snode->update(SETVALUE, 0, snode);
2698  return true;
2699  }
2700  catch (Exception& ex)
2701  {
2702  DEBTRACE("CommandSetWhileCondition::localReverse() : " << ex.what());
2703  setErrorMsg(ex);
2704  return false;
2705  }
2706 }

Member Data Documentation

bool YACS::HMI::CommandSetWhileCondition::_oldValue
protected

Definition at line 467 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetWhileCondition::_value
protected

Definition at line 466 of file commandsProc.hxx.

Referenced by dump(), and localExecute().

std::string YACS::HMI::CommandSetWhileCondition::_whileLoop
protected

Definition at line 465 of file commandsProc.hxx.

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


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