Version: 8.3.0
ForLoop.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef __FORLOOP_HXX__
21 #define __FORLOOP_HXX__
22 
23 #include "YACSlibEngineExport.hxx"
24 #include "AnyInputPort.hxx"
25 #include "AnyOutputPort.hxx"
26 #include "Loop.hxx"
27 
28 namespace YACS
29 {
30  namespace ENGINE
31  {
33  {
34  protected:
35  static const char NAME_OF_INDEX[];
36  static const char NAME_OF_NSTEPS_NUMBER[];
39  public:
40  ForLoop(const ForLoop& other, ComposedNode *father, bool editionOnly);
41  ForLoop(const std::string& name);
42  void exUpdateState();
43  void exUpdateProgress();
44  void init(bool start=true);
45  InputPort *edGetNbOfTimesInputPort() { return &_nbOfTimesPort; }
46  Node *simpleClone(ComposedNode *father, bool editionOnly=true) const;
47  InputPort* getInputPort(const std::string& name) const throw(Exception);
48  OutPort *getOutPort(const std::string& name) const throw(Exception);
49  OutputPort *getOutputPort(const std::string& name) const throw(Exception);
50  std::list<InputPort *> getLocalInputPorts() const;
51  std::list<OutputPort *> getLocalOutputPorts() const;
52  std::list<OutputPort *> getSetOfOutputPort() const;
53  virtual void accept(Visitor *visitor);
54  InputPort *getDecisionPort() const { return (InputPort *)&_nbOfTimesPort; }
55  OutputPort *edGetIndexPort() { return &_indexPort; }
56  virtual std::string typeName() {return "YACS__ENGINE__ForLoop";}
57  std::string getProgress() const;
58  std::list<ProgressWeight> getProgressWeight() const;
59  int getNbSteps() const;
60 
61  protected:
62  YACS::Event updateStateOnFinishedEventFrom(Node *node);
63  void checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed,
64  bool direction, LinkInfo& info) const;
65  void checkControlDependancy(OutPort *start, InPort *end, bool cross,
66  std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
67  std::vector<OutPort *>& fwCross,
68  std::map< ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
69  LinkInfo& info) const;
70  };
71  }
72 }
73 
74 #endif