hmbdc
simplify-high-performance-messaging-programming
Public Member Functions | Friends | List of all members
hmbdc::app::mcast::Sender Struct Reference

fascade class for sending network messages More...

#include <Sender.hpp>

Public Member Functions

template<typename Message , typename T , typename = std::enable_if<std::is_integral<T>::value>>
void send (Message &&msg, T len)
 send a message's first bytes More...
 
template<typename... Messages>
void send (Messages &&...msgs)
 send a batch of message asynchronizely More...
 
template<typename... Messages>
bool trySend (Messages &&...msgs)
 send a batch of message asynchronizely More...
 
template<typename Message , typename... Args>
void sendInPlace (Args &&...args)
 send a message asynchronizely - avoiding Message copying by directly constructing the message in the buffer More...
 
void sendBytes (uint16_t tag, void const *bytes, size_t len)
 send a message asynchronizely by providing message in tag and bytes More...
 

Friends

struct hmbdc::app::mcast::NetContext
 

Detailed Description

fascade class for sending network messages

Examples:
server-cluster.cpp.

Member Function Documentation

template<typename Message , typename T , typename = std::enable_if<std::is_integral<T>::value>>
void hmbdc::app::mcast::Sender::send ( Message &&  msg,
len 
)
inline

send a message's first bytes

the bytes length could be larger than Message, but needs to be able to fit in the tansport buffer the sender is associated with - exception thrown otherwise

Parameters
msgthe message to send
Template Parameters
MessageType
Parameters
lenjust send the first len bytes of this message
Template Parameters
Tintegral type
template<typename... Messages>
void hmbdc::app::mcast::Sender::send ( Messages &&...  msgs)
inline

send a batch of message asynchronizely

although batching could implicitly happen further performance gain could be achieved by sending more msg in a batch here

Parameters
mMessage
Template Parameters
MessageType
void hmbdc::app::mcast::Sender::sendBytes ( uint16_t  tag,
void const *  bytes,
size_t  len 
)
inline

send a message asynchronizely by providing message in tag and bytes

for runtime typed usage when the message type can only be decided at runtime

Parameters
tagmessage tag
bytesmessage byte starting address
lenbyte length of the above
template<typename Message , typename... Args>
void hmbdc::app::mcast::Sender::sendInPlace ( Args &&...  args)
inline

send a message asynchronizely - avoiding Message copying by directly constructing the message in the buffer

Parameters
argsMessage's ctor args to construct the Message in the buffer
Template Parameters
MessageType
typename... Args args type
template<typename... Messages>
bool hmbdc::app::mcast::Sender::trySend ( Messages &&...  msgs)
inline

send a batch of message asynchronizely

this call does not block and is transactional - all or none is queued

Parameters
mMessage
Template Parameters
MessageType
Returns
true if messages are queued successfully

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