Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
 def selfToPy(obj):
     assert obj in SecondListenerHelper.c_data_set
     return ffi.from_handle(ffi.cast("void * ", obj))
Ejemplo n.º 8
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
Ejemplo n.º 9
0
 def __python_create():
     c_ptr = ffi.new_handle(list())
     ListMapStringInt64THelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
Ejemplo n.º 10
0
 def __python_create():
     c_ptr = ffi.new_handle(SetInt32TProxy(set()))
     SetInt32THelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
 def __python_create():
     c_ptr = ffi.new_handle(MapEnumColorEnumColorProxy(dict()))
     MapEnumColorEnumColorHelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
Ejemplo n.º 12
0
 def selfToPy(obj):
     assert obj in ClientInterfaceHelper.c_data_set
     return ffi.from_handle(ffi.cast("void * ", obj))
Ejemplo n.º 13
0
 def selfToPy(obj):
     assert obj in FooCallback2Helper.c_data_set
     return ffi.from_handle(ffi.cast("void * ", obj))
Ejemplo n.º 14
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
Ejemplo n.º 15
0
 def __python_create():
     c_ptr = ffi.new_handle(list())
     ListListStringHelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
 def __python_create():
     c_ptr = ffi.new_handle(list())
     ListRecordFooSomeOtherRecordHelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
Ejemplo n.º 17
0
 def __python_create():
     c_ptr = ffi.new_handle(MapInt8TSetStringProxy(dict()))
     MapInt8TSetStringHelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
Ejemplo n.º 18
0
 def __python_create():
     c_ptr = ffi.new_handle(MapStringStringProxy(dict()))
     MapStringStringHelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
 def __python_create():
     c_ptr = ffi.new_handle(list())
     ListRecordFooSomeOtherRecordHelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)
Ejemplo n.º 20
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
Ejemplo n.º 21
0
 def selfToPy(obj):
     assert obj in SecondListenerHelper.c_data_set
     return ffi.from_handle(ffi.cast("void * ",obj))
Ejemplo n.º 22
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
 def release(c_ptr):
     assert c_ptr in c_data_set
     c_data_set.remove(ffi.cast("void*", c_ptr))
Ejemplo n.º 24
0
 def __python_create():
     c_ptr = ffi.new_handle(list())
     ListOptionalBinaryHelper.c_data_set.add(c_ptr)
     return ffi.cast("struct DjinniObjectHandle *", c_ptr)