Turi Create
4.0
|
#include <core/system/cppipc/client/object_proxy.hpp>
Public Member Functions | |
object_proxy (comm_client &comm, bool auto_create=true, size_t object_id=(size_t)(-1)) | |
void | remote_delete () |
void | set_object_id (size_t object_id) |
size_t | get_object_id () const |
comm_client & | get_comm () |
template<typename S > | |
void | register_object (S *object) |
template<typename MemFn > | |
void | register_function (MemFn f, std::string function_string) |
template<typename MemFn , typename... Args> | |
detail::member_function_return_type< MemFn >::type | call (MemFn f, const Args &... args) |
Refers to a remote object and allows function calls to be issued across a communication link.
The object_proxy object internally maintains an object ID which identifies an object on the other side of a communication link established by the comm_client. The object_proxy is templatized over a type T which must have an identical object interface as the remote object. T must also provide the registration callbacks which match the registration callbacks on the remote end. For that reason, it is easiest if T defines an interface and implements the register callbacks. And the remote object then inherits from T.
The recommended pattern is as follows: Given the following base class with an implementation on the server side
We implement a proxy object which has the object_proxy as a member, and inherits from the object_base. Each function call is then forwarded to the remote machine.
Definition at line 58 of file object_proxy.hpp.
|
inline |
Creates an object_proxy object using the communication client provided for communication. If auto_create is set to true, a new remote object is created on the remote machine. Otherwise, no remote object ID is specified, and set_object_id() must be called to set the remote object ID.
comm | The comm client object to use for communication |
auto_create | If true, will create the remote object on construction of the object proxy. |
object_id | The object ID to use in the proxy. Only valid when auto_create is false. |
Definition at line 72 of file object_proxy.hpp.
|
inline |
Calls a remote function returning the result. The remote function's return is forwarded and returned here. An exception is raised of type reply_status if there is an error.
Definition at line 149 of file object_proxy.hpp.
|
inline |
Returns a reference to the communication object used.
Definition at line 123 of file object_proxy.hpp.
|
inline |
Gets the object ID managed by this proxy.
Definition at line 116 of file object_proxy.hpp.
|
inline |
do not use Registers a member function of T, associating it with a string name
Definition at line 138 of file object_proxy.hpp.
|
inline |
do not use
Definition at line 129 of file object_proxy.hpp.
|
inline |
Deletes the remote object referred to by this proxy. The object ID in the proxy will be cleared.
Definition at line 98 of file object_proxy.hpp.
|
inline |
Assigns the object ID managed by this proxy.
Definition at line 108 of file object_proxy.hpp.