]> SALOME platform Git repositories - modules/yacs.git/blob - src/engine/AbstractPoint.hxx
Salome HOME
Visitor for AbstractPoint
[modules/yacs.git] / src / engine / AbstractPoint.hxx
1 // Copyright (C) 2015-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 __ABSTRACTPOINT_HXX__
21 #define __ABSTRACTPOINT_HXX__
22
23 #include "YACSlibEngineExport.hxx"
24 #include "PlayGround.hxx"
25 #include "AutoRefCnt.hxx"
26
27 #include <map>
28 #include <list>
29 #include <vector>
30 #include <string>
31
32 namespace YACS
33 {
34   namespace ENGINE
35   {
36     class Node;
37     class InGate;
38     class OutGate;
39     class BlocPoint;
40     class ComposedNode;
41     class ForkBlocPoint;
42     class PointVisitor;
43     class LinkedBlocPoint;
44     
45     class YACSLIBENGINE_EXPORT AbstractPoint
46     {
47     public:
48       AbstractPoint(AbstractPoint *father):_father(father) { }
49       AbstractPoint *getFather() const { return _father; }
50       AbstractPoint *getGodFather();
51       bool amIGod() { return getGodFather()==0; }
52       void setFather(AbstractPoint *father) { _father=father; }
53       //
54       bool isBegin();
55       bool isLast();
56       bool isSimplyLinkedBeforeAfter(BlocPoint *sop);
57       bool isSimplyLinkedAfterNullBefore(BlocPoint *sop);
58       bool isSimplyLinkedBeforeNullAfter(BlocPoint *sop);
59       //
60       LinkedBlocPoint *tryAsLink(BlocPoint *sop);
61       ForkBlocPoint *tryAsFork(BlocPoint *sop);
62       ForkBlocPoint *tryAsForkBis(BlocPoint *sop);
63       ForkBlocPoint *tryAsForkTer(BlocPoint *sop);
64       //
65       virtual Node *getFirstNode() = 0;
66       virtual Node *getLastNode() = 0;
67       virtual AbstractPoint *findPointWithNode(Node *node) = 0;
68       virtual bool contains(Node *node) = 0;
69       virtual int getNumberOfNodes() const = 0;
70       virtual int getMaxLevelOfParallelism() const = 0;
71       virtual void getWeightRegardingDPL(ComplexWeight *weight) = 0;
72       virtual void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const = 0;
73       virtual std::string getRepr() const = 0;
74       virtual void accept(PointVisitor *pv) = 0;
75       virtual ~AbstractPoint();
76     public:
77       static bool IsGatherB4Ext(Node *node);
78       bool isSimplyLinkedAfter(BlocPoint *sop, Node *node);
79       static bool IsSimplyLinkedAfterExt(Node *node);
80       static bool IsScatterAfterExt(Node *node);
81       bool isSimplyLinkedBefore(BlocPoint *sop, Node *node);
82       static bool IsSimplyLinkedBeforeExt(Node *node);
83       static bool IsNoLinksBefore(Node *node);
84       static bool IsNoLinksAfter(Node *node);
85       static Node *GetNodeB4(Node *node);
86       static Node *GetNodeAfter(Node *node);
87       static AbstractPoint *GetDirectSonOf(AbstractPoint *refFather, AbstractPoint *sonOrLittleSon);
88       static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list<OutGate *>& outgs, AbstractPoint *&ret);
89       static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list<InGate *>& ings, AbstractPoint *&ret);
90     protected:
91       AbstractPoint *_father;
92     };
93   }
94 }
95
96
97 #endif