Version: 9.16.0
YACS::HMI::SubjectDynParaLoop Class Reference

#include <guiObservers.hxx>

Inheritance diagram for YACS::HMI::SubjectDynParaLoop:
Collaboration diagram for YACS::HMI::SubjectDynParaLoop:

Public Member Functions

 SubjectDynParaLoop (YACS::ENGINE::DynParaLoop *dynParaLoop, Subject *parent)
 
virtual ~SubjectDynParaLoop ()
 
virtual SubjectNodeaddNode (YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
 
virtual void recursiveUpdate (GuiEvent event, int type, Subject *son)
 
virtual void completeChildrenSubjectList (SubjectNode *son)
 
virtual void removeNode (SubjectNode *child)
 
virtual SubjectNodegetChild (YACS::ENGINE::Node *node=NULL) const
 
virtual bool setNbBranches (std::string nbBranches)
 
virtual bool hasValue ()
 
virtual std::string getValue ()
 
virtual void houseKeepingAfterCutPaste (bool isCut, SubjectNode *son)
 
virtual void clean (Command *command=NULL)
 
void localclean (Command *command=NULL)
 
- Public Member Functions inherited from YACS::HMI::SubjectComposedNode
 SubjectComposedNode (YACS::ENGINE::ComposedNode *composedNode, Subject *parent)
 
virtual ~SubjectComposedNode ()
 
virtual SubjectNodeaddNode (YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
 
virtual SubjectNodegetChild (YACS::ENGINE::Node *node=0) const
 
virtual void loadChildren ()
 
virtual void loadLinks ()
 
virtual void completeChildrenSubjectList (SubjectNode *son)
 
SubjectNodeaddSubjectNode (YACS::ENGINE::Node *node, std::string name="", YACS::ENGINE::Catalog *catalog=0, std::string compo="", std::string type="")
 
SubjectLinkaddSubjectLink (SubjectNode *sno, SubjectDataPort *spo, SubjectNode *sni, SubjectDataPort *spi)
 
SubjectControlLinkaddSubjectControlLink (SubjectNode *sno, SubjectNode *sni)
 
virtual void removeLink (SubjectLink *link)
 
virtual void removeControlLink (SubjectControlLink *link)
 
virtual void removeExternalControlLinks ()
 
virtual void houseKeepingAfterCutPaste (bool isCut, SubjectNode *son)
 
virtual bool hasValue ()
 
virtual std::string getValue ()
 
virtual void clean (Command *command=0)
 
void localclean (Command *command=0)
 
- Public Member Functions inherited from YACS::HMI::SubjectNode
 SubjectNode (YACS::ENGINE::Node *node, Subject *parent)
 
virtual ~SubjectNode ()
 
virtual bool setProperties (std::map< std::string, std::string > properties)
 
virtual std::map< std::string, std::string > getProperties ()
 
virtual bool reparent (Subject *parent)
 
virtual bool copy (Subject *parent)
 
virtual std::string getName ()
 
virtual bool setName (std::string name)
 
virtual YACS::ENGINE::NodegetNode ()
 
virtual void clean (Command *command=0)
 
void registerUndoDestroy ()
 
SubjectControlLinkaddSubjectControlLink (SubjectControlLink *sub)
 
void removeSubjectControlLink (SubjectControlLink *sub)
 
std::list< SubjectLink * > getSubjectLinks () const
 
std::list< SubjectControlLink * > getSubjectControlLinks () const
 
std::list< SubjectInputPort * > getSubjectInputPorts () const
 
std::list< SubjectOutputPort * > getSubjectOutputPorts () const
 
std::list< SubjectInputDataStreamPort * > getSubjectInputDataStreamPorts () const
 
std::list< SubjectOutputDataStreamPort * > getSubjectOutputDataStreamPorts () const
 
void localclean (Command *command=0)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual void recursiveUpdate (GuiEvent event, int type, Subject *son)
 
virtual void removeExternalLinks ()
 
virtual void removeExternalControlLinks ()
 
virtual void saveLinks ()
 
virtual void restoreLinks ()
 
virtual bool putInComposedNode (std::string name, std::string type, bool toSaveRestoreLinks=true)
 
virtual int isValid ()
 
void setExecState (int execState)
 
- Public Member Functions inherited from YACS::HMI::Subject
 Subject (Subject *parent=0)
 
virtual ~Subject ()
 
virtual void attach (GuiObserver *obs)
 
virtual void detach (GuiObserver *obs)
 
virtual void select (bool isSelected)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual std::string getName ()
 
virtual bool setName (std::string name)
 
virtual bool setProperties (std::map< std::string, std::string > properties)
 
virtual std::map< std::string, std::string > getProperties ()
 
virtual std::vector< std::string > knownProperties ()
 
virtual SubjectgetParent ()
 
virtual void setParent (Subject *son)
 
virtual bool destroy (Subject *son)
 From user action in Ihm, destroy an object. More...
 
virtual void loadChildren ()
 
virtual void loadLinks ()
 
virtual void addSubjectReference (Subject *ref)
 
virtual void clean (Command *command=0)
 
void localclean (Command *command=0)
 
void registerUndoDestroy ()
 
void askRegisterUndoDestroy ()
 
bool isDestructible ()
 
virtual TypeOfElem getType ()
 
virtual void setProgress (std::string newProgress)
 
virtual std::string getProgress ()
 
- Public Member Functions inherited from YACS::ENGINE::Observer
virtual void notifyObserver (Node *object, const std::string &event)
 
virtual void notifyObserver2 (Node *object, const std::string &event, void *something)
 
virtual void notifyObserverFromClone (Node *originalInstance, const std::string &event, Node *clonedInstanceGeneratingEvent)
 
virtual ~Observer ()
 

Protected Attributes

YACS::ENGINE::DynParaLoop_dynParaLoop
 
SubjectNode_subjectExecNode
 
SubjectNode_subjectInitNode
 
SubjectNode_subjectFinalizeNode
 
- Protected Attributes inherited from YACS::HMI::SubjectComposedNode
YACS::ENGINE::ComposedNode_composedNode
 
- Protected Attributes inherited from YACS::HMI::SubjectNode
YACS::ENGINE::Node_node
 
std::list< SubjectInputPort * > _listSubjectInputPort
 
std::list< SubjectOutputPort * > _listSubjectOutputPort
 
std::list< SubjectInputDataStreamPort * > _listSubjectIDSPort
 
std::list< SubjectOutputDataStreamPort * > _listSubjectODSPort
 
std::list< SubjectLink * > _listSubjectLink
 
std::list< SubjectControlLink * > _listSubjectControlLink
 
int _execState
 
std::list< YACS::ENGINE::OutGate * > loutgate
 
std::list< YACS::ENGINE::InGate * > singate
 
std::vector< std::pair< YACS::ENGINE::OutPort *, YACS::ENGINE::InPort * > > dataLinks
 
std::vector< std::pair< YACS::ENGINE::OutPort *, YACS::ENGINE::InPort * > > dataflowLinks
 
- Protected Attributes inherited from YACS::HMI::Subject
std::set< GuiObserver * > _setObs
 
Subject_parent
 
bool _destructible
 
bool _askRegisterUndo
 
std::string _progress
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::SubjectComposedNode
static SubjectComposedNodegetLowestCommonAncestor (SubjectNode *snode1, SubjectNode *snode2)
 Retrieves the lowest common ancestor of 2 nodes. More...
 
- Static Public Member Functions inherited from YACS::HMI::SubjectNode
static bool tryCreateLink (SubjectNode *subOutNode, SubjectNode *subInNode)
 
- Static Public Member Functions inherited from YACS::HMI::Subject
static void erase (Subject *sub, Command *command=0, bool post=false)
 
- Protected Member Functions inherited from YACS::HMI::SubjectComposedNode
virtual SubjectNodecreateNode (YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst, int swCase=0)
 
- Protected Member Functions inherited from YACS::HMI::SubjectNode
virtual SubjectInputPortaddSubjectInputPort (YACS::ENGINE::InputPort *port, std::string name="")
 
virtual SubjectOutputPortaddSubjectOutputPort (YACS::ENGINE::OutputPort *port, std::string name="")
 
virtual SubjectInputDataStreamPortaddSubjectIDSPort (YACS::ENGINE::InputDataStreamPort *port, std::string name="")
 
virtual SubjectOutputDataStreamPortaddSubjectODSPort (YACS::ENGINE::OutputDataStreamPort *port, std::string name="")
 
virtual void notifyObserver (YACS::ENGINE::Node *object, const std::string &event)
 

Detailed Description

Definition at line 616 of file guiObservers.hxx.

Constructor & Destructor Documentation

◆ SubjectDynParaLoop()

SubjectDynParaLoop::SubjectDynParaLoop ( YACS::ENGINE::DynParaLoop dynParaLoop,
Subject parent 
)

Definition at line 3265 of file guiObservers.cxx.

3266 : SubjectComposedNode(dynParaLoop, parent), _dynParaLoop(dynParaLoop)
3267{
3268 _subjectExecNode = NULL;
3269 _subjectInitNode = NULL;
3270 _subjectFinalizeNode = NULL;
3271}
SubjectComposedNode(YACS::ENGINE::ComposedNode *composedNode, Subject *parent)
YACS::ENGINE::DynParaLoop * _dynParaLoop

References _subjectExecNode, _subjectFinalizeNode, and _subjectInitNode.

◆ ~SubjectDynParaLoop()

SubjectDynParaLoop::~SubjectDynParaLoop ( )
virtual

Definition at line 3273 of file guiObservers.cxx.

3274{
3275 DEBTRACE("SubjectDynParaLoop::~SubjectDynParaLoop " << getName());
3276}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
virtual std::string getName()

References DEBTRACE, and YACS::HMI::SubjectNode::getName().

Member Function Documentation

◆ addNode()

SubjectNode * SubjectDynParaLoop::addNode ( YACS::ENGINE::Catalog catalog,
std::string  compo,
std::string  type,
std::string  name,
bool  newCompoInst 
)
virtual

Reimplemented from YACS::HMI::SubjectComposedNode.

Definition at line 3289 of file guiObservers.cxx.

3294{
3295 DEBTRACE("SubjectDynParaLoop::addNode(catalog, compo, type, name)");
3296 if (_subjectExecNode)
3297 {
3298 GuiContext::getCurrent()->_lastErrorMessage = "If you need several nodes in a loop, "
3299 "put the nodes in a bloc";
3300 return NULL;
3301 }
3302 return createNode(catalog, compo, type, name, newCompoInst);
3303}
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
std::string _lastErrorMessage
Definition: guiContext.hxx:79
virtual SubjectNode * createNode(YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst, int swCase=0)

References YACS::HMI::GuiContext::_lastErrorMessage, _subjectExecNode, YACS::HMI::SubjectComposedNode::createNode(), DEBTRACE, and YACS::HMI::GuiContext::getCurrent().

Referenced by gui.GraphViewer.GraphViewer::popup().

◆ clean()

void SubjectDynParaLoop::clean ( Command command = NULL)
virtual

Clean process prior to delete is redefined in derived classes: a local clean treatment relative to the derived class, then a call to the parent class clean method.

Reimplemented from YACS::HMI::SubjectComposedNode.

Reimplemented in YACS::HMI::SubjectForEachLoop, and YACS::HMI::SubjectOptimizerLoop.

Definition at line 3313 of file guiObservers.cxx.

3314{
3315 if (_askRegisterUndo)
3316 {
3317 _askRegisterUndo = false;
3319 }
3320 localclean(command);
3322}
virtual void clean(Command *command=0)
void localclean(Command *command=NULL)

References YACS::HMI::Subject::_askRegisterUndo, YACS::HMI::SubjectComposedNode::clean(), localclean(), and YACS::HMI::SubjectNode::registerUndoDestroy().

Referenced by YACS::HMI::SubjectForEachLoop::clean(), and YACS::HMI::SubjectOptimizerLoop::clean().

◆ completeChildrenSubjectList()

void SubjectDynParaLoop::completeChildrenSubjectList ( SubjectNode son)
virtual

Reimplemented from YACS::HMI::SubjectComposedNode.

Reimplemented in YACS::HMI::SubjectForEachLoop.

Definition at line 3344 of file guiObservers.cxx.

3345{
3346 YASSERT(son);
3347 if (son->getNode() == _dynParaLoop->getExecNode())
3348 _subjectExecNode = son;
3349 else if (son->getNode() == _dynParaLoop->getInitNode())
3350 _subjectInitNode = son;
3351 else if (son->getNode() == _dynParaLoop->getFinalizeNode())
3353 else
3354 YASSERT(false);
3355}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
virtual YACS::ENGINE::Node * getNode()

References _dynParaLoop, _subjectExecNode, _subjectFinalizeNode, _subjectInitNode, YACS::ENGINE::DynParaLoop::getExecNode(), YACS::ENGINE::DynParaLoop::getFinalizeNode(), YACS::ENGINE::DynParaLoop::getInitNode(), YACS::HMI::SubjectNode::getNode(), and YASSERT.

Referenced by YACS::HMI::SubjectForEachLoop::completeChildrenSubjectList().

◆ getChild()

SubjectNode * SubjectDynParaLoop::getChild ( YACS::ENGINE::Node node = NULL) const
virtual

Reimplemented from YACS::HMI::SubjectComposedNode.

Definition at line 3370 of file guiObservers.cxx.

3371{
3372 return _subjectExecNode;
3373}

References _subjectExecNode.

◆ getValue()

std::string SubjectDynParaLoop::getValue ( )
virtual

used in derived classes using a counter, a selector, or a condition: ForLoop, ForEachLoop, Switch, WhileLoop.

Reimplemented from YACS::HMI::SubjectComposedNode.

Definition at line 3395 of file guiObservers.cxx.

3396{
3398 if(port)
3399 return port->getAsString();
3400 else
3401 return std::string();
3402}
InputPort * edGetNbOfBranchesPort()
Definition: DynParaLoop.hxx:83
Base class for Input Ports.
Definition: InputPort.hxx:44

References _dynParaLoop, YACS::ENGINE::DynParaLoop::edGetNbOfBranchesPort(), and YACS::ENGINE::DataPort::getAsString().

◆ hasValue()

bool SubjectDynParaLoop::hasValue ( )
virtual

used in derived classes using a counter, a selector, or a condition: ForLoop, ForEachLoop, Switch, WhileLoop.

Reimplemented from YACS::HMI::SubjectComposedNode.

Definition at line 3390 of file guiObservers.cxx.

3391{
3392 return true;
3393}

◆ houseKeepingAfterCutPaste()

void SubjectDynParaLoop::houseKeepingAfterCutPaste ( bool  isCut,
SubjectNode son 
)
virtual

Reimplemented from YACS::HMI::SubjectComposedNode.

Definition at line 3305 of file guiObservers.cxx.

3306{
3307 if (isCut)
3308 removeNode(son);
3309 else
3310 _subjectExecNode = son;
3311}
virtual void removeNode(SubjectNode *child)

References _subjectExecNode, and removeNode().

◆ localclean()

void SubjectDynParaLoop::localclean ( Command command = NULL)

Definition at line 3324 of file guiObservers.cxx.

3325{
3326 DEBTRACE("SubjectDynParaLoop::localClean ");
3327 if (_subjectExecNode)
3328 {
3331 }
3332 if (_subjectInitNode)
3333 {
3336 }
3338 {
3341 }
3342}
static void erase(Subject *sub, Command *command=0, bool post=false)

References _subjectExecNode, _subjectFinalizeNode, _subjectInitNode, DEBTRACE, YACS::HMI::Subject::erase(), and YACS::HMI::SubjectNode::getName().

Referenced by clean().

◆ recursiveUpdate()

void SubjectDynParaLoop::recursiveUpdate ( GuiEvent  event,
int  type,
Subject son 
)
virtual

Reimplemented from YACS::HMI::SubjectNode.

Definition at line 3278 of file guiObservers.cxx.

3279{
3280 update(event, type, son);
3281 if (_subjectExecNode)
3282 _subjectExecNode->recursiveUpdate(event, type, son);
3283 if (_subjectInitNode)
3284 _subjectInitNode->recursiveUpdate(event, type, son);
3286 _subjectFinalizeNode->recursiveUpdate(event, type, son);
3287}
virtual void update(GuiEvent event, int type, Subject *son)
virtual void recursiveUpdate(GuiEvent event, int type, Subject *son)

References _subjectExecNode, _subjectFinalizeNode, _subjectInitNode, YACS::HMI::SubjectNode::recursiveUpdate(), and YACS::HMI::SubjectNode::update().

◆ removeNode()

void SubjectDynParaLoop::removeNode ( SubjectNode child)
virtual

Reimplemented in YACS::HMI::SubjectForEachLoop.

Definition at line 3357 of file guiObservers.cxx.

3358{
3359 YASSERT(child);
3360 if (child == _subjectExecNode)
3361 _subjectExecNode = NULL;
3362 else if (child == _subjectInitNode)
3363 _subjectInitNode = NULL;
3364 else if (child == _subjectFinalizeNode)
3365 _subjectFinalizeNode = NULL;
3366 else
3367 YASSERT(false);
3368}

References _subjectExecNode, _subjectFinalizeNode, _subjectInitNode, and YASSERT.

Referenced by houseKeepingAfterCutPaste(), and YACS::HMI::SubjectForEachLoop::removeNode().

◆ setNbBranches()

bool SubjectDynParaLoop::setNbBranches ( std::string  nbBranches)
virtual

Definition at line 3375 of file guiObservers.cxx.

3376{
3377 DEBTRACE("SubjectDynParaLoop::setNbBranches " << nbBranches);
3378 Proc * proc = GuiContext::getCurrent()->getProc();
3379 CommandSetForEachBranch * command =
3380 new CommandSetForEachBranch(proc->getChildName(getNode()), nbBranches);
3381 if (command->execute())
3382 {
3383 GuiContext::getCurrent()->getInvoc()->add(command);
3384 return true;
3385 }
3386 else delete command;
3387 return false;
3388}
std::string getChildName(const Node *node) const
Base class for all schema objects.
Definition: Proc.hxx:44
virtual bool execute()
the command is executed a first time after its registration for undo redo, then on redo
Definition: commands.cxx:51
YACS::HMI::ProcInvoc * getInvoc()
Definition: guiContext.hxx:51
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
void add(Command *command)
Definition: commands.cxx:156

References YACS::HMI::Invocator::add(), DEBTRACE, YACS::HMI::Command::execute(), YACS::ENGINE::ComposedNode::getChildName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), YACS::HMI::SubjectNode::getNode(), and YACS::HMI::GuiContext::getProc().

Referenced by YACS::HMI::EditionForEachLoop::onNbBranchesEdited(), and YACS::HMI::EditionOptimizerLoop::onNbBranchesEdited().

Member Data Documentation

◆ _dynParaLoop

YACS::ENGINE::DynParaLoop* YACS::HMI::SubjectDynParaLoop::_dynParaLoop
protected

Definition at line 637 of file guiObservers.hxx.

Referenced by completeChildrenSubjectList(), and getValue().

◆ _subjectExecNode

SubjectNode* YACS::HMI::SubjectDynParaLoop::_subjectExecNode
protected

◆ _subjectFinalizeNode

SubjectNode* YACS::HMI::SubjectDynParaLoop::_subjectFinalizeNode
protected

◆ _subjectInitNode

SubjectNode* YACS::HMI::SubjectDynParaLoop::_subjectInitNode
protected

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