{ "format": 1, "id": "saw-rpc_client-loopback", "kind": "class", "name": "rpc_client", "namespace": "saw", "module": "remote", "header": "modules/remote/c++/remote_loopback.hpp", "is_special": true, "specializes": "saw-rpc_client", "arguments": ["Iface", "Encoding", "rmt::Loopback"], "brief_description": "Calls an rpc server in the same process.", "detailed_description": [ [ "Holds one", {"name": "data_client", "id": "saw-data_client-loopback"}, "per schema the interface mentions, all of them handles on the data servers the server is already bound to. A parameter which is not on the remote yet goes through the data layer first, and only its id reaches the rpc layer." ] ], "templates": [ {"name": "Iface", "kind": "type"}, {"name": "Encoding", "kind": "type"} ], "aliases": { "saw-rpc_client-loopback-ServerT": { "id": "saw-rpc_client-loopback-ServerT", "name": "ServerT", "type": [{"name": "rpc_server", "id": "saw-rpc_server-loopback"}, "< Iface, Encoding, rmt::Loopback >"] }, "saw-rpc_client-loopback-TypeGroup": { "id": "saw-rpc_client-loopback-TypeGroup", "name": "TypeGroup", "type": ["typename schema_iface_type_group< Iface >::Type"], "brief_description": "Every schema the interface mentions, reduced to unique types." }, "saw-rpc_client-loopback-DataClients": { "id": "saw-rpc_client-loopback-DataClients", "name": "DataClients", "type": ["std::tuple<", {"name": "data_client", "id": "saw-data_client-loopback"}, "< T, Encoding, rmt::Loopback >... >"], "brief_description": "One data client per schema in the type group." } }, "functions": { "saw-rpc_client-loopback-get_data_client": { "id": "saw-rpc_client-loopback-get_data_client", "name": "get_data_client", "type": [{"name": "data_client", "id": "saw-data_client-loopback"}, "< IdT, Encoding, rmt::Loopback > &"], "brief_description": "The data client of one of the interface types.", "detailed_description": [ ["Useful when a parameter is meant to be sent once and reused in several calls."] ], "templates": [ {"name": "IdT", "kind": "type", "brief_description": "One of the schemas the interface mentions."} ], "examples": [ { "title": "Sending a parameter once and calling with it twice", "description": [ [ "Handing a value to call sends it every time. Sending it once and passing the id instead keeps it on the remote, which is the point of", {"name": "data_or_id", "id": "saw-data_or_id"} ] ], "language": "cpp", "code": "data inp{21};\n\nauto& u32_client = client.get_data_client();\nauto eo_param = u32_client.send(inp);\nauto param = eo_param.get_value();\n\n/// Both calls refer to the same value on the remote.\nauto first = client.call<\"foo\">(param).take();\nauto second = client.call<\"foo\">(param).take();\n" } ] }, "saw-rpc_client-loopback-request_data": { "id": "saw-rpc_client-loopback-request_data", "name": "request_data", "type": [{"name": "remote_data", "id": "saw-remote_data-loopback"}, "< IdT, Encoding, rmt::Loopback >"], "brief_description": "Requests the data from the remote.", "templates": [ {"name": "IdT", "kind": "type"} ], "parameters": [ {"name": "dat_id", "type": ["id< IdT >"]} ] }, "saw-rpc_client-loopback-call-1": { "id": "saw-rpc_client-loopback-call-1", "name": "call", "type": ["conveyor<", {"name": "remote_data", "id": "saw-remote_data-loopback"}, "< ResponseT, Encoding, rmt::Loopback > >"], "brief_description": "Calls a function on the remote.", "detailed_description": [ [ "The parameter is either already present on the remote, in which case only its id is handed over, or it is sent through the data layer first." ], [ "The id of the response is picked by the server and travels back with the answer, so this is asynchronous in the id as well, not only in the data." ] ], "templates": [ { "name": "Name", "kind": "non_type", "type": "string_literal", "brief_description": "Name of the interface member to call." } ], "parameters": [ { "name": "input", "type": [{"name": "data_or_id", "id": "saw-data_or_id"}, "< RequestT, Encoding >"], "brief_description": "The parameter, or the id of one already on the remote." } ] }, "saw-rpc_client-loopback-call-2": { "id": "saw-rpc_client-loopback-call-2", "name": "call", "type": ["conveyor<", {"name": "remote_data", "id": "saw-remote_data-loopback"}, "< ResponseT, Encoding, rmt::Loopback > >"], "brief_description": "Calls a function and stores the response in a slot allocated beforehand.", "templates": [ { "name": "Name", "kind": "non_type", "type": "string_literal", "brief_description": "Name of the interface member to call." } ], "parameters": [ { "name": "input", "type": [{"name": "data_or_id", "id": "saw-data_or_id"}, "< RequestT, Encoding >"] }, { "name": "resp_id", "type": ["id< ResponseT >"], "brief_description": "Slot the answer has to end up in." } ] } } }