Salome HOME
PR: merge from BR_DATACONV_PR tag "mergeto_trunk_25oct06"
[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       virtual const std::string getInputPortName(const InputPort *) throw (Exception);
32       virtual const std::string getOutputPortName(const OutputPort *) throw (Exception);
33     protected:
34       ComposedNode *getRootNode() throw(Exception);
35       void disconnectAllLinksConnectedTo(Node *node);
36       virtual void publishInputPort(InputPort *port);
37       virtual void unpublishInputPort(InputPort *port);
38       YACS::Event updateStateFrom(Node *node, YACS::Event event);//update the state of this. Precondition : node->_father == this
39       virtual YACS::Event updateStateOnStartEventFrom(Node *node) = 0;//transition 3 doc P.R
40       virtual YACS::Event updateStateOnFinishedEventFrom(Node *node) = 0;//transition 9 doc P.R.
41       virtual InPort *buildDelegateOf(InPort *port, const std::set<ComposedNode *>& pointsOfView);
42       virtual OutPort *buildDelegateOf(OutPort *port, const std::set<ComposedNode *>& pointsOfView);
43       virtual InPort *getDelegateOf(InPort *port, const std::set<ComposedNode *>& pointsOfView) throw(Exception);
44       virtual OutPort *getDelegateOf(OutPort *port, const std::set<ComposedNode *>& pointsOfView) throw(Exception);
45       virtual InPort *releaseDelegateOf(InPort *port, const std::set<ComposedNode *>& pointsOfView) throw(Exception);
46       virtual OutPort *releaseDelegateOf(OutPort *port, const std::set<ComposedNode *>& pointsOfView) throw(Exception);
47       virtual void checkNoCyclePassingThrough(Node *node) throw(Exception) = 0;
48       void checkInMyDescendance(Node *nodeToTest) const throw(Exception);
49       static ComposedNode *getLowestCommonAncestor(Node *node1, Node *node2) throw(Exception);
50     };
51   }
52 }
53
54 #endif