예제 #1
0
 def toPy(obj):
     if obj == ffi.NULL:
         return None
     # Python Objects can be returned without being wrapped in proxies
     py_handle = lib.get_handle_from_proxy_object_cw__client_interface(obj)
     if py_handle:
         assert py_handle in ClientInterfaceHelper.c_data_set
         aux = ffi.from_handle(ffi.cast("void * ", py_handle))
         lib.client_interface___wrapper_dec_ref(obj)
         return aux
     return ClientInterfaceCppProxy(obj)
예제 #2
0
 def toPy(obj):
     if obj == ffi.NULL:
         return None
     # Python Objects can be returned without being wrapped in proxies
     py_handle = lib.get_handle_from_proxy_object_cw__second_listener(obj)
     if py_handle:
         assert py_handle in SecondListenerHelper.c_data_set
         aux = ffi.from_handle(ffi.cast("void * ", py_handle))
         lib.second_listener___wrapper_dec_ref(obj)
         return aux
     return SecondListenerCppProxy(obj)
예제 #3
0
 def toPy(obj):
     if obj == ffi.NULL:
         return None
     # Python Objects can be returned without being wrapped in proxies
     py_handle = lib.get_handle_from_proxy_object_cw__second_listener(obj)
     if py_handle:
         assert py_handle in SecondListenerHelper.c_data_set
         aux = ffi.from_handle(ffi.cast("void * ", py_handle))
         lib.second_listener___wrapper_dec_ref(obj)
         return aux
     return SecondListenerCppProxy(obj)
예제 #4
0
 def toPy(obj):
     if obj == ffi.NULL:
         return None
     # Python Objects can be returned without being wrapped in proxies
     py_handle = lib.get_handle_from_proxy_object_cw__Foo_Callback2(obj)
     if py_handle:
         assert py_handle in FooCallback2Helper.c_data_set
         aux = ffi.from_handle(ffi.cast("void * ", py_handle))
         lib.Foo_Callback2___wrapper_dec_ref(obj)
         return aux
     return FooCallback2CppProxy(obj)
예제 #5
0
    def toPyCheckAndRaise(ret_val):
        c_ptr = lib.djinni_check_and_clear_exception()
        if c_ptr == ffi.NULL:  # no exception was thrown
            return

        assert c_ptr in ExceptionHelper.c_data_set
        try:
            # if exception was thrown, return value must be null
            exception = ffi.from_handle(ffi.cast("void * ", c_ptr))
            assert ret_val == ffi.NULL
            raise exception
        finally:
            ExceptionHelper.c_data_set.remove(c_ptr)
예제 #6
0
파일: exception.py 프로젝트: trafi/djinni
    def toPyCheckAndRaise(ret_val):
        c_ptr = lib.djinni_from_python_check_and_clear_exception()
        if c_ptr == ffi.NULL: # no exception was thrown
            return

        assert c_ptr in ExceptionHelper.c_data_set
        try:
            # if exception was thrown, return value must be null
            exception = ffi.from_handle(ffi.cast("void * ", c_ptr))
            assert ret_val == ffi.NULL
            raise exception
        finally:
            ExceptionHelper.c_data_set.remove(c_ptr)
예제 #7
0
 def selfToPy(obj):
     assert obj in SecondListenerHelper.c_data_set
     return ffi.from_handle(ffi.cast("void * ",obj))
예제 #8
0
 def selfToPy(obj):
     assert obj in SecondListenerHelper.c_data_set
     return ffi.from_handle(ffi.cast("void * ", obj))
예제 #9
0
 def toPyIter(c_ptr):
     assert c_ptr != ffi.NULL
     aux = ffi.from_handle(ffi.cast("void * ", c_ptr))
     assert aux is not None
     return aux._py_iter
예제 #10
0
 def toPyHelper(c_data_set, c_ptr):
     aux = ffi.from_handle(ffi.cast("void * ",c_ptr))
     if c_data_set is not None: # aka, if we want to remove c_ptr
         assert c_ptr in c_data_set
         c_data_set.remove(c_ptr)
     return aux
예제 #11
0
 def selfToPy(obj):
     assert obj in ClientInterfaceHelper.c_data_set
     return ffi.from_handle(ffi.cast("void * ", obj))
예제 #12
0
 def selfToPy(obj):
     assert obj in FooCallback2Helper.c_data_set
     return ffi.from_handle(ffi.cast("void * ", obj))
예제 #13
0
 def toPyIter(c_ptr):
     assert c_ptr != ffi.NULL
     aux = ffi.from_handle(ffi.cast("void * ", c_ptr))
     assert aux is not None
     return aux._py_iter
예제 #14
0
 def toPyHelper(c_data_set, c_ptr):
     aux = ffi.from_handle(ffi.cast("void * ",c_ptr))
     if c_data_set is not None: # aka, if we want to remove c_ptr
         assert c_ptr in c_data_set
         c_data_set.remove(c_ptr)
     return aux