1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __FORLOOP_HXX__
21 #define __FORLOOP_HXX__
23 #include "YACSlibEngineExport.hxx"
24 #include "AnyInputPort.hxx"
25 #include "AnyOutputPort.hxx"
32 class YACSLIBENGINE_EXPORT ForLoop : public Loop
35 static const char NAME_OF_INDEX[];
36 static const char NAME_OF_NSTEPS_NUMBER[];
37 AnyInputPort _nbOfTimesPort;
38 AnyOutputPort _indexPort;
40 ForLoop(const ForLoop& other, ComposedNode *father, bool editionOnly);
41 ForLoop(const std::string& name);
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;
59 YACS::Event updateStateOnFinishedEventFrom(Node *node);
60 void checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed,
61 bool direction, LinkInfo& info) const;
62 void checkControlDependancy(OutPort *start, InPort *end, bool cross,
63 std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
64 std::vector<OutPort *>& fwCross,
65 std::map< ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
66 LinkInfo& info) const;