Version: 9.15.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::CommandSetFuncNodeFunctionName ( std::string  node,
std::string  funcName 
)

Definition at line 3584 of file commandsProc.cxx.

3585  : Command(), _nodeName(node), _funcName(funcName)
3586 {
3587  DEBTRACE("CommandSetFuncNodeFunctionName::CommandSetFuncNodeFunctionName " << node << " " <<funcName);
3588  _oldName.clear();
3589 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31

References _oldName, and DEBTRACE.

Member Function Documentation

◆ dump()

std::string CommandSetFuncNodeFunctionName::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3591 of file commandsProc.cxx.

3592 {
3593  string ret ="CommandSetFuncNodeFunctionName " + _nodeName + " " + _funcName;
3594  return ret;
3595 }

References _funcName, and _nodeName.

◆ localExecute()

bool CommandSetFuncNodeFunctionName::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3597 of file commandsProc.cxx.

3598 {
3599  DEBTRACE("CommandSetFuncNodeFunctionName::localExecute");
3600  try
3601  {
3602  Proc* proc = GuiContext::getCurrent()->getProc();
3603  Node* node = proc->getChildByName(_nodeName);
3604  if (_funcName.empty())
3605  {
3606  GuiContext::getCurrent()->_lastErrorMessage = "InlineFuncNode function name empty: " + _nodeName;
3607  return false;
3608  }
3609  if (YACS::ENGINE::InlineFuncNode* funcNode = dynamic_cast<YACS::ENGINE::InlineFuncNode*>(node))
3610  {
3611  _oldName = funcNode->getFname();
3612  funcNode->setFname(_funcName);
3613  return true;
3614  }
3615  else
3616  {
3617  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineFuncNode: " + _nodeName;
3618  return false;
3619  }
3620  }
3621  catch (Exception& ex)
3622  {
3623  DEBTRACE("CommandSetFuncNodeFunctionName::localExecute() : " << ex.what());
3624  setErrorMsg(ex);
3625  return false;
3626  }
3627 }
Node * getChildByName(const std::string &name) const
Class for calculation node (function) inlined (and executed) in the schema.
Definition: InlineNode.hxx:93
Base class for all nodes.
Definition: Node.hxx:70
Base class for all schema objects.
Definition: Proc.hxx:44
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
std::string _lastErrorMessage
Definition: guiContext.hxx:79
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
void setErrorMsg(YACS::Exception &ex)

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

◆ localReverse()

bool CommandSetFuncNodeFunctionName::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3629 of file commandsProc.cxx.

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

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

Member Data Documentation

◆ _funcName

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

Definition at line 649 of file commandsProc.hxx.

Referenced by dump(), and localExecute().

◆ _nodeName

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

Definition at line 648 of file commandsProc.hxx.

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

◆ _oldName

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: