RPCServer Class
(ServerIO::RPCServer)Generic RPC (remote procedure call) binary-message-based server class to be used in RPC service implementers. More...
Header: | #include <IO/ServerIO/RPCServer.h> |
Public Functions
RPCServer(CDPBaseObject *parent, const std::function<void( const MessagePacketHandle & ) > &onClientConnect, const std::function<int( const MessagePacketHandle & ) > &onProcedureCall) | |
void | ForEachClient(const std::function<void( unsigned int ) > &f) const |
Static Public Members
std::string | ClientLongName(unsigned int client) |
void | SendResponse(unsigned int receiverHandle, MessagePacketHandle &response) |
void | SendResponse(const MessagePacketHandle &originalProcedureCall, MessagePacketHandle &response) |
Detailed Description
Generic RPC (remote procedure call) binary-message-based server class to be used in RPC service implementers.
See also CDPBaseObject.
Member Function Documentation
RPCServer::RPCServer(CDPBaseObject *parent, const std::function<void( const MessagePacketHandle & ) > &onClientConnect, const std::function<int( const MessagePacketHandle & ) > &onProcedureCall)
Constructs a RPCServer object.
Any CDPBaseObject based node can create and use a instance of this class for easy implementation of RPC service (procedure call receive and response sending).
Parameters:
- parent - parent object that implements the RPC servicing
- onClientConnect - will be called after RPC service client was connected to the server (with connectMessage, that contains client handle as parameter)
- onProcedureCall - will be called on every RPC procedure call from any client (with procedureMessage as a parameter)
See also CDPBaseObject.
[static]
std::string RPCServer::ClientLongName(unsigned int client)
Return full CDP path of the client handle
void RPCServer::ForEachClient(const std::function<void( unsigned int ) > &f) const
Call callback f for each currently connected client handle
[static]
void RPCServer::SendResponse(unsigned int receiverHandle, MessagePacketHandle &response)
Send the CM_RPC_RESPONSE response message to the receiverHandle
[static]
void RPCServer::SendResponse(const MessagePacketHandle &originalProcedureCall, MessagePacketHandle &response)
Send the CM_RPC_RESPONSE response message to the sender of the originalProcedureCall
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.