1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
%module(directors="1") RobotRaconteurPython
#pragma SWIG nowarn=473
%include "CommonInclude.i"
%include "PythonNondynamic.i"
%include "PythonDocstring.i"
//%include "pyabc.i"
%{
#include "PythonTypeSupport.h"
%}
%define RR_PUBLIC_OVERRIDE_METHOD(a)
%enddef
%define RR_PUBLIC_VIRTUAL_METHOD(a)
%enddef
%define RR_PROPERTY(a)
%rename(_Get ## a) Get ## a; %rename(_Set ## a) Set ## a;
%enddef
%define RR_MAKE_METHOD_PRIVATE(a)
%rename(_ ## a) a;
%enddef
%define RR_RELEASE_GIL()
//RR_Py_Exception_GIL()
// Use SWIG -threads option instead of manually releasing GIL
%thread;
RR_Py_Exception()
%enddef
%define RR_KEEP_GIL()
%nothread;
RR_Py_Exception()
%enddef
%define RR_DIRECTOR_SHARED_PTR_RETURN_DEFAULT(TYPE)
%enddef
%define RR_DIRECTOR_SHARED_PTR_RETURN_RESET(TYPE)
%enddef
%init
{
PyDateTime_IMPORT;
RobotRaconteur::PythonTypeSupport_Init();
RobotRaconteur::RobotRaconteurNode::s()->SetDynamicServiceFactory(RR_MAKE_SHARED<RobotRaconteur::WrappedDynamicServiceFactory>());
RobotRaconteur::RobotRaconteurNode::s()->SetThreadPoolFactory(RR_MAKE_SHARED<RobotRaconteur::PythonThreadPoolFactory>());
//RobotRaconteur::RobotRaconteurNode::s()->UnregisterServiceType("RobotRaconteurServiceIndex");
//RobotRaconteur::RobotRaconteurNode::s()->RegisterServiceType(RR_MAKE_SHARED<RobotRaconteur::WrappedServiceFactory>(RR_MAKE_SHARED<RobotRaconteurServiceIndex::RobotRaconteurServiceIndexFactory>()->DefString()));
}
%pythonbegin %{
from __future__ import absolute_import
from . import classproperty
%}
%include "rr_intrusive_ptr.i"
%define %rr_intrusive_ptr( TYPE )
%intrusive_ptr( TYPE )
%enddef
%include "PythonTypemaps.i"
%include "PythonExceptionTypemaps.i"
%rename("%(regex:/^(RobotRaconteur_LogLevel)_(.*)/LogLevel_\\2/)s", %$isenumitem) "";
%rename("%(regex:/^(RobotRaconteur_LogComponent)_(.*)/LogComponent_\\2/)s", %$isenumitem) "";
%include "RobotRaconteurConstants.i"
%include "DataTypes.i"
%include "NodeIDPython.i"
%include "MessagePython.i"
%include "AsyncHandlerDirector.i"
%include "ServiceDefinitionPython.i"
%include "Transport.i"
#ifndef ROBOTRACONTEUR_NO_TCP_TRANSPORT
%include "TcpTransportPython.i"
#endif
#ifndef ROBOTRACONTEUR_NO_LOCAL_TRANSPORT
%include "LocalTransportPython.i"
#endif
#ifndef ROBOTRACONTEUR_NO_HARDWARE_TRANSPORT
%include "HardwareTransportPython.i"
#endif
%include "IntraTransport.i"
#ifdef ROBOTRACONTEUR_EMSCRIPTEN
%include "BrowserWebSocketTransportPython.i"
#endif
%include "TimerPython.i"
%include "TimeSpecPython.i"
%include "TypedPacket.i"
%include "PipeMember.i"
%include "WireMember.i"
%include "MemoryMember.i"
%include "Generator.i"
%include "ClientPython.i"
%include "ServicePython.i"
%include "ServiceSecurityPython.i"
%include "DiscoveryPython.i"
%include "Subscription.i"
%include "LoggingPython.i"
%include "NodeDirectories.i"
%include "RobotRaconteurNodePython.i"
%include "PythonTypeSupport.i"
#ifndef ROBOTRACONTEUR_NO_NODE_SETUP
%include "NodeSetup.i"
#endif
%include "BroadcastDownsamplerPython.i"
namespace RobotRaconteur
{
class RRNativeDirectorSupport
{
public:
static void Start();
static void Stop();
static bool IsRunning();
};
}
namespace RobotRaconteur
{
extern bool PythonTracebackPrintExc;
void SetPythonTracebackPrintExc(bool value);
}
%init {
RobotRaconteur::InitPythonTracebackPrintExc();
}
%pythoncode %{
import datetime
try:
import numpy
except:
pass
import weakref
import atexit
@atexit.register
def RobotRaconteur_cleanup():
RobotRaconteurNode.s.Shutdown()
RRNativeDirectorSupport.Stop()
RRNativeDirectorSupport.Start()
%}
|