1 #include "hmbdc/Copyright.hpp" 3 #include "hmbdc/app/mcast/SendTransportEngine.hpp" 8 namespace hmbdc {
namespace app {
namespace mcast {
16 using ptr = shared_ptr<Sender>;
20 Sender(SendTransport::ptr transport,
Topic const& t)
21 : transport_(transport)
38 template <
typename Message,
typename T
39 ,
typename = enable_if<is_integral<T>::value>>
40 void send(Message&& msg, T len) {
41 using raw =
typename remove_reference<Message>::type;
42 transport_->queueBytes(
43 topic_, raw::typeTag, &msg, static_cast<size_t>(len));
55 template <
typename... Messages>
56 void send(Messages&&... msgs) {
57 transport_->queue(topic_, std::forward<Messages>(msgs)...);
69 template <
typename... Messages>
71 return transport_->tryQueue(topic_, std::forward<Messages>(msgs)...);
82 template <
typename Message,
typename ... Args>
84 transport_->template queueInPlace<Message>(topic_, std::forward<Args>(args)...);
97 void sendBytes(uint16_t tag,
void const* bytes,
size_t len) {
98 transport_->queueBytes(topic_, tag, bytes, len);
102 SendTransport::ptr transport_;
topic as in the publish / subscribe communication paradigm
Definition: Topic.hpp:14
Definition: TypedString.hpp:74
Definition: NetContext.hpp:33
void send(Messages &&...msgs)
send a batch of message asynchronizely
Definition: Sender.hpp:56
void sendBytes(uint16_t tag, void const *bytes, size_t len)
send a message asynchronizely by providing message in tag and bytes
Definition: Sender.hpp:97
void send(Message &&msg, T len)
send a message's first bytes
Definition: Sender.hpp:40
void sendInPlace(Args &&...args)
send a message asynchronizely - avoiding Message copying by directly constructing the message in the ...
Definition: Sender.hpp:83
Definition: Client.hpp:11
Definition: Sender.hpp:15
bool trySend(Messages &&...msgs)
send a batch of message asynchronizely
Definition: Sender.hpp:70