Loading libs/vr/libpdx/private/pdx/rpc/remote_method.h +0 −146 Original line number Diff line number Diff line Loading @@ -212,117 +212,6 @@ void DispatchRemoteMethod(Class& instance, RemoteMethodReturn<RemoteMethodType>(message, 0); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface check. Overload for int return types. template <typename RemoteMethodType, typename Class, typename... Args, typename = EnableIfNotVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, int (Class::*method)(Message&, Args...), Message& message, std::size_t max_capacity = InitialBufferCapacity) { using Signature = typename RemoteMethodType::template RewriteArgs<Args...>; rpc::ServicePayload<ReceiveBuffer> payload(message); payload.Resize(max_capacity); auto size = message.Read(payload.Data(), payload.Size()); if (size < 0) { RemoteMethodError(message, -size); return; } payload.Resize(size); ErrorType error; auto decoder = MakeArgumentDecoder<Signature>(&payload); auto arguments = decoder.DecodeArguments(&error); if (error) { RemoteMethodError(message, EIO); return; } auto return_value = UnpackArguments<Class, Signature>(instance, method, message, arguments) .Invoke(); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface check. Overload for FileHandle return types. template <typename RemoteMethodType, FileHandleMode Mode, typename Class, typename... Args, typename = EnableIfNotVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, FileHandle<Mode> (Class::*method)(Message&, Args...), Message& message, std::size_t max_capacity = InitialBufferCapacity) { using Signature = typename RemoteMethodType::template RewriteSignature<FileHandle<Mode>, Args...>; rpc::ServicePayload<ReceiveBuffer> payload(message); payload.Resize(max_capacity); auto size = message.Read(payload.Data(), payload.Size()); if (size < 0) { RemoteMethodError(message, -size); return; } payload.Resize(size); ErrorType error; auto decoder = MakeArgumentDecoder<Signature>(&payload); auto arguments = decoder.DecodeArguments(&error); if (error) { RemoteMethodError(message, EIO); return; } auto return_value = UnpackArguments<Class, Signature>(instance, method, message, arguments) .Invoke(); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface check. Overload for ChannelHandle return types. template <typename RemoteMethodType, ChannelHandleMode Mode, typename Class, typename... Args, typename = EnableIfNotVoidMethod<RemoteMethodType>> void DispatchRemoteMethod( Class& instance, ChannelHandle<Mode> (Class::*method)(Message&, Args...), Message& message, std::size_t max_capacity = InitialBufferCapacity) { using Signature = typename RemoteMethodType::template RewriteSignature<ChannelHandle<Mode>, Args...>; rpc::ServicePayload<ReceiveBuffer> payload(message); payload.Resize(max_capacity); auto size = message.Read(payload.Data(), payload.Size()); if (size < 0) { RemoteMethodError(message, -size); return; } payload.Resize(size); ErrorType error; auto decoder = MakeArgumentDecoder<Signature>(&payload); auto arguments = decoder.DecodeArguments(&error); if (error) { RemoteMethodError(message, EIO); return; } auto return_value = UnpackArguments<Class, Signature>(instance, method, message, arguments) .Invoke(); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface signature check. Overload for generic return types. template <typename RemoteMethodType, typename Class, typename Return, Loading Loading @@ -414,41 +303,6 @@ void DispatchRemoteMethod(Class& instance, void (Class::*method)(Message&), RemoteMethodReturn<RemoteMethodType>(message, 0); } // Overload for int return type. template <typename RemoteMethodType, typename Class, typename = EnableIfVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, int (Class::*method)(Message&), Message& message) { const int return_value = (instance.*method)(message); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Overload for FileHandle return type. template <typename RemoteMethodType, typename Class, FileHandleMode Mode, typename = EnableIfVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, FileHandle<Mode> (Class::*method)(Message&), Message& message) { FileHandle<Mode> return_value = (instance.*method)(message); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Overload for ChannelHandle return types. template <typename RemoteMethodType, typename Class, ChannelHandleMode Mode, typename = EnableIfVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, ChannelHandle<Mode> (Class::*method)(Message&), Message& message) { ChannelHandle<Mode> return_value = (instance.*method)(message); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Overload for generic return type. template <typename RemoteMethodType, typename Class, typename Return, typename = EnableIfVoidMethod<RemoteMethodType>> Loading Loading
libs/vr/libpdx/private/pdx/rpc/remote_method.h +0 −146 Original line number Diff line number Diff line Loading @@ -212,117 +212,6 @@ void DispatchRemoteMethod(Class& instance, RemoteMethodReturn<RemoteMethodType>(message, 0); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface check. Overload for int return types. template <typename RemoteMethodType, typename Class, typename... Args, typename = EnableIfNotVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, int (Class::*method)(Message&, Args...), Message& message, std::size_t max_capacity = InitialBufferCapacity) { using Signature = typename RemoteMethodType::template RewriteArgs<Args...>; rpc::ServicePayload<ReceiveBuffer> payload(message); payload.Resize(max_capacity); auto size = message.Read(payload.Data(), payload.Size()); if (size < 0) { RemoteMethodError(message, -size); return; } payload.Resize(size); ErrorType error; auto decoder = MakeArgumentDecoder<Signature>(&payload); auto arguments = decoder.DecodeArguments(&error); if (error) { RemoteMethodError(message, EIO); return; } auto return_value = UnpackArguments<Class, Signature>(instance, method, message, arguments) .Invoke(); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface check. Overload for FileHandle return types. template <typename RemoteMethodType, FileHandleMode Mode, typename Class, typename... Args, typename = EnableIfNotVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, FileHandle<Mode> (Class::*method)(Message&, Args...), Message& message, std::size_t max_capacity = InitialBufferCapacity) { using Signature = typename RemoteMethodType::template RewriteSignature<FileHandle<Mode>, Args...>; rpc::ServicePayload<ReceiveBuffer> payload(message); payload.Resize(max_capacity); auto size = message.Read(payload.Data(), payload.Size()); if (size < 0) { RemoteMethodError(message, -size); return; } payload.Resize(size); ErrorType error; auto decoder = MakeArgumentDecoder<Signature>(&payload); auto arguments = decoder.DecodeArguments(&error); if (error) { RemoteMethodError(message, EIO); return; } auto return_value = UnpackArguments<Class, Signature>(instance, method, message, arguments) .Invoke(); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface check. Overload for ChannelHandle return types. template <typename RemoteMethodType, ChannelHandleMode Mode, typename Class, typename... Args, typename = EnableIfNotVoidMethod<RemoteMethodType>> void DispatchRemoteMethod( Class& instance, ChannelHandle<Mode> (Class::*method)(Message&, Args...), Message& message, std::size_t max_capacity = InitialBufferCapacity) { using Signature = typename RemoteMethodType::template RewriteSignature<ChannelHandle<Mode>, Args...>; rpc::ServicePayload<ReceiveBuffer> payload(message); payload.Resize(max_capacity); auto size = message.Read(payload.Data(), payload.Size()); if (size < 0) { RemoteMethodError(message, -size); return; } payload.Resize(size); ErrorType error; auto decoder = MakeArgumentDecoder<Signature>(&payload); auto arguments = decoder.DecodeArguments(&error); if (error) { RemoteMethodError(message, EIO); return; } auto return_value = UnpackArguments<Class, Signature>(instance, method, message, arguments) .Invoke(); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Dispatches a method by deserializing arguments from the given Message, with // compile-time interface signature check. Overload for generic return types. template <typename RemoteMethodType, typename Class, typename Return, Loading Loading @@ -414,41 +303,6 @@ void DispatchRemoteMethod(Class& instance, void (Class::*method)(Message&), RemoteMethodReturn<RemoteMethodType>(message, 0); } // Overload for int return type. template <typename RemoteMethodType, typename Class, typename = EnableIfVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, int (Class::*method)(Message&), Message& message) { const int return_value = (instance.*method)(message); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Overload for FileHandle return type. template <typename RemoteMethodType, typename Class, FileHandleMode Mode, typename = EnableIfVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, FileHandle<Mode> (Class::*method)(Message&), Message& message) { FileHandle<Mode> return_value = (instance.*method)(message); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Overload for ChannelHandle return types. template <typename RemoteMethodType, typename Class, ChannelHandleMode Mode, typename = EnableIfVoidMethod<RemoteMethodType>> void DispatchRemoteMethod(Class& instance, ChannelHandle<Mode> (Class::*method)(Message&), Message& message) { ChannelHandle<Mode> return_value = (instance.*method)(message); // Return the value to the caller unless the message was moved. if (message) RemoteMethodReturn<RemoteMethodType>(message, return_value); } // Overload for generic return type. template <typename RemoteMethodType, typename Class, typename Return, typename = EnableIfVoidMethod<RemoteMethodType>> Loading