class BlocPoint;
class ComposedNode;
class ForkBlocPoint;
+ class PointVisitor;
class LinkedBlocPoint;
class YACSLIBENGINE_EXPORT AbstractPoint
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();
public:
static bool IsGatherB4Ext(Node *node);
return ret;
}
+void BagPoint::accept(PointVisitor *pv)
+{
+ if(_nodes.size()!=1)
+ throw YACS::Exception("BagPoint::accept : simplification has failed !");
+ AbstractPoint *ret(*_nodes.begin());
+ if(!ret)
+ throw YACS::Exception("BagPoint::accept : Ooops !");
+ ret->accept(pv);
+}
+
Node *BagPoint::getFirstNode()
{
return getUnique()->getFirstNode();
void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const;
std::string getRepr() const;
AbstractPoint *getUniqueAndReleaseIt();
+ void accept(PointVisitor *pv) override;
public:
int size() const { return (int)_nodes.size(); }
void replaceInMe(BlocPoint *aSet);
//
#include "ElementaryPoint.hxx"
+#include "PointVisitor.hxx"
#include "Node.hxx"
using namespace YACS::ENGINE;
{
return _node->getName();
}
+
+void ElementaryPoint::accept(PointVisitor *pv)
+{
+ pv->beginElementaryPoint(this);
+ pv->endElementaryPoint(this);
+}
void getWeightRegardingDPL(ComplexWeight *weight);
void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const;
std::string getRepr() const;
+ void accept(PointVisitor *pv) override;
virtual ~ElementaryPoint();
};
}
//
#include "ForkBlocPoint.hxx"
+#include "PointVisitor.hxx"
#include "Exception.hxx"
#include <algorithm>
ret+="]";
return ret;
}
+
+void ForkBlocPoint::accept(PointVisitor *pv)
+{
+ pv->beginForkBlocPoint(this);
+ for(auto it:_nodes)
+ it->accept(pv);
+ pv->endForkBlocPoint(this);
+}
void getWeightRegardingDPL(ComplexWeight *weight);
void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const;
std::string getRepr() const;
+ void accept(PointVisitor *pv) override;
virtual ~ForkBlocPoint();
};
}
//
#include "LinkedBlocPoint.hxx"
+#include "PointVisitor.hxx"
#include "Exception.hxx"
using namespace YACS::ENGINE;
return ret;
}
+void LinkedBlocPoint::accept(PointVisitor *pv)
+{
+ pv->beginLinkedBlocPoint(this);
+ for(auto it:_nodes)
+ it->accept(pv);
+ pv->endLinkedBlocPoint(this);
+}
+
LinkedBlocPoint::~LinkedBlocPoint()
{
}
void getWeightRegardingDPL(ComplexWeight *weight);
void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const;
std::string getRepr() const;
+ void accept(PointVisitor *pv) override;
virtual ~LinkedBlocPoint();
};
}
--- /dev/null
+// Copyright (C) 2015-2016 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "YACSlibEngineExport.hxx"
+
+namespace YACS
+{
+ namespace ENGINE
+ {
+ class ElementaryPoint;
+ class LinkedBlocPoint;
+ class ForkBlocPoint;
+
+ class YACSLIBENGINE_EXPORT PointVisitor
+ {
+ public:
+ virtual void beginForkBlocPoint(ForkBlocPoint *pt) = 0;
+ virtual void endForkBlocPoint(ForkBlocPoint *pt) = 0;
+ virtual void beginLinkedBlocPoint(LinkedBlocPoint *pt) = 0;
+ virtual void endLinkedBlocPoint(LinkedBlocPoint *pt) = 0;
+ virtual void beginElementaryPoint(ElementaryPoint *pt) = 0;
+ virtual void endElementaryPoint(ElementaryPoint *pt) = 0;
+ };
+ }
+}
{
return _bp->getUniqueAndReleaseIt();
}
+
+void SetOfPoints::accept(PointVisitor *pv)
+{
+ _bp->accept(pv);
+}
#include "YACSlibEngineExport.hxx"
#include "PlayGround.hxx"
+#include "PointVisitor.hxx"
#include "AutoRefCnt.hxx"
#include <map>
void getWeightRegardingDPL(ComplexWeight *weight);
void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const;
AbstractPoint *getUniqueAndReleaseIt() const;
+ void accept(PointVisitor *pv);
private:
BagPoint *_bp;
};
#include "DataNode.hxx"
#include "PlayGround.hxx"
#include "SetOfPoints.hxx"
+#include "PointVisitor.hxx"
+#include "ForkBlocPoint.hxx"
+#include "LinkedBlocPoint.hxx"
+#include "ElementaryPoint.hxx"
using namespace YACS::ENGINE;
{
namespace ENGINE
{
+ class AbstractPoint
+ {
+ protected:
+ virtual ~AbstractPoint();
+ AbstractPoint();
+ AbstractPoint(const AbstractPoint&);
+ };
+
+ class ElementaryPoint : public AbstractPoint
+ {
+ public:
+ Node *getFirstNode();
+ private:
+ ~ElementaryPoint();
+ ElementaryPoint();
+ ElementaryPoint(const ElementaryPoint&);
+ };
+
+ class BlocPoint : public AbstractPoint
+ {
+ protected:
+ ~BlocPoint();
+ BlocPoint();
+ BlocPoint(const BlocPoint&);
+ };
+
+ class LinkedBlocPoint : public BlocPoint
+ {
+ private:
+ ~LinkedBlocPoint();
+ LinkedBlocPoint();
+ LinkedBlocPoint(const LinkedBlocPoint&);
+ };
+
+ class ForkBlocPoint : public BlocPoint
+ {
+ private:
+ ~ForkBlocPoint();
+ ForkBlocPoint();
+ ForkBlocPoint(const ForkBlocPoint&);
+ };
+
class SetOfPoints
{
public:
~SetOfPoints();
void simplify();
std::string getRepr() const;
+ %extend
+ {
+ void accept(PyObject *pv)
+ {
+ class MyPointVisitor : public YACS::ENGINE::PointVisitor
+ {
+ public:
+ MyPointVisitor(PyObject *py):_py(py) { }
+ void beginForkBlocPoint(ForkBlocPoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ForkBlocPoint,0));
+ PyObject *meth(PyString_FromString("beginForkBlocPoint"));
+ PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+ Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+ }
+ void endForkBlocPoint(ForkBlocPoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ForkBlocPoint,0));
+ PyObject *meth(PyString_FromString("endForkBlocPoint"));
+ PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+ Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+ }
+ void beginLinkedBlocPoint(LinkedBlocPoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__LinkedBlocPoint,0));
+ PyObject *meth(PyString_FromString("beginLinkedBlocPoint"));
+ PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+ Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+ }
+ void endLinkedBlocPoint(LinkedBlocPoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__LinkedBlocPoint,0));
+ PyObject *meth(PyString_FromString("endLinkedBlocPoint"));
+ PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+ Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+ }
+ void beginElementaryPoint(ElementaryPoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ElementaryPoint,0));//$descriptor(YACS::ENGINE::ElementaryPoint *)
+ PyObject *meth(PyString_FromString("beginElementaryPoint"));
+ PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+ Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+ }
+ void endElementaryPoint(ElementaryPoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ElementaryPoint,0));
+ PyObject *meth(PyString_FromString("endElementaryPoint"));
+ PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+ Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+ }
+ private:
+ PyObject *_py;
+ };
+ MyPointVisitor mpv(pv);
+ self->accept(&mpv);
+ }
+ }
};
}
}