ZeroEQ
0.9.0
ZeroEQ - Zero Event Queue
|
Base class for entities receiving data. More...
#include <receiver.h>
Public Member Functions | |
Receiver () | |
Create a new standalone receiver. More... | |
Receiver (Receiver &shared) | |
Create a shared receiver. More... | |
Receiver (Receiver &&) | |
Receiver & | operator= (Receiver &&) |
bool | receive (const uint32_t timeout=TIMEOUT_INDEFINITE) |
Receive at least one event from all shared receivers. More... | |
Protected Member Functions | |
virtual void | addSockets (std::vector< detail::Socket > &entries)=0 |
Add this receiver's sockets to the given list. | |
virtual bool | process (detail::Socket &socket)=0 |
Process data on a signalled socket. More... | |
virtual void | update () |
Update the internal connection list. More... | |
virtual void | addConnection (const std::string &uri) |
Add the given connection to the list of receiving sockets. More... | |
Friends | |
class | connection::detail::Broker |
Base class for entities receiving data.
Provides a receive() method, which demultiplexes data between multiple inputs of multiple instances of receivers. Receivers form a shared group by linking them at construction time.
Not intended to be as a final class. Not thread safe.
Example:
Definition at line 38 of file receiver.h.
zeroeq::Receiver::Receiver | ( | ) |
Create a new standalone receiver.
|
explicit |
Create a shared receiver.
All receivers sharing a group may receive data when receive() is called on any of them.
shared | another receiver to form a simultaneous receive group with. |
|
protectedvirtual |
Add the given connection to the list of receiving sockets.
uri | the ZeroMQ address to connect to. |
|
protectedpure virtual |
Process data on a signalled socket.
socket | the socket provided from addSockets() |
bool zeroeq::Receiver::receive | ( | const uint32_t | timeout = TIMEOUT_INDEFINITE | ) |
Receive at least one event from all shared receivers.
Using receive( 0 ) is equivalent to polling the receivers for data.
timeout | timeout in ms for poll, default blocking poll until at least one event is received |
std::runtime_error | when polling failed. |
|
inlineprotectedvirtual |
Update the internal connection list.
Called on all members of a shared group regularly by receive() to update their list of sockets.
Definition at line 89 of file receiver.h.