Version: 8.3.0
YACS::HMI::CommandSetFuncNodeFunctionName Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetFuncNodeFunctionName:
Collaboration diagram for YACS::HMI::CommandSetFuncNodeFunctionName:

Public Member Functions

 CommandSetFuncNodeFunctionName (std::string node, std::string funcName)
 
- 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 _nodeName
 
std::string _funcName
 
std::string _oldName
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 640 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetFuncNodeFunctionName::CommandSetFuncNodeFunctionName ( std::string  node,
std::string  funcName 
)

Definition at line 3582 of file commandsProc.cxx.

References _oldName, and DEBTRACE.

3583  : Command(), _nodeName(node), _funcName(funcName)
3584 {
3585  DEBTRACE("CommandSetFuncNodeFunctionName::CommandSetFuncNodeFunctionName " << node << " " <<funcName);
3586  _oldName.clear();
3587 }

Member Function Documentation

std::string CommandSetFuncNodeFunctionName::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3589 of file commandsProc.cxx.

References _funcName, _nodeName, and PMMLBasicsTestLauncher::ret.

3590 {
3591  string ret ="CommandSetFuncNodeFunctionName " + _nodeName + " " + _funcName;
3592  return ret;
3593 }
bool CommandSetFuncNodeFunctionName::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3595 of file commandsProc.cxx.

References _funcName, YACS::HMI::GuiContext::_lastErrorMessage, _nodeName, _oldName, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), and YACS::Exception::what().

3596 {
3597  DEBTRACE("CommandSetFuncNodeFunctionName::localExecute");
3598  try
3599  {
3600  Proc* proc = GuiContext::getCurrent()->getProc();
3601  Node* node = proc->getChildByName(_nodeName);
3602  if (_funcName.empty())
3603  {
3604  GuiContext::getCurrent()->_lastErrorMessage = "InlineFuncNode function name empty: " + _nodeName;
3605  return false;
3606  }
3607  if (YACS::ENGINE::InlineFuncNode* funcNode = dynamic_cast<YACS::ENGINE::InlineFuncNode*>(node))
3608  {
3609  _oldName = funcNode->getFname();
3610  funcNode->setFname(_funcName);
3611  return true;
3612  }
3613  else
3614  {
3615  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineFuncNode: " + _nodeName;
3616  return false;
3617  }
3618  }
3619  catch (Exception& ex)
3620  {
3621  DEBTRACE("CommandSetFuncNodeFunctionName::localExecute() : " << ex.what());
3622  setErrorMsg(ex);
3623  return false;
3624  }
3625 }
bool CommandSetFuncNodeFunctionName::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3627 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, _nodeName, _oldName, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), and YACS::Exception::what().

3628 {
3629  DEBTRACE("CommandSetFuncNodeFunctionName::localReverse");
3630  try
3631  {
3632  Proc* proc = GuiContext::getCurrent()->getProc();
3633  Node* node = proc->getChildByName(_nodeName);
3634  if (YACS::ENGINE::InlineFuncNode* funcNode = dynamic_cast<YACS::ENGINE::InlineFuncNode*>(node))
3635  {
3636  funcNode->setFname(_oldName);
3637  return true;
3638  }
3639  else
3640  {
3641  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineFuncNode: " + _nodeName;
3642  return false;
3643  }
3644  }
3645  catch (Exception& ex)
3646  {
3647  DEBTRACE("CommandSetFuncNodeFunctionName::localReverse() : " << ex.what());
3648  setErrorMsg(ex);
3649  return false;
3650  }
3651 }

Member Data Documentation

std::string YACS::HMI::CommandSetFuncNodeFunctionName::_funcName
protected

Definition at line 649 of file commandsProc.hxx.

Referenced by dump(), and localExecute().

std::string YACS::HMI::CommandSetFuncNodeFunctionName::_nodeName
protected

Definition at line 648 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetFuncNodeFunctionName::_oldName
protected

Definition at line 650 of file commandsProc.hxx.

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


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