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)
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)
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)
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)
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)
def selfToPy(obj): assert obj in SecondListenerHelper.c_data_set return ffi.from_handle(ffi.cast("void * ", obj))
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
def __python_create(): c_ptr = ffi.new_handle(list()) ListMapStringInt64THelper.c_data_set.add(c_ptr) return ffi.cast("struct DjinniObjectHandle *", c_ptr)
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)
def selfToPy(obj): assert obj in ClientInterfaceHelper.c_data_set return ffi.from_handle(ffi.cast("void * ", obj))
def selfToPy(obj): assert obj in FooCallback2Helper.c_data_set return ffi.from_handle(ffi.cast("void * ", obj))
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 __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)
def __python_create(): c_ptr = ffi.new_handle(MapInt8TSetStringProxy(dict())) MapInt8TSetStringHelper.c_data_set.add(c_ptr) return ffi.cast("struct DjinniObjectHandle *", c_ptr)
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 selfToPy(obj): assert obj in SecondListenerHelper.c_data_set return ffi.from_handle(ffi.cast("void * ",obj))
def release(c_ptr): assert c_ptr in c_data_set c_data_set.remove(ffi.cast("void*", c_ptr))
def __python_create(): c_ptr = ffi.new_handle(list()) ListOptionalBinaryHelper.c_data_set.add(c_ptr) return ffi.cast("struct DjinniObjectHandle *", c_ptr)