Robot Raconteur Core C++ Library
|
pipe
member type interface
More...
Public Member Functions | |
virtual boost::function< void(const boost::shared_ptr< PipeEndpoint< T > > &)> | GetPipeConnectCallback ()=0 |
Get the currently configured pipe endpoint connected callback function. More... | |
virtual void | SetPipeConnectCallback (boost::function< void(const boost::shared_ptr< PipeEndpoint< T > > &)> function)=0 |
Set the pipe endpoint connected callback function. More... | |
virtual boost::shared_ptr< PipeEndpoint< T > > | Connect (int32_t index)=0 |
Connect a pipe endpoint. More... | |
virtual void | AsyncConnect (int32_t index, boost::function< void(const boost::shared_ptr< PipeEndpoint< T > > &, const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)=0 |
Asynchronously connect a pipe endpoint. More... | |
virtual void | AsyncConnect (boost::function< void(const boost::shared_ptr< PipeEndpoint< T > > &, const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE) |
Asynchronously connect a pipe endpoint. More... | |
virtual std::string | GetMemberName ()=0 |
Get the member name of the pipe. More... | |
MemberDefinition_Direction | Direction () |
The direction of the pipe. More... | |
bool | IsUnreliable () |
Get if pipe is declared unreliable. More... | |
Static Public Attributes | |
static const int32_t | ANY_INDEX = -1 |
Dynamically select pipe endpoint index. More... | |
pipe
member type interface
The Pipe class implements the pipe
member type. Pipes are declared in service definition files using the pipe
keyword within object declarations. Pipes provide reliable packet streaming between clients and services. They work by creating pipe endpoint pairs (peers), with one endpoint in the client, and one in the service. Packets are transmitted between endpoint pairs. Packets sent by one endpoint are received by the other, where they are placed in a receive queue. Received packets can then be retrieved from the receive queue.
Pipe endpoints are created by the client using the Connect() or AsyncConnect() functions. Services receive incoming connection requests through a callback function. This callback is configured using the SetPipeConnectCallback() function. Services may also use the PipeBroadcaster class to automate managing pipe endpoint lifecycles and sending packets to all connected client endpoints. If the SetPipeConnectCallback() function is used, the service is responsible for keeping track of endpoints as the connect and disconnect. See PipeEndpoint for details on sending and receiving packets.
Pipe endpoints are indexed, meaning that more than one endpoint pair can be created between the client and the service.
Pipes may be unreliable, meaning that packets may arrive out of order or be dropped. Use IsUnreliable() to check for unreliable pipes. The member modifier unreliable
is used to specify that a pipe should be unreliable.
Pipes may be declared readonly or writeonly. If neither is specified, the pipe is assumed to be full duplex. readonly pipes may only send packets from service to client. writeonly pipes may only send packets from client to service. Use Direction() to determine the direction of the pipe.
The PipeBroadcaster is often used to simplify the use of Pipes. See PipeBroadcaster for more information.
This class is instantiated by the node. It should not be instantiated by the user.
T | The packet data type |
|
inlinevirtual |
Asynchronously connect a pipe endpoint.
Same as AsyncConnect(), but automatically selects a pipe endpoint index
Only valid on clients. Will throw InvalidOperationException on the service side.
handler | A handler function to receive the connected endpoint, or an exception |
timeout | Timeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout |
|
pure virtual |
Asynchronously connect a pipe endpoint.
Same as Connect(), but returns asynchronously.
Only valid on clients. Will throw InvalidOperationException on the service side.
index | The index of the pipe endpoint, or ANY_INDEX to automatically select an index |
handler | A handler function to receive the connected endpoint, or an exception |
timeout | Timeout in milliseconds, or RR_TIMEOUT_INFINITE for no timeout |
|
pure virtual |
Connect a pipe endpoint.
Creates a connected pipe endpoint pair, and returns the local endpoint. Use to create the streaming data connection to the service. Pipe endpoints are indexed, meaning that Connect() may be called multiple times for the same client connection to create multple pipe endpoint pairs. For most cases Pipe::ANY_INDEX (-1) can be used to automatically select an available index.
Only valid on clients. Will throw InvalidOperationException on the service side.
index | The index of the pipe endpoint, or ANY_INDEX to automatically select an index |
|
inherited |
The direction of the pipe.
Pipes may be declared readonly or writeonly in the service definition file. (If neither is specified, the pipe is assumed to be full duplex.) readonly pipes may only send packets from service to client. writeonly pipes may only send packets from client to service.
|
pure virtualinherited |
Get the member name of the pipe.
|
pure virtual |
Get the currently configured pipe endpoint connected callback function.
Only valid for services. Will throw InvalidOperationException on client side.
|
inherited |
Get if pipe is declared unreliable.
Pipe members may be declared as unreliable using member modifiers in the service definition. Pipes confirm unreliable operation when pipe endpoints are connected.
|
pure virtual |
Set the pipe endpoint connected callback function.
Callback function invoked when a client attempts to connect a pipe endpoint. The callback will receive the incoming pipe endpoint as a parameter. The service must maintain a reference to the pipe endpoint, but the pipe will retain ownership of the endpoint until it is closed. Using boost::weak_ptr to store the reference to the endpoint is recommended.
The callback may throw an exception to reject incoming connect request.
Note: Connect callback is configured automatically by PipeBroadcaster
Only valid for services. Will throw InvalidOperationException on the client side.
function | Callback function to receive incoming pipe endpoint |
|
staticinherited |
Dynamically select pipe endpoint index.
Pass to Connect() or AsyncConnect() to use any available endpoint index