Version: 8.3.0
YACS::HMI::CommandSetForEachBranch Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetForEachBranch:
Collaboration diagram for YACS::HMI::CommandSetForEachBranch:

Public Member Functions

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

Detailed Description

Definition at line 470 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetForEachBranch::CommandSetForEachBranch ( std::string  forEach,
std::string  value 
)

Definition at line 2710 of file commandsProc.cxx.

References _oldValue, and DEBTRACE.

2712  : Command(), _forEach(forEach), _value(value)
2713 {
2714  DEBTRACE("CommandSetForEachBranch::CommandSetForEachBranch");
2715  _oldValue = 0;
2716 }

Member Function Documentation

std::string CommandSetForEachBranch::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 2718 of file commandsProc.cxx.

References _forEach, _value, and PMMLBasicsTestLauncher::ret.

2719 {
2720  string ret ="CommandSetForEachBranch " + _forEach + " " + _value;
2721  return ret;
2722 }
bool CommandSetForEachBranch::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2724 of file commandsProc.cxx.

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

2725 {
2726  DEBTRACE("CommandSetForEachBranch::localExecute");
2727  try
2728  {
2729  Proc* proc = GuiContext::getCurrent()->getProc();
2730  Node* node=proc->getChildByName(_forEach);
2731  InputPort *nbBranches = node->getInputPort("nbBranches");
2732  _oldValue = atoi(nbBranches->getAsString().c_str());
2733  int val = atoi(_value.c_str());
2734  nbBranches->edInit(val);
2735  YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(nbBranches));
2736  SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(nbBranches)];
2737  spo->update(SETVALUE, 0, spo);
2738  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
2740  snode->update(SETVALUE, 0, snode);
2741  return true;
2742  }
2743  catch (Exception& ex)
2744  {
2745  DEBTRACE("CommandSetForEachBranch::localExecute() : " << ex.what());
2746  setErrorMsg(ex);
2747  return false;
2748  }
2749 }
bool CommandSetForEachBranch::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2751 of file commandsProc.cxx.

References _forEach, YACS::HMI::GuiContext::_mapOfSubjectDataPort, YACS::HMI::GuiContext::_mapOfSubjectNode, _oldValue, DEBTRACE, YACS::ENGINE::InputPort::edInit(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Node::getInputPort(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SETVALUE, YACS::Exception::what(), and YASSERT.

2752 {
2753  DEBTRACE("CommandSetForEachBranch::localReverse");
2754  try
2755  {
2756  Proc* proc = GuiContext::getCurrent()->getProc();
2757  Node* node=proc->getChildByName(_forEach);
2758  InputPort *nbBranches = node->getInputPort("nbBranches");
2759  nbBranches->edInit(_oldValue);
2760  YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(nbBranches));
2761  SubjectDataPort *spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(nbBranches)];
2762  spo->update(SETVALUE, 0, spo);
2763  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
2765  snode->update(SETVALUE, 0, snode);
2766  return true;
2767  }
2768  catch (Exception& ex)
2769  {
2770  DEBTRACE("CommandSetForEachBranch::localReverse() : " << ex.what());
2771  setErrorMsg(ex);
2772  return false;
2773  }
2774 }

Member Data Documentation

std::string YACS::HMI::CommandSetForEachBranch::_forEach
protected

Definition at line 479 of file commandsProc.hxx.

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

int YACS::HMI::CommandSetForEachBranch::_oldValue
protected

Definition at line 481 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetForEachBranch::_value
protected

Definition at line 480 of file commandsProc.hxx.

Referenced by dump(), and localExecute().


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