ZIO
Python and C++ interface to ZeroMQ and Zyre
Public Member Functions | List of all members
zio::flow::Flow Class Reference

#include <flow.hpp>

Public Member Functions

 Flow (portptr_t port)
 create a flow. More...
 
 ~Flow ()
 
void send_bot (Message &bot)
 send a BOT More...
 
bool recv_bot (Message &bot, int timeout=-1)
 receive a BOT More...
 
bool put (Message &dat)
 put a payload message into the flow More...
 
int slurp_pay (int timeout)
 recv any waiting PAY messages More...
 
bool get (Message &dat, int timeout=-1)
 get a payload message from the flow More...
 
int flush_pay ()
 send any accumulated credit as a PAY More...
 
void send_eot (Message &msg)
 send EOT. More...
 
bool recv_eot (Message &msg, int timeout=-1)
 Receive an EOT. More...
 
bool is_sender () const
 
int credit () const
 
int total_credit () const
 

Detailed Description

Definition at line 21 of file flow.hpp.

Constructor & Destructor Documentation

◆ Flow()

zio::flow::Flow::Flow ( zio::portptr_t  port)

create a flow.

Definition at line 4 of file flow.cpp.

◆ ~Flow()

zio::flow::Flow::~Flow ( )

Definition at line 12 of file flow.cpp.

Member Function Documentation

◆ credit()

int zio::flow::Flow::credit ( ) const
inline

Definition at line 109 of file flow.hpp.

◆ flush_pay()

int zio::flow::Flow::flush_pay ( )

send any accumulated credit as a PAY

A recver will flush pay prior to any get but the application may do this at any time after BOT. Number of credits sent is returned. This does not block.

Definition at line 193 of file flow.cpp.

◆ get()

bool zio::flow::Flow::get ( zio::Message dat,
int  timeout = -1 
)

get a payload message from the flow

Return false immediately if an EOT was received instead.

Negative timeout waits forever, otherwise gives timeout in milliseconds to wait for a FLOW message.

Definition at line 212 of file flow.cpp.

◆ is_sender()

bool zio::flow::Flow::is_sender ( ) const
inline

Definition at line 108 of file flow.hpp.

◆ put()

bool zio::flow::Flow::put ( zio::Message dat)

put a payload message into the flow

Return false if an EOT was received in the process.

Definition at line 153 of file flow.cpp.

◆ recv_bot()

bool zio::flow::Flow::recv_bot ( zio::Message bot,
int  timeout = -1 
)

receive a BOT

A timeout, -1 waits forever. Return false if timeout occurs.

Server calls send_bot() first, client calls send_bot() second;

Definition at line 59 of file flow.cpp.

◆ recv_eot()

bool zio::flow::Flow::recv_eot ( Message msg,
int  timeout = -1 
)

Receive an EOT.

Return false if no EOT was received, otherwise set msg to that EOT message. Timeout is in milliseconds or less than zero to wait indefinitely.

Note: an app only needs to call recv_eot() if they explicitly initiated with send_eot().

Definition at line 252 of file flow.cpp.

◆ send_bot()

void zio::flow::Flow::send_bot ( zio::Message bot)

send a BOT

Client calls send_bot() first, server calls send_bot() second;

Definition at line 39 of file flow.cpp.

◆ send_eot()

void zio::flow::Flow::send_eot ( Message msg)

send EOT.

If a get() or a put() was interupted by an EOT the app should call send_eot() as an acknowledgement and should not call recv_eot(). If app explicitly initates EOT with send_eot() then the app should call recv_eot() to wait for an ack from the other end.

Definition at line 238 of file flow.cpp.

◆ slurp_pay()

int zio::flow::Flow::slurp_pay ( int  timeout)

recv any waiting PAY messages

A sender will slurp prior to a send of a DAT but the application may call this at any time after BOT. Number of credits slurped is returned. A -1 indicates EOT, which if app calls should respond. A -2 indicates protocol error.

Definition at line 118 of file flow.cpp.

◆ total_credit()

int zio::flow::Flow::total_credit ( ) const
inline

Definition at line 110 of file flow.hpp.


The documentation for this class was generated from the following files: