Salome HOME
Use pyobj type in optimizer loop.
[modules/yacs.git] / src / engine_swig / pilot.i
1 // Copyright (C) 2006-2019  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 %define DOCSTRING
21 "All is needed to create and execute a calculation schema."
22 %enddef
23
24 %module(docstring=DOCSTRING) pilot
25
26 #ifndef SWIGIMPORTED
27 //work around SWIG bug #1863647
28 #if SWIG_VERSION >= 0x010336
29 #define SwigPyIterator pilot_PySwigIterator
30 #else
31 #define PySwigIterator pilot_PySwigIterator
32 #endif
33 #endif
34
35 %feature("autodoc", "1");
36
37 %include "engtypemaps.i"
38
39 #ifdef DOXYGEN_IS_OK
40 %include docengine.i
41 #endif
42
43 %{
44 #include "Any.hxx"
45 #include "TypeCode.hxx"
46 #include "ComponentDefinition.hxx"
47 #include "Visitor.hxx"
48 #include "VisitorSaveSchema.hxx"
49 #include "VisitorSaveState.hxx"
50 #include "LinkInfo.hxx"
51 #include "Catalog.hxx"
52 #include "Executor.hxx"
53 #include "ExecutorSwig.hxx"
54 #include "Dispatcher.hxx"
55 #include "Container.hxx"
56 #include "HomogeneousPoolContainer.hxx"
57 #include "Logger.hxx"
58 #include "DeploymentTree.hxx"
59 #include "ComponentInstance.hxx"
60 #include "DataNode.hxx"
61 #include "PlayGround.hxx"
62 #include "SetOfPoints.hxx"
63 #include "PointVisitor.hxx"
64 #include "ForkBlocPoint.hxx"
65 #include "LinkedBlocPoint.hxx"
66 #include "NotSimpleCasePoint.hxx"
67 #include "ElementaryPoint.hxx"
68 #include "ObserverAsPlugin.hxx"
69 #include "InGate.hxx"
70   
71 using namespace YACS::ENGINE;
72
73 %}
74
75 %init
76 %{
77   // init section
78 #ifdef OMNIORB
79   PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
80   if (!omnipy)
81   {
82     PyErr_SetString(PyExc_ImportError,(char*)"Cannot import _omnipy");
83     return NULL;
84   }
85   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
86   api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
87   Py_DECREF(pyapi);
88 #endif
89 %}
90
91 %ignore YACS::ENGINE::Any::operator[];
92 %ignore YACS::ENGINE::TypeCode::operator=;
93 %ignore YACS::ENGINE::DeploymentTree::operator=;
94 %ignore operator<<;
95 %ignore YACS::ENGINE::Runtime::_tc_double;
96 %ignore YACS::ENGINE::Runtime::_tc_int;
97 %ignore YACS::ENGINE::Runtime::_tc_bool;
98 %ignore YACS::ENGINE::Runtime::_tc_string;
99 %ignore YACS::ENGINE::Runtime::_tc_file;
100 %rename(StateLoader) YACS::ENGINE::StateLoader; // to suppress a 503 warning
101 %rename(NbDoneLoader) YACS::ENGINE::NbDoneLoader; // to suppress a 503 warning
102 %rename(getRuntime) YACS::ENGINE::getRuntime; // to suppress a 503 warning
103 %rename(_from) YACS::ENGINE::DataLinkInfo::from ; // to suppress a 314 warning
104 %rename(_from) YACS::ENGINE::StreamLinkInfo::from ; // to suppress a 314 warning
105
106 /*
107  * Template section
108  */
109 %template()              std::pair<std::string, YACS::ENGINE::TypeCode *>;
110 %template()              std::pair<std::string, YACS::ENGINE::Node *>;
111 %template()              std::pair<std::string, YACS::ENGINE::InlineNode *>;
112 %template()              std::pair<std::string, YACS::ENGINE::ServiceNode *>;
113 %template()              std::pair<std::string, YACS::ENGINE::Container *>;
114 %template()              std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
115 %template()              std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
116 %template()              std::pair< std::string, int >;
117 %template()              std::pair< YACS::ENGINE::InGate *, bool>;
118 %template(ItPy3TC)       IteratorPy3<YACS::ENGINE::TypeCode *>;
119 //%template(TCmap)         std::map<std::string, YACS::ENGINE::TypeCode *>;
120 REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
121 %template(NODEmap)       std::map<std::string, YACS::ENGINE::Node *>;
122 %template(INODEmap)      std::map<std::string, YACS::ENGINE::InlineNode *>;
123 %template(SNODEmap)      std::map<std::string, YACS::ENGINE::ServiceNode *>;
124 //%template(CONTAINmap)    std::map<std::string, YACS::ENGINE::Container *>;
125 %template(ItPy3Cont)     IteratorPy3<YACS::ENGINE::Container * >;
126 REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
127 %template(strvec)        std::vector<std::string>;
128 %template(uivec)         std::vector<unsigned int>;
129 %template(ivec)          std::vector<int>;
130 %template(linksvec)      std::vector< std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *> >;
131 %template(linkvec)       std::vector< std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *> >;
132 %template(instreamlist)  std::list<YACS::ENGINE::InputDataStreamPort *>;
133 %template(outstreamlist) std::list<YACS::ENGINE::OutputDataStreamPort *>;
134 %template(vpsi)          std::vector< std::pair< std::string, int > >;
135           
136 %template()              std::pair<std::string, YACS::ENGINE::CatalogLoader *>;
137 %template(loadermap)     std::map<std::string,YACS::ENGINE::CatalogLoader *>;
138 %template()              std::pair<std::string, YACS::ENGINE::ComposedNode *>;
139 %template(composedmap)   std::map<std::string,YACS::ENGINE::ComposedNode *>;
140 %template()              std::pair<std::string, YACS::ENGINE::ComponentDefinition *>;
141 %template(compomap)      std::map<std::string, YACS::ENGINE::ComponentDefinition *>;
142 %template()              std::pair<std::string, std::string>;
143 %template(propmap)       std::map<std::string, std::string>;
144 %template(ItPy3Comp)     IteratorPy3<YACS::ENGINE::ComponentInstance *>;
145 %template(listpairingatebool) std::list< std::pair< YACS::ENGINE::InGate *, bool> >;
146
147 REFCOUNT_TEMPLATE(CompoInstmap,YACS::ENGINE::ComponentInstance)
148
149 %include "exception.i"
150
151 /*
152  * End of Template section
153  */
154
155 %typemap(out) Container *
156 {
157   $result=convertContainer($1,$owner);
158 }
159
160 %typemap(out) YACS::ENGINE::Container *
161 {
162   $result=convertContainer($1,$owner);
163 }
164
165 /*
166  * Ownership section
167  */
168 //Take ownership : it is not the default (constructor) as it is a factory
169 %newobject *::createProc;
170 %newobject *::createScriptNode;
171 %newobject *::createFuncNode;
172 %newobject *::createRefNode;
173 %newobject *::createCompoNode;
174 %newobject *::createSInlineNode;
175 %newobject *::createInDataNode;
176 %newobject *::createOutDataNode;
177 %newobject *::createBloc;
178 %newobject *::createForLoop;
179 %newobject *::createForEachLoop;
180 %newobject *::createWhileLoop;
181 %newobject *::createSwitch;
182 %newobject *::loadCatalog;
183 %newobject *::createComponentInstance;
184 %newobject *::createContainer;
185
186
187 %newobject *::createInputPort;
188 %newobject *::createOutputPort;
189 %newobject *::createInputDataStreamPort;
190 %newobject *::createOutputDataStreamPort;
191 %newobject *::clone;
192 %newobject *::cloneAlways;
193 %newobject *::cloneWithoutCompAndContDeepCpy;
194 %newobject *::New;
195
196 //Take ownership : transfer it from C++ (has to be completed)
197 %newobject YACS::ENGINE::Loop::edRemoveNode;
198 %newobject YACS::ENGINE::Switch::edReleaseDefaultNode;
199 %newobject YACS::ENGINE::Switch::edReleaseCase;
200 %newobject YACS::ENGINE::DynParaLoop::edRemoveNode;
201 %newobject YACS::ENGINE::DynParaLoop::edRemoveInitNode;
202 //No other way to do ??
203 %feature("pythonappend") YACS::ENGINE::Bloc::edRemoveChild(Node *node)%{
204         args[1].thisown=1
205 %}
206
207 %newobject *::createSequenceTc;
208 %newobject *::createInterfaceTc;
209 %newobject *::createStructTc;
210 %newobject *::createType;
211
212 %newobject YACS::ENGINE::SequenceAny::removeUnsetItemsFromThis;
213
214 %newobject YACS::ENGINE::TypeCode::interfaceTc;
215 %newobject YACS::ENGINE::TypeCode::sequenceTc;
216 %newobject YACS::ENGINE::TypeCode::structTc;
217
218 /*
219  * End of ownership section
220  */
221
222
223 %include <define.hxx>
224 %include <YACSBasesExport.hxx>
225 %include <Exception.hxx>
226 %include <YACSlibEngineExport.hxx>
227 %include <ConversionException.hxx>
228 %include <Runtime.hxx>
229 %include <PropertyInterface.hxx>
230
231 PYEXCEPTION(YACS::ENGINE::Executor::RunW)
232 PYEXCEPTION(YACS::ENGINE::Executor::RunB)
233 PYEXCEPTION(YACS::ENGINE::Executor::setExecMode)
234 PYEXCEPTION(YACS::ENGINE::Executor::resumeCurrentBreakPoint)
235 PYEXCEPTION(YACS::ENGINE::Executor::stopExecution)
236 PYEXCEPTION(YACS::ENGINE::Executor::waitPause)
237 PYEXCEPTION(YACS::ENGINE::ComponentInstance::load)
238
239 %include <Executor.hxx>
240
241 EXCEPTION(YACS::ENGINE::ExecutorSwig::RunPy)
242 EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
243 %include <ExecutorSwig.hxx>
244
245 %include <RefCounter.hxx>
246
247 %feature("unref") YACS::ENGINE::Any "$this->decrRef();"
248 %include <Any.hxx>
249
250 %ignore YACS::ENGINE::TypeCode::getOrBuildAnyFromZippedData;
251 %include <TypeCode.hxx>
252
253 %include <Scheduler.hxx>
254 %include <Task.hxx>
255 %include <Dispatcher.hxx>
256 %include <DeploymentTree.hxx>
257 %include <Port.hxx>
258 %extend YACS::ENGINE::Port
259 {
260   /* __cmp__ does not exist in Python 3 */
261   int  __lt__(Port* other)
262     {
263       if(self==other)
264         return 0;
265       else 
266         return 1;
267     }
268   int  __gt__(Port* other)
269     {
270       if(self==other)
271         return 0;
272       else 
273         return 1;
274     }
275   int __ne__(Port* other)
276     {
277       if(self==other)
278         return 0;
279       else 
280         return 1;
281     }
282   int __eq__(Port* other)
283     {
284       if(self==other)
285         return 0;
286       else 
287         return 1;
288     }
289   int __le__(Port* other)
290     {
291       if(self==other)
292         return 0;
293       else 
294         return 1;
295     }
296   int __ge__(Port* other)
297     {
298       if(self==other)
299         return 0;
300       else 
301         return 1;
302     }
303   
304   long ptr()
305     {
306       return (long)self;
307     }
308 }
309 %include <DataPort.hxx>
310 %include <InPort.hxx>
311 %include <OutPort.hxx>
312 %include <InGate.hxx>
313 %include <OutGate.hxx>
314 %include <DataFlowPort.hxx>
315 %include <DataStreamPort.hxx>
316
317 %include <LinkInfo.hxx>
318 %include <Logger.hxx>
319
320 %include <ComponentInstance.hxx>
321 %include <Container.hxx>
322 %include <HomogeneousPoolContainer.hxx>
323 %include <InputPort.hxx>
324 %extend YACS::ENGINE::InputPort
325 {
326   void edInitXML(const char * s)
327     {
328       self->edInit("XML",s);
329     }
330   void edInitPy(PyObject* ob)
331     {
332       self->edInit("Python",ob);
333     }
334 }
335 %include <InPropertyPort.hxx>
336 %extend YACS::ENGINE::InPropertyPort
337 {
338   void edInitXML(const char * s)
339     {
340       self->edInit("XML",s);
341     }
342   void edInitPy(PyObject* ob)
343     {
344       self->edInit("Python",ob);
345     }
346 }
347
348 %template(edInitInt)       YACS::ENGINE::InputPort::edInit<int>;
349 %template(edInitBool)      YACS::ENGINE::InputPort::edInit<bool>;
350 %template(edInitString)    YACS::ENGINE::InputPort::edInit<std::string>;
351 %template(edInitDbl)       YACS::ENGINE::InputPort::edInit<double>;
352
353 %include <AnyInputPort.hxx>
354 %include <ConditionInputPort.hxx>
355 %include <OutputPort.hxx>
356 %include <AnyOutputPort.hxx>
357 %include <InputDataStreamPort.hxx>
358 %include <OutputDataStreamPort.hxx>
359 %include <DataPort.hxx>
360
361 %include <Node.hxx>
362 %extend YACS::ENGINE::Node 
363 {
364   /* __cmp__ does not exist in Python 3 */
365   int  __lt__(Node* other)
366     {
367       if(self==other)
368         return 0;
369       else 
370         return 1;
371     }
372   int  __gt__(Node* other)
373     {
374       if(self==other)
375         return 0;
376       else 
377         return 1;
378     }
379   int __ne__(Node* other)
380     {
381       if(self==other)
382         return 0;
383       else 
384         return 1;
385     }
386   int __eq__(Node* other)
387     {
388       if(self==other)
389         return 0;
390       else 
391         return 1;
392     }
393   int __le__(Node* other)
394     {
395       if(self==other)
396         return 0;
397       else 
398         return 1;
399     }
400   int __ge__(Node* other)
401     {
402       if(self==other)
403         return 0;
404       else 
405         return 1;
406     }
407
408   long ptr()
409     {
410           return (long)self;
411     }
412 }
413 %include <ComplexWeight.hxx>
414 %include <ElementaryNode.hxx>
415 %include <InlineNode.hxx>
416 %include <ServiceNode.hxx>
417 %include <ServiceInlineNode.hxx>
418 %include <ServerNode.hxx>
419 %include <DataNode.hxx>
420
421 %include <ComposedNode.hxx>
422 %include <StaticDefinedComposedNode.hxx>
423 %include <Bloc.hxx>
424 %include <Proc.hxx>
425
426 %include <Loop.hxx>
427 %include <ForLoop.hxx>
428 %include <DynParaLoop.hxx>
429 %include <WhileLoop.hxx>
430 %include <ForEachLoop.hxx>
431 %include <OptimizerLoop.hxx>
432 %include <Switch.hxx>
433 %include <Visitor.hxx>
434 %include <VisitorSaveSchema.hxx>
435 %include <ComponentDefinition.hxx>
436 %include <Catalog.hxx>
437 %include <Pool.hxx>
438
439 %include <AlternateThread.hxx>
440 %include <AlternateThreadPT.hxx>
441
442 // Ignore class OptimizerAlgASync to avoid confusion with class
443 // OptimizerAlgASync in module SALOMERuntime
444 %ignore YACS::ENGINE::OptimizerAlgASync;
445 %include <OptimizerAlg.hxx>
446 %include "PlayGround.i"
447
448 %extend YACS::ENGINE::ConditionInputPort
449 {
450   bool getPyObj()
451   {
452     return self->getValue();
453   }
454 }
455 %extend YACS::ENGINE::Any
456 {
457   PyObject *getBytes()
458   {
459     YACS::ENGINE::AtomAny *self2(dynamic_cast<YACS::ENGINE::AtomAny *>(self));
460     if(!self2)
461       throw YACS::Exception("getBytes : self is not an AtomAny !");
462     std::size_t len(0);
463     const char *pt(self2->getBytesValue(len));
464     return PyBytes_FromStringAndSize(pt,len);
465   }
466 }
467
468 %extend YACS::ENGINE::AnyInputPort
469 {
470   PyObject * getPyObj()
471   {
472     return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
473   }
474 }
475
476 %extend YACS::ENGINE::AnyOutputPort
477 {
478   PyObject * getPyObj()
479   {
480     return (PyObject *)getRuntime()->convertNeutral(self->edGetType(),self->getValue());
481   }
482 }
483
484 %extend YACS::ENGINE::Any
485 {
486   PyObject *getPyObj()
487   {
488     return (PyObject *)getRuntime()->convertNeutral(const_cast<YACS::ENGINE::TypeCode *>(self->getType()),self);
489   }
490 }
491
492 %newobject YACS::ENGINE::SequenceAny::__getitem__;
493 %extend YACS::ENGINE::SequenceAny
494 {
495   Any* __getitem__(int i)
496   {
497     if (i < self->size())
498       {
499         AnyPtr a=(*self)[i];
500         a->incrRef();
501         return a;
502       }
503     else
504       throw std::length_error("index too large");
505   }
506 }
507
508 %newobject YACS::ENGINE::StructAny::__getitem__;
509 %extend YACS::ENGINE::StructAny
510 {
511   Any* __getitem__(const char * key)
512   {
513     AnyPtr a=(*self)[key];
514     a->incrRef();
515     return a;
516   }
517 }
518
519 %extend YACS::ENGINE::ForEachLoop
520 {
521   PyObject *getPassedResults(Executor *execut) const
522   {
523     std::vector<SequenceAny *> ret1;
524     std::vector<std::string> ret2;
525     std::vector<unsigned int> ret0(self->getPassedResults(execut,ret1,ret2));
526     PyObject *ret(PyTuple_New(3));
527     // param 0
528     PyObject *ret0Py(PyList_New(ret0.size()));
529     for(std::size_t i=0;i<ret0.size();i++)
530       PyList_SetItem(ret0Py,i,PyLong_FromLong(ret0[i]));
531     PyTuple_SetItem(ret,0,ret0Py);
532     // param 1
533     PyObject *ret1Py(PyList_New(ret1.size()));
534     for(std::size_t i=0;i<ret1.size();i++)
535       PyList_SetItem(ret1Py,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret1[i]),SWIGTYPE_p_YACS__ENGINE__SequenceAny, SWIG_POINTER_OWN | 0 ));
536     PyTuple_SetItem(ret,1,ret1Py);
537     // param 2
538     PyObject *ret2Py(PyList_New(ret2.size()));
539     for(std::size_t i=0;i<ret2.size();i++)
540       PyList_SetItem(ret2Py,i,PyUnicode_FromString(ret2[i].c_str()));
541     PyTuple_SetItem(ret,2,ret2Py);
542     return ret;
543   }
544
545   void assignPassedResults(const std::vector<unsigned int>& passedIds, PyObject *passedOutputs, const std::vector<std::string>& nameOfOutputs)
546   {
547     std::vector<SequenceAny *> passedOutputsCpp;
548     convertFromPyObjVectorOfObj<YACS::ENGINE::SequenceAny *>(passedOutputs,SWIGTYPE_p_YACS__ENGINE__SequenceAny,"SequenceAny",passedOutputsCpp);
549     self->assignPassedResults(passedIds,passedOutputsCpp,nameOfOutputs);
550   }
551 }
552
553 namespace YACS
554 {
555   namespace ENGINE
556   {
557     class AbstractPoint
558     {
559     protected:
560       virtual ~AbstractPoint();
561       AbstractPoint();
562       AbstractPoint(const AbstractPoint&);
563     };
564
565     class ElementaryPoint : public AbstractPoint
566     {
567     public:
568       Node *getFirstNode();
569     private:
570       ~ElementaryPoint();
571       ElementaryPoint();
572       ElementaryPoint(const ElementaryPoint&);
573     };
574
575     class BlocPoint : public AbstractPoint
576     {
577     protected:
578       ~BlocPoint();
579       BlocPoint();
580       BlocPoint(const BlocPoint&);
581     };
582
583     class LinkedBlocPoint : public BlocPoint
584     {
585     private:
586       ~LinkedBlocPoint();
587       LinkedBlocPoint();
588       LinkedBlocPoint(const LinkedBlocPoint&);
589     };
590
591     class ForkBlocPoint : public BlocPoint
592     {
593     private:
594       ~ForkBlocPoint();
595       ForkBlocPoint();
596       ForkBlocPoint(const ForkBlocPoint&);
597     };
598
599     class NotSimpleCasePoint : public BlocPoint
600     {
601     private:
602       ~NotSimpleCasePoint();
603       NotSimpleCasePoint();
604       NotSimpleCasePoint(const NotSimpleCasePoint&);
605     };
606     
607     class SetOfPoints
608     {
609     public:
610       SetOfPoints(const std::list<Node *>& nodes);
611       ~SetOfPoints();
612       void simplify();
613       std::string getRepr() const;
614       %extend
615       {
616       void accept(PyObject *pv)
617       {
618         class MyPointVisitor : public YACS::ENGINE::PointVisitor
619         {
620         public:
621           MyPointVisitor(PyObject *py):_py(py) { }
622           void beginForkBlocPoint(ForkBlocPoint *pt)
623           {
624             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ForkBlocPoint,0));
625             PyObject *meth(PyString_FromString("beginForkBlocPoint"));
626             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
627             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
628           }
629           void endForkBlocPoint(ForkBlocPoint *pt)
630           {
631             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ForkBlocPoint,0));
632             PyObject *meth(PyString_FromString("endForkBlocPoint"));
633             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
634             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
635           }
636           void beginLinkedBlocPoint(LinkedBlocPoint *pt)
637           {
638             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__LinkedBlocPoint,0));
639             PyObject *meth(PyString_FromString("beginLinkedBlocPoint"));
640             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
641             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
642           }
643           void endLinkedBlocPoint(LinkedBlocPoint *pt)
644           {
645             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__LinkedBlocPoint,0));
646             PyObject *meth(PyString_FromString("endLinkedBlocPoint"));
647             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
648             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
649           }
650           void beginElementaryPoint(ElementaryPoint *pt)
651           {
652             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ElementaryPoint,0));//$descriptor(YACS::ENGINE::ElementaryPoint *)
653             PyObject *meth(PyString_FromString("beginElementaryPoint"));
654             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
655             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
656           }
657           void endElementaryPoint(ElementaryPoint *pt)
658           {
659             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__ElementaryPoint,0));
660             PyObject *meth(PyString_FromString("endElementaryPoint"));
661             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
662             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
663           }
664           void beginNotSimpleCasePoint(NotSimpleCasePoint *pt)
665           {
666             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__NotSimpleCasePoint,0));//$descriptor(YACS::ENGINE::NotSimpleCasePoint *)
667             PyObject *meth(PyString_FromString("beginNotSimpleCasePoint"));
668             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
669             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
670           }
671           void endNotSimpleCasePoint(NotSimpleCasePoint *pt)
672           {
673             PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__NotSimpleCasePoint,0));
674             PyObject *meth(PyString_FromString("endNotSimpleCasePoint"));
675             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
676             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
677           }
678         private:
679           PyObject *_py;
680         };
681         MyPointVisitor mpv(pv);
682         self->accept(&mpv);
683         }
684       }
685     };
686   }
687 }
688
689 %rename(LoadObserversPluginIfAny) LoadObserversPluginIfAnySwig;
690 %rename(UnLoadObserversPluginIfAny) UnLoadObserversPluginIfAnySwig;
691                                   
692 %inline{
693   void LoadObserversPluginIfAnySwig(YACS::ENGINE::ComposedNode *rootNode, YACS::ENGINE::ExecutorSwig *executor)
694   {
695     YACS::ENGINE::LoadObserversPluginIfAny(rootNode,executor);
696   }
697
698   void UnLoadObserversPluginIfAnySwig()
699   {
700     YACS::ENGINE::UnLoadObserversPluginIfAny();
701   }
702
703   PyObject *ToBase64Swig(PyObject *bytes)
704   {
705     char *pt = nullptr;
706     Py_ssize_t length=0;
707     PyBytes_AsStringAndSize(bytes,&pt,&length);
708     std::string input(pt,length);
709     std::string ret(YACS::ENGINE::ToBase64(input));
710     return PyBytes_FromStringAndSize(ret.c_str(),ret.size());
711   }
712
713   PyObject *FromBase64Swig(PyObject *base64Str)
714   {
715     char *pt = nullptr;
716     Py_ssize_t length=0;
717     PyBytes_AsStringAndSize(base64Str,&pt,&length);
718     std::string input(pt,length);
719     std::string ret(YACS::ENGINE::FromBase64(input));
720     return PyBytes_FromStringAndSize(ret.c_str(),ret.size());
721   }
722 }