1 #ifndef __DYNPARALOOP_HXX__
2 #define __DYNPARALOOP_HXX__
4 #include "ComposedNode.hxx"
5 #include "AnyInputPort.hxx"
6 #include "OutputPort.hxx"
14 class AnyOutputPort : public OutputPort
16 friend class DynParaLoop;
18 //! store the current dispatched value
19 virtual void setValue(Any *data);
20 //! get the current dispatched value for update port value
21 Any* getValue() const { return _data; }
23 Any* _data; // the data dispatched from port on the current moment
25 AnyOutputPort(const std::string& name, Node *node, TypeCode *type);
26 AnyOutputPort(const AnyOutputPort& other, Node *newHelder);
27 virtual ~AnyOutputPort();
28 OutputPort *clone(Node *newHelder) const;
32 * \brief Base class for dynamically (fully or semifully) built graphs.
34 class DynParaLoop : public ComposedNode
45 unsigned _nbOfEltConsumed;
46 std::vector<int> _execIds;
47 AnyInputPort _nbOfBranches;
48 AnyOutputPort _splittedPort;
49 std::vector<Node *> _execNodes;
50 std::vector<Node *> _execInitNodes;
52 static const char NAME_OF_SPLITTED_SEQ_OUT[];
53 static const char NAME_OF_NUMBER_OF_BRANCHES[];
55 DynParaLoop(const std::string& name, TypeCode *typeOfDataSplitted);
56 virtual ~DynParaLoop();
57 DynParaLoop(const DynParaLoop& other, ComposedNode *father, bool editionOnly);
60 Node *edRemoveInitNode();
61 //Node* DISOWNnode is a SWIG notation to indicate that the ownership of the node is transfered to C++
62 Node *edSetNode(Node *DISOWNnode);
63 Node *edSetInitNode(Node *DISOWNnode);
64 void init(bool start=true);
65 InputPort *edGetNbOfBranchesPort() { return &_nbOfBranches; }
66 int getNumberOfInputPorts() const;
67 int getNumberOfOutputPorts() const;
68 unsigned getNumberOfEltsConsumed() const { return _nbOfEltConsumed; }
69 std::list<OutputPort *> getSetOfOutputPort() const;
70 OutputPort *edGetSamplePort() { return &_splittedPort; }
71 OutPort *getOutPort(const std::string& name) const throw(Exception);
72 InputPort *getInputPort(const std::string& name) const throw(Exception);
73 OutputPort *getOutputPort(const std::string& name) const throw(Exception);
74 //! For the moment false is returned : impovement about it coming soon.
75 bool isPlacementPredictableB4Run() const;
76 void edRemoveChild(Node *node) throw(Exception);
77 std::list<Node *> edGetDirectDescendants() const;
78 std::list<InputPort *> getSetOfInputPort() const;
79 std::list<InputPort *> getLocalInputPorts() const;
80 unsigned getNumberOfBranchesCreatedDyn() const throw(Exception);
81 Node *getChildByShortName(const std::string& name) const throw(Exception);
82 Node *getChildByNameExec(const std::string& name, unsigned id) const throw(Exception);
83 std::vector<Node *> getNodes() const { return _execNodes; } // need to use in GUI part for adding observers for clone nodes
84 bool isMultiplicitySpecified(unsigned& value) const;
85 void forceMultiplicity(unsigned value);
87 void buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView);
88 void buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView);
89 void checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed, bool direction, LinkInfo& info) const;
90 void checkControlDependancy(OutPort *start, InPort *end, bool cross,
91 std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
92 std::vector<OutPort *>& fwCross,
93 std::map< ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
94 LinkInfo& info) const;
97 void prepareInputsFromOutOfScope(int branchNb);
98 void putValueOnBranch(Any *val, unsigned branchId, bool first);
99 TypeOfNode getIdentityOfNotifyerNode(const Node *node, unsigned& id);
100 InputPort *getDynInputPortByAbsName(int branchNb, const std::string& name, bool initNodeAdmitted);