Separate managed_rpc_type lifetime management from type conversion
This commit separates the functionality of managed_rpc_type<T> into dedicated lifetime management types and conversion functions. This makes for clearer the code since it is now possible to know when a conversion is performed. Lifetime management for C-types is now done with the managed_ctype<T> types, which act only as holders of dynamically allocated C types and do not perform any type conversions whatsoever. Type conversions are now done with the T1 convert(T2 obj) family of functions. When converting from CXX to C API types, these functions effectively return instances of the appropriate managed_ctype<T>s. If one wishes to relinquish ownership of the content of the managed_ctype<T> (e.g. to pass it to a pure C function that will release it), this can be done with the managed_ctype<T>::release() function.
Loading
Please register or sign in to comment