Version: 8.3.0
YACS::HMI::EditionOptimizerLoop Class Reference

#include <EditionOptimizerLoop.hxx>

Inheritance diagram for YACS::HMI::EditionOptimizerLoop:
Collaboration diagram for YACS::HMI::EditionOptimizerLoop:

Public Slots

virtual void onModifyInitFile ()
 
virtual void onModifyEntry ()
 
virtual void onModifyLib ()
 
virtual void onNbBranchesEdited ()
 

Public Member Functions

 EditionOptimizerLoop (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionOptimizerLoop ()
 
virtual void synchronize ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
- Public Member Functions inherited from YACS::HMI::EditionNode
 EditionNode (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionNode ()
 
- Public Member Functions inherited from YACS::HMI::ItemEdition
 ItemEdition (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~ItemEdition ()
 
virtual void select (bool isSelected)
 
virtual void setName (std::string name)
 
virtual void setEdited (bool isEdited)
 
- Public Member Functions inherited from FormEditItem
 FormEditItem (QWidget *parent=0)
 
virtual ~FormEditItem ()
 
- Public Member Functions inherited from YACS::HMI::ItemEditionBase
 ItemEditionBase (Subject *subject)
 
virtual ~ItemEditionBase ()
 
virtual SubjectgetSubject ()
 
- Public Member Functions inherited from YACS::HMI::GuiObserver
 GuiObserver ()
 
virtual ~GuiObserver ()
 
virtual void incrementSubjects (Subject *subject)
 
virtual void decrementSubjects (Subject *subject)
 
int getNbSubjects ()
 
bool isDestructible ()
 

Protected Attributes

FormOptimizerLoop_formOptimizerLoop
 
int _nbBranches
 
- Protected Attributes inherited from YACS::HMI::EditionNode
QLineEdit_le_fullName
 
SubjectNode_subjectNode
 
- Protected Attributes inherited from YACS::HMI::ItemEdition
bool _isEdited
 
bool _haveScript
 
- Protected Attributes inherited from FormEditItem
WidEditItem_wid
 
- Protected Attributes inherited from YACS::HMI::ItemEditionBase
Subject_subject
 
int _stackId
 
std::string _name
 
std::string _type
 
std::string _category
 
- Protected Attributes inherited from YACS::HMI::GuiObserver
std::set< Subject * > _subjectSet
 
bool _destructible
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::ItemEdition
static std::string filterName (const std::string &name)
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 31 of file EditionOptimizerLoop.hxx.

Constructor & Destructor Documentation

EditionOptimizerLoop::EditionOptimizerLoop ( Subject subject,
QWidget parent = 0,
const char *  name = 0 
)

Definition at line 39 of file EditionOptimizerLoop.cxx.

References _formOptimizerLoop, _nbBranches, FormEditItem::_wid, onModifyEntry(), onModifyInitFile(), onModifyLib(), and onNbBranchesEdited().

42  : EditionNode(subject, parent, name)
43 {
45  _nbBranches = 1;
46  _wid->gridLayout1->addWidget(_formOptimizerLoop);
47  _formOptimizerLoop->sb_nbranch->setMinimum(1);
48  _formOptimizerLoop->sb_nbranch->setMaximum(INT_MAX);
49 
50  connect(_formOptimizerLoop->sb_nbranch, SIGNAL(editingFinished()),
51  this, SLOT(onNbBranchesEdited()));
52  connect(_formOptimizerLoop->lineEdit_initValue, SIGNAL(editingFinished()),
53  this, SLOT(onModifyInitFile()));
54  connect(_formOptimizerLoop->lineEdit_entry, SIGNAL(editingFinished()),
55  this, SLOT(onModifyEntry()));
56  connect(_formOptimizerLoop->lineEdit_lib, SIGNAL(editingFinished()),
57  this, SLOT(onModifyLib()));
58 }
EditionOptimizerLoop::~EditionOptimizerLoop ( )
virtual

Definition at line 60 of file EditionOptimizerLoop.cxx.

61 {
62 }

Member Function Documentation

void EditionOptimizerLoop::onModifyEntry ( )
virtualslot

Definition at line 75 of file EditionOptimizerLoop.cxx.

References _formOptimizerLoop, YACS::HMI::EditionNode::_subjectNode, DEBTRACE, YACS::HMI::SubjectNode::getNode(), YACS::ENGINE::OptimizerLoop::getSymbol(), and YACS::HMI::SubjectOptimizerLoop::setAlgorithm().

Referenced by EditionOptimizerLoop().

76 {
77  DEBTRACE("EditionOptimizerLoop::onModifyEntry");
78  OptimizerLoop *oloop = dynamic_cast<OptimizerLoop*>(_subjectNode->getNode());
79  if (oloop->getSymbol() == _formOptimizerLoop->lineEdit_entry->text().toStdString()) return;
80 
81  bool isOk = false;
83  isOk=ol->setAlgorithm(_formOptimizerLoop->lineEdit_lib->text().toStdString(),
84  _formOptimizerLoop->lineEdit_entry->text().toStdString());
85  if(!isOk)
86  Message mess;
87  DEBTRACE(isOk);
88 }
void EditionOptimizerLoop::onModifyInitFile ( )
virtualslot
void EditionOptimizerLoop::onModifyLib ( )
virtualslot

Definition at line 90 of file EditionOptimizerLoop.cxx.

References _formOptimizerLoop, YACS::HMI::EditionNode::_subjectNode, DEBTRACE, YACS::ENGINE::OptimizerLoop::getAlgLib(), YACS::HMI::SubjectNode::getNode(), and YACS::HMI::SubjectOptimizerLoop::setAlgorithm().

Referenced by EditionOptimizerLoop().

91 {
92  DEBTRACE("EditionOptimizerLoop::onModifyLib");
93  OptimizerLoop *oloop = dynamic_cast<OptimizerLoop*>(_subjectNode->getNode());
94  if(oloop->getAlgLib() == _formOptimizerLoop->lineEdit_lib->text().toStdString()) return;
95 
96  bool isOk = false;
98  isOk=ol->setAlgorithm(_formOptimizerLoop->lineEdit_lib->text().toStdString(),
99  _formOptimizerLoop->lineEdit_entry->text().toStdString());
100  if (!isOk && !_formOptimizerLoop->lineEdit_lib->text().isEmpty() &&
101  !_formOptimizerLoop->lineEdit_entry->text().isEmpty())
102  Message mess;
103  DEBTRACE(isOk);
104 }
void EditionOptimizerLoop::onNbBranchesEdited ( )
virtualslot

Definition at line 106 of file EditionOptimizerLoop.cxx.

References _formOptimizerLoop, _nbBranches, YACS::HMI::ItemEditionBase::_subject, DEBTRACE, YACS::HMI::SubjectDynParaLoop::setNbBranches(), and YASSERT.

Referenced by EditionOptimizerLoop().

107 {
108  int newval = _formOptimizerLoop->sb_nbranch->value();
109  DEBTRACE("EditionOptimizerLoop::onNbBranchesEdited " << _nbBranches << " --> " << newval);
110  if (newval != _nbBranches)
111  {
112  SubjectOptimizerLoop *sol = dynamic_cast<SubjectOptimizerLoop*>(_subject);
113  YASSERT(sol);
114  QString text = _formOptimizerLoop->sb_nbranch->cleanText();
115  sol->setNbBranches(text.toStdString());
116  }
117 }
void EditionOptimizerLoop::synchronize ( )
virtual

used in derived nodes for synchronisation with schema model.

Reimplemented from YACS::HMI::ItemEdition.

Definition at line 119 of file EditionOptimizerLoop.cxx.

References YACS::HMI::ItemEditionBase::_subject, YACS::HMI::SETVALUE, and YACS::HMI::Subject::update().

120 {
122 }
void EditionOptimizerLoop::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

when loading a schema, creation of all edition widgets is time and memory consuming, so, widget edition creation is differed until user select an item in tree or 2D vue.

Reimplemented from YACS::HMI::EditionNode.

Definition at line 124 of file EditionOptimizerLoop.cxx.

References _formOptimizerLoop, _nbBranches, YACS::HMI::ItemEditionBase::_subject, YACS::HMI::EditionNode::_subjectNode, DEBTRACE, YACS::ENGINE::OptimizerLoop::edGetAlgoInitPort(), YACS::ENGINE::OptimizerLoop::edGetAlgoResultPort(), YACS::ENGINE::OptimizerLoop::edGetPortForOutPool(), YACS::ENGINE::DynParaLoop::edGetSamplePort(), YACS::ENGINE::DataPort::edGetType(), YACS::HMI::GuiObserver::eventName(), YACS::ENGINE::OptimizerLoop::getAlgLib(), YACS::ENGINE::DataPort::getAsString(), YACS::HMI::SubjectNode::getNode(), YACS::ENGINE::OptimizerLoop::getSymbol(), YACS::HMI::SubjectComposedNode::getValue(), CORBAEngineTest::i, YACS::ENGINE::TypeCode::name(), YACS::HMI::SETVALUE, and YACS::HMI::EditionNode::update().

Referenced by gui.graph.MyCanvas::customEvent().

125 {
126  DEBTRACE("EditionOptimizerLoop::update " << eventName(event) << " " << type);
127  EditionNode::update(event, type, son);
128  switch (event)
129  {
130  case SETVALUE:
131  // Nb branches
132  SubjectComposedNode * scn = dynamic_cast<SubjectComposedNode*>(_subject);
133  string val = scn->getValue();
134  istringstream ss(val);
135  DEBTRACE( val);
136  int i = 0;
137  ss >> i;
138  DEBTRACE(i);
139  _formOptimizerLoop->sb_nbranch->setValue(i);
140  _nbBranches = i;
141 
142  OptimizerLoop * ol = dynamic_cast<OptimizerLoop *>(_subjectNode->getNode());
143 
144  // Algo init value
145  InputPort * dp = ol->edGetAlgoInitPort();
146  _formOptimizerLoop->lineEdit_initValue->setText(dp->getAsString().c_str());
147 
148  // Algo library and entry
149  _formOptimizerLoop->lineEdit_entry->setText(QString::fromStdString(ol->getSymbol()));
150  _formOptimizerLoop->lineEdit_lib->setText(QString::fromStdString(ol->getAlgLib()));
151 
152  // Type names
153  _formOptimizerLoop->label_evalSampleType->setText(ol->edGetSamplePort()->edGetType()->name());
154  _formOptimizerLoop->label_evalResultType->setText(ol->edGetPortForOutPool()->edGetType()->name());
155  _formOptimizerLoop->label_algoInitType->setText(ol->edGetAlgoInitPort()->edGetType()->name());
156  _formOptimizerLoop->label_algoResultType->setText(ol->edGetAlgoResultPort()->edGetType()->name());
157  break;
158  }
159 }

Member Data Documentation

FormOptimizerLoop* YACS::HMI::EditionOptimizerLoop::_formOptimizerLoop
protected
int YACS::HMI::EditionOptimizerLoop::_nbBranches
protected

Definition at line 51 of file EditionOptimizerLoop.hxx.

Referenced by EditionOptimizerLoop(), onNbBranchesEdited(), and update().


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