Salome HOME
PR: first version from Antony GEAY, with directory restructuration
[modules/yacs.git] / src / engine / ComposedNode.hxx
1 #ifndef __COMPOSEDNODE_HXX__
2 #define __COMPOSEDNODE_HXX__
3
4 #include "Node.hxx"
5 #include "Scheduler.hxx"
6
7 namespace YACS
8 {
9   namespace ENGINE
10   {
11     class Bloc;
12     class InPort;
13     class OutPort;
14     class ElementaryNode;
15     
16     class ComposedNode : public Node, public Scheduler
17     {
18       friend class Bloc;
19       friend class ElementaryNode;
20     protected:
21       ComposedNode(const std::string& name);
22     public:
23       void notifyFrom(const Task *sender, YACS::Event event);
24       bool edAddLink(OutputPort *start, InputPort *end) throw(Exception);
25       bool edAddLink(OutGate *start, InGate *end) throw(Exception);
26       bool edAddCFLink(Node *nodeS, Node *nodeE) throw(Exception);
27       void edRemoveLink(OutputPort *start, InputPort *end) throw(Exception);
28       void edRemoveLink(OutGate *start, InGate *end) throw(Exception);
29       virtual void publishOutputPort(OutputPort *port) throw(Exception);
30       virtual bool isRepeatedUnpredictablySeveralTimes() const { return false; }
31     protected:
32       ComposedNode *getRootNode() throw(Exception);
33       void disconnectAllLinksConnectedTo(Node *node);
34       virtual void publishInputPort(InputPort *port);
35       YACS::Event updateStateFrom(Node *node, YACS::Event event);//update the state of this. Precondition : node->_father == this
36       virtual YACS::Event updateStateOnStartEventFrom(Node *node) = 0;//transition 3 doc P.R
37       virtual YACS::Event updateStateOnFinishedEventFrom(Node *node) = 0;//transition 9 doc P.R.
38       virtual InPort *buildDelegateOf(InPort *port, const std::list<ComposedNode *>& pointsOfView);
39       virtual OutPort *buildDelegateOf(OutPort *port, const std::list<ComposedNode *>& pointsOfView);
40       virtual InPort *getDelegateOf(InPort *port, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
41       virtual OutPort *getDelegateOf(OutPort *port, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
42       virtual InPort *releaseDelegateOf(InPort *port, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
43       virtual OutPort *releaseDelegateOf(OutPort *port, const std::list<ComposedNode *>& pointsOfView) throw(Exception);
44       virtual void checkNoCyclePassingThrough(Node *node) throw(Exception) = 0;
45       void checkInMyDescendance(Node *nodeToTest) const throw(Exception);
46       static ComposedNode *getLowestCommonAncestor(Node *node1, Node *node2) throw(Exception);
47     };
48   }
49 }
50
51 #endif