EII Message Bus C Reference
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
eii::msgbus::ReceiveContext Class Reference

#include <msgbus.hpp>

Inheritance diagram for eii::msgbus::ReceiveContext:
eii::msgbus::Service eii::msgbus::ServiceRequester

Public Member Functions

 ~ReceiveContext ()
 
MsgEnveloperecv_wait ()
 
template<class Rep , class Period >
MsgEnveloperecv_timedwait (const std::chrono::duration< Rep, Period > &timeout)
 
MsgEnveloperecv_nowait ()
 
user_data_tget_user_data ()
 

Protected Member Functions

 ReceiveContext (void *msgbus_ctx, recv_ctx_t *recv_ctx)
 

Protected Attributes

void * m_msgbus_ctx
 
recv_ctx_tm_recv_ctx
 

Friends

class MsgbusContext
 

Detailed Description

Base receive object used by the Subscriber, Service, and ServiceRequester.

Constructor & Destructor Documentation

◆ ReceiveContext()

eii::msgbus::ReceiveContext::ReceiveContext ( void *  msgbus_ctx,
recv_ctx_t recv_ctx 
)
protected

Constructor

Note
This should never be called directly except inside of the MsgbusContext object.

◆ ~ReceiveContext()

eii::msgbus::ReceiveContext::~ReceiveContext ( )

Destructor

Member Function Documentation

◆ get_user_data()

user_data_t* eii::msgbus::ReceiveContext::get_user_data ( )

Get the user-data attached to the context at creation.

Note
"Creation" occurs when calling MsgbusContext::new_subscriber(), MsgbusContext::new_service(), or MsgbusContext::get_service().
Exceptions
MsgbusExceptionThrown if an error occurs in the message bus.
Returns
void*, may be NULL depending on the user assigned value

◆ recv_nowait()

MsgEnvelope* eii::msgbus::ReceiveContext::recv_nowait ( )

Receive a message on the message bus for the given receive context. If no message is immediately available, then NULL shall be returned.

Exceptions
MsgbusExceptionThrown if an error occurs in the message bus.
Returns
MsgEnvelope*, NULL if no message was received

◆ recv_timedwait()

template<class Rep , class Period >
MsgEnvelope* eii::msgbus::ReceiveContext::recv_timedwait ( const std::chrono::duration< Rep, Period > &  timeout)
inline

Receive a message on the message bus for the given receive context. This method will attempt receive for the given duration of time, if no message is received then the method shall return NULL.

Note
The timeout value must be a minimum is one millisecond.
Exceptions
MsgbusExceptionThrown if an error occurs in the message bus.
Parameters
timeout- Duration to wait until timing out
Returns
MsgEnvelope*, NULL if no message was received

◆ recv_wait()

MsgEnvelope* eii::msgbus::ReceiveContext::recv_wait ( )

Receive a message on the message bus for the given receive context.

Note
This function will block indefinitely until a message is received or an interrupt occurs.
Exceptions
MsgbusExceptionThrown if an error occurs in the message bus.
Returns
MsgEnvelope*

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