hmbdc
simplify-high-performance-messaging-programming
 All Classes Namespaces Functions Variables Friends Pages
Public Member Functions | Friends | List of all members
hmbdc::app::udpcast::Sender Struct Reference

fascade class for sending network messages More...

#include <Sender.hpp>

Inheritance diagram for hmbdc::app::udpcast::Sender:
hmbdc::app::RequestReplySender< Sender >

Public Member Functions

template<typename Message , typename T , typename Enabled = typename std::enable_if<std::is_integral<T>::value, void>::type>
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...
 
- Public Member Functions inherited from hmbdc::app::RequestReplySender< Sender >
bool requestReply (RequestT &&request, ReplyContext &ctx, ReplyHandler &replyHandler, time::Duration timeout=time::Duration::seconds(0xffffffff))
 The caller is blocked until the replies to this request are heard and processed. Just like regular Messages REQUEST is sent out to Clients through the CcSender. More...
 
void sendReply (REPLY< M > &&reply)
 part of synchronous request reply interface. Send a constructed REPLY using the CcSender, it will only reach to the origianl sender Client. ALL REPLY via a Sender need to sent out using this interface to avoid undefined behavior. More...
 
void sendReply (REPLY< M > const &reply)
 part of synchronous request reply interface. Send a constructed REPLY using the CcSender, it will only reach to the origianl sender Client. ALL REPLY via a Sender need to sent out using this interface to avoid undefined behavior. More...
 

Friends

struct hmbdc::app::udpcast::NetContext
 

Detailed Description

fascade class for sending network messages

Examples:
server-cluster.cpp.

Member Function Documentation

template<typename Message , typename T , typename Enabled = typename std::enable_if<std::is_integral<T>::value, void>::type>
void hmbdc::app::udpcast::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::udpcast::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::udpcast::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::udpcast::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::udpcast::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: