Salome HOME
WIP
[modules/yacs.git] / src / engine / AbstractPoint.hxx
index 9a8d35afa9a783a4e040ef0ae55068c59f8b315a..5c0f54b0b9023eaa411ea71a14a5454a6acae416 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2015-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #define __ABSTRACTPOINT_HXX__
 
 #include "YACSlibEngineExport.hxx"
+#include "PlayGround.hxx"
+#include "AutoRefCnt.hxx"
 
+#include <map>
+#include <set>
 #include <list>
 #include <vector>
 #include <string>
+#include <memory>
 
 namespace YACS
 {
   namespace ENGINE
   {
     class Node;
+    class Bloc;
     class InGate;
     class OutGate;
     class BlocPoint;
+    class ComposedNode;
     class ForkBlocPoint;
+    class PointVisitor;
     class LinkedBlocPoint;
+    class NotSimpleCasePoint;
+    class ElementaryPoint;
     
     class YACSLIBENGINE_EXPORT AbstractPoint
     {
     public:
+      AbstractPoint() = default;
       AbstractPoint(AbstractPoint *father):_father(father) { }
       AbstractPoint *getFather() const { return _father; }
       AbstractPoint *getGodFather();
-      bool amIGod() { return getGodFather()==0; }
+      bool amIGod() { return getGodFather()==nullptr; }
       void setFather(AbstractPoint *father) { _father=father; }
       //
       bool isBegin();
@@ -51,19 +62,30 @@ namespace YACS
       bool isSimplyLinkedBeforeAfter(BlocPoint *sop);
       bool isSimplyLinkedAfterNullBefore(BlocPoint *sop);
       bool isSimplyLinkedBeforeNullAfter(BlocPoint *sop);
+      bool isNullBeforeNullAfter(BlocPoint *sop);
       //
       LinkedBlocPoint *tryAsLink(BlocPoint *sop);
       ForkBlocPoint *tryAsFork(BlocPoint *sop);
       ForkBlocPoint *tryAsForkBis(BlocPoint *sop);
       ForkBlocPoint *tryAsForkTer(BlocPoint *sop);
+      ForkBlocPoint *tryAsForkQuatro(BlocPoint *sop);
+      //void tryAsNotSimpleCase(BlocPoint *sop, std::list<AbstractPoint *>& nodes, bool& somethingDone);
+      static void TryAsNotSimpleCase(AbstractPoint *father, const std::vector<AbstractPoint *>& ptsToKill, std::list<AbstractPoint *>& nodes, bool& somethingDone);
+      //
+      virtual AbstractPoint *deepCopy(AbstractPoint *father) const = 0;
       //
       virtual Node *getFirstNode() = 0;
       virtual Node *getLastNode() = 0;
       virtual AbstractPoint *findPointWithNode(Node *node) = 0;
-      virtual bool contains(Node *node) = 0;
+      virtual bool contains(Node *node) const = 0;
+      virtual bool anyOf(const std::set<Node *>& nodes) const = 0;
       virtual int getNumberOfNodes() const = 0;
       virtual int getMaxLevelOfParallelism() const = 0;
+      virtual void getWeightRegardingDPL(ComplexWeight *weight) = 0;
+      virtual void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const = 0;
       virtual std::string getRepr() const = 0;
+      virtual void accept(PointVisitor *pv) = 0;
+      virtual AbstractPoint *expandNonSimpleCaseOn(NotSimpleCasePoint *pathologicalPt, const std::set<Node *>& uncatchedNodes) = 0;
       virtual ~AbstractPoint();
     public:
       static bool IsGatherB4Ext(Node *node);
@@ -79,8 +101,13 @@ namespace YACS
       static AbstractPoint *GetDirectSonOf(AbstractPoint *refFather, AbstractPoint *sonOrLittleSon);
       static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list<OutGate *>& outgs, AbstractPoint *&ret);
       static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list<InGate *>& ings, AbstractPoint *&ret);
+      static void FeedData(AbstractPoint *ptToBeRewired, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
+      static void FeedData(const std::list<AbstractPoint *>& ptsToBeRewired, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
+      static void Rewire(const std::vector<AbstractPoint *>& ptsToKill, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
+      static void UnRewire(std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > >& m);
+      static void Display(std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
     protected:
-      AbstractPoint *_father;
+      AbstractPoint *_father = nullptr;
     };
   }
 }