-// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2006-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
#include "DeploymentTree.hxx"
#include "ComponentInstance.hxx"
#include "DataNode.hxx"
-
+#include "PlayGround.hxx"
+#include "SetOfPoints.hxx"
+#include "PointVisitor.hxx"
+#include "ForkBlocPoint.hxx"
+#include "LinkedBlocPoint.hxx"
+#include "NotSimpleCasePoint.hxx"
+#include "ElementaryPoint.hxx"
+#include "ObserverAsPlugin.hxx"
+#include "InGate.hxx"
+
using namespace YACS::ENGINE;
%}
%template() std::pair<std::string, YACS::ENGINE::Container *>;
%template() std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
%template() std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
+%template() std::pair< std::string, int >;
+%template() std::pair< YACS::ENGINE::InGate *, bool>;
+%template(ItPy3TC) IteratorPy3<YACS::ENGINE::TypeCode *>;
//%template(TCmap) std::map<std::string, YACS::ENGINE::TypeCode *>;
REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
%template(NODEmap) std::map<std::string, YACS::ENGINE::Node *>;
%template(INODEmap) std::map<std::string, YACS::ENGINE::InlineNode *>;
%template(SNODEmap) std::map<std::string, YACS::ENGINE::ServiceNode *>;
//%template(CONTAINmap) std::map<std::string, YACS::ENGINE::Container *>;
+%template(ItPy3Cont) IteratorPy3<YACS::ENGINE::Container * >;
REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
%template(strvec) std::vector<std::string>;
%template(uivec) std::vector<unsigned int>;
+%template(ivec) std::vector<int>;
%template(linksvec) std::vector< std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *> >;
%template(linkvec) std::vector< std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *> >;
%template(instreamlist) std::list<YACS::ENGINE::InputDataStreamPort *>;
%template(outstreamlist) std::list<YACS::ENGINE::OutputDataStreamPort *>;
-
+%template(vpsi) std::vector< std::pair< std::string, int > >;
+
%template() std::pair<std::string, YACS::ENGINE::CatalogLoader *>;
%template(loadermap) std::map<std::string,YACS::ENGINE::CatalogLoader *>;
%template() std::pair<std::string, YACS::ENGINE::ComposedNode *>;
%template(compomap) std::map<std::string, YACS::ENGINE::ComponentDefinition *>;
%template() std::pair<std::string, std::string>;
%template(propmap) std::map<std::string, std::string>;
+%template(ItPy3Comp) IteratorPy3<YACS::ENGINE::ComponentInstance *>;
+%template(listpairingatebool) std::list< std::pair< YACS::ENGINE::InGate *, bool> >;
REFCOUNT_TEMPLATE(CompoInstmap,YACS::ENGINE::ComponentInstance)
+%include "exception.i"
+
/*
* End of Template section
*/
%include <Port.hxx>
%extend YACS::ENGINE::Port
{
- int __cmp__(Port* other)
+ /* __cmp__ does not exist in Python 3 */
+ int __lt__(Port* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __gt__(Port* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __ne__(Port* other)
{
if(self==other)
return 0;
else
return 1;
}
+ int __eq__(Port* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __le__(Port* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __ge__(Port* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+
long ptr()
{
return (long)self;
%include <Node.hxx>
%extend YACS::ENGINE::Node
{
- int __cmp__(Node* other)
+ /* __cmp__ does not exist in Python 3 */
+ int __lt__(Node* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __gt__(Node* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __ne__(Node* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __eq__(Node* other)
{
if(self==other)
return 0;
else
return 1;
}
+ int __le__(Node* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+ int __ge__(Node* other)
+ {
+ if(self==other)
+ return 0;
+ else
+ return 1;
+ }
+
long ptr()
{
return (long)self;
}
}
-
+%include <ComplexWeight.hxx>
%include <ElementaryNode.hxx>
%include <InlineNode.hxx>
%include <ServiceNode.hxx>
// OptimizerAlgASync in module SALOMERuntime
%ignore YACS::ENGINE::OptimizerAlgASync;
%include <OptimizerAlg.hxx>
+%include "PlayGround.i"
%extend YACS::ENGINE::ConditionInputPort
{
return self->getValue();
}
}
+%extend YACS::ENGINE::Any
+{
+ PyObject *getBytes()
+ {
+ YACS::ENGINE::AtomAny *self2(dynamic_cast<YACS::ENGINE::AtomAny *>(self));
+ if(!self2)
+ throw YACS::Exception("getBytes : self is not an AtomAny !");
+ std::size_t len(0);
+ const char *pt(self2->getBytesValue(len));
+ return PyBytes_FromStringAndSize(pt,len);
+ }
+}
%extend YACS::ENGINE::AnyInputPort
{
// param 2
PyObject *ret2Py(PyList_New(ret2.size()));
for(std::size_t i=0;i<ret2.size();i++)
- PyList_SetItem(ret2Py,i,PyBytes_FromString(ret2[i].c_str()));
+ PyList_SetItem(ret2Py,i,PyUnicode_FromString(ret2[i].c_str()));
PyTuple_SetItem(ret,2,ret2Py);
return ret;
}
self->assignPassedResults(passedIds,passedOutputsCpp,nameOfOutputs);
}
}
+
+namespace YACS
+{
+ 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 NotSimpleCasePoint : public BlocPoint
+ {
+ private:
+ ~NotSimpleCasePoint();
+ NotSimpleCasePoint();
+ NotSimpleCasePoint(const NotSimpleCasePoint&);
+ };
+
+ class SetOfPoints
+ {
+ public:
+ SetOfPoints(const std::list<Node *>& nodes);
+ ~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);
+ }
+ void beginNotSimpleCasePoint(NotSimpleCasePoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__NotSimpleCasePoint,0));//$descriptor(YACS::ENGINE::NotSimpleCasePoint *)
+ PyObject *meth(PyString_FromString("beginNotSimpleCasePoint"));
+ PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+ Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+ }
+ void endNotSimpleCasePoint(NotSimpleCasePoint *pt)
+ {
+ PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__NotSimpleCasePoint,0));
+ PyObject *meth(PyString_FromString("endNotSimpleCasePoint"));
+ 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);
+ }
+ }
+ };
+ }
+}
+
+%rename(LoadObserversPluginIfAny) LoadObserversPluginIfAnySwig;
+%rename(UnLoadObserversPluginIfAny) UnLoadObserversPluginIfAnySwig;
+
+%inline{
+ void LoadObserversPluginIfAnySwig(YACS::ENGINE::ComposedNode *rootNode, YACS::ENGINE::ExecutorSwig *executor)
+ {
+ YACS::ENGINE::LoadObserversPluginIfAny(rootNode,executor);
+ }
+
+ void UnLoadObserversPluginIfAnySwig()
+ {
+ YACS::ENGINE::UnLoadObserversPluginIfAny();
+ }
+
+ PyObject *ToBase64Swig(PyObject *bytes)
+ {
+ char *pt = nullptr;
+ Py_ssize_t length=0;
+ PyBytes_AsStringAndSize(bytes,&pt,&length);
+ std::string input(pt,length);
+ std::string ret(YACS::ENGINE::ToBase64(input));
+ return PyBytes_FromStringAndSize(ret.c_str(),ret.size());
+ }
+
+ PyObject *FromBase64Swig(PyObject *base64Str)
+ {
+ char *pt = nullptr;
+ Py_ssize_t length=0;
+ PyBytes_AsStringAndSize(base64Str,&pt,&length);
+ std::string input(pt,length);
+ std::string ret(YACS::ENGINE::FromBase64(input));
+ return PyBytes_FromStringAndSize(ret.c_str(),ret.size());
+ }
+}