Version: 9.16.0
YACS::HMI::CommandSetAlgo Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetAlgo:
Collaboration diagram for YACS::HMI::CommandSetAlgo:

Public Member Functions

 CommandSetAlgo (std::string optimizer, std::string alglib, std::string symbol)
 
- 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 _optimizer
 
std::string _alglib
 
std::string _symbol
 
std::string _oldAlglib
 
std::string _oldSymbol
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 484 of file commandsProc.hxx.

Constructor & Destructor Documentation

◆ CommandSetAlgo()

CommandSetAlgo::CommandSetAlgo ( std::string  optimizer,
std::string  alglib,
std::string  symbol 
)

Definition at line 2780 of file commandsProc.cxx.

2781 : Command(), _optimizer(optimizer), _alglib(alglib), _symbol(symbol)
2782{
2783 DEBTRACE("CommandSetAlgo::CommandSetAlgo" << _optimizer << " " << _alglib << " " << _symbol);
2784 _oldAlglib = "";
2785 _oldSymbol = "";
2786}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31

References _alglib, _oldAlglib, _oldSymbol, _optimizer, _symbol, and DEBTRACE.

Member Function Documentation

◆ dump()

std::string CommandSetAlgo::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 2788 of file commandsProc.cxx.

2789{
2790 string ret ="CommandSetAlgo " + _optimizer + " " + _alglib + " " + _symbol;
2791 return ret;
2792}

References _alglib, _optimizer, and _symbol.

◆ localExecute()

bool CommandSetAlgo::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2794 of file commandsProc.cxx.

2795{
2796 DEBTRACE("CommandSetAlgo::localExecute");
2797 try
2798 {
2799 Proc* proc = GuiContext::getCurrent()->getProc();
2800 OptimizerLoop* loop = dynamic_cast<OptimizerLoop*>(proc->getChildByName(_optimizer));
2804 InputPort *port = loop->edGetPortForOutPool();
2805 YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(port)));
2807 spo->update(UPDATE, 0, spo);
2808 OutputPort *oport = loop->edGetSamplePort();
2809 YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(oport)));
2810 spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(oport)];
2811 spo->update(UPDATE, 0, spo);
2812 YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(loop));
2814 snode->update(SETVALUE, 0, snode);
2815 return true;
2816 }
2817 catch (Exception& ex)
2818 {
2819 DEBTRACE("CommandSetAlgo::localExecute() : " << ex.what());
2820 setErrorMsg(ex);
2821 return false;
2822 }
2823}
#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
OutputPort * edGetSamplePort()
Definition: DynParaLoop.hxx:90
Base class for Input Ports.
Definition: InputPort.hxx:44
class to build optimization loops
virtual void setAlgorithm(const std::string &alglib, const std::string &symbol, bool checkLinks=true, Proc *procForTypes=NULL)
Set the algorithm library name and factory name (symbol in library) to create the algorithm and chang...
Base class for all schema objects.
Definition: Proc.hxx:44
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
std::map< YACS::ENGINE::DataPort *, YACS::HMI::SubjectDataPort * > _mapOfSubjectDataPort
Definition: guiContext.hxx:71
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)
virtual void update(GuiEvent event, int type, Subject *son)
void setErrorMsg(YACS::Exception &ex)

References _alglib, YACS::HMI::GuiContext::_mapOfSubjectDataPort, YACS::HMI::GuiContext::_mapOfSubjectNode, _oldAlglib, _oldSymbol, _optimizer, _symbol, DEBTRACE, YACS::ENGINE::OptimizerLoop::edGetPortForOutPool(), YACS::ENGINE::DynParaLoop::edGetSamplePort(), testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::OptimizerLoop::setAlgorithm(), setErrorMsg(), YACS::HMI::SETVALUE, YACS::HMI::UPDATE, YACS::HMI::Subject::update(), YACS::HMI::SubjectNode::update(), and YASSERT.

◆ localReverse()

bool CommandSetAlgo::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 2825 of file commandsProc.cxx.

2826{
2827 DEBTRACE("CommandSetAlgo::localReverse");
2828 try
2829 {
2830 Proc* proc = GuiContext::getCurrent()->getProc();
2831 OptimizerLoop* loop = dynamic_cast<OptimizerLoop*>(proc->getChildByName(_optimizer));
2833 InputPort *port = loop->edGetPortForOutPool();
2834 YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(port)));
2836 spo->update(UPDATE, 0, spo);
2837 OutputPort *oport = loop->edGetSamplePort();
2838 YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataPort.count(static_cast<DataPort*>(oport)));
2839 spo = GuiContext::getCurrent()->_mapOfSubjectDataPort[static_cast<DataPort*>(oport)];
2840 spo->update(UPDATE, 0, spo);
2841 YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(loop));
2843 snode->update(SETVALUE, 0, snode);
2844 return true;
2845 }
2846 catch (Exception& ex)
2847 {
2848 DEBTRACE("CommandSetAlgo::localReverse() : " << ex.what());
2849 setErrorMsg(ex);
2850 return false;
2851 }
2852 return true;
2853}

References YACS::HMI::GuiContext::_mapOfSubjectDataPort, YACS::HMI::GuiContext::_mapOfSubjectNode, _oldAlglib, _oldSymbol, _optimizer, DEBTRACE, YACS::ENGINE::OptimizerLoop::edGetPortForOutPool(), YACS::ENGINE::DynParaLoop::edGetSamplePort(), testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::OptimizerLoop::setAlgorithm(), setErrorMsg(), YACS::HMI::SETVALUE, YACS::HMI::UPDATE, YACS::HMI::Subject::update(), YACS::HMI::SubjectNode::update(), and YASSERT.

Member Data Documentation

◆ _alglib

std::string YACS::HMI::CommandSetAlgo::_alglib
protected

Definition at line 493 of file commandsProc.hxx.

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

◆ _oldAlglib

std::string YACS::HMI::CommandSetAlgo::_oldAlglib
protected

Definition at line 495 of file commandsProc.hxx.

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

◆ _oldSymbol

std::string YACS::HMI::CommandSetAlgo::_oldSymbol
protected

Definition at line 496 of file commandsProc.hxx.

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

◆ _optimizer

std::string YACS::HMI::CommandSetAlgo::_optimizer
protected

Definition at line 492 of file commandsProc.hxx.

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

◆ _symbol

std::string YACS::HMI::CommandSetAlgo::_symbol
protected

Definition at line 494 of file commandsProc.hxx.

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


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