2 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/app/rmcast/SendTransportEngine.hpp" 5 #include "hmbdc/MetaUtils.hpp" 7 namespace hmbdc {
namespace app {
namespace rmcast {
10 namespace sender_detail {
16 using ptr = std::shared_ptr<Sender>;
18 friend struct hmbdc::app::rmcast::NetContext;
19 Sender(SendTransportEngine::ptr transport, Topic
const& t)
20 : transport_(transport)
37 template <
typename Message,
typename T
38 ,
typename Enabled =
typename std::enable_if<std::is_integral<T>::value,
void>::type>
39 void send(Message&& msg, T len) {
40 using raw =
typename decay<Message>::type;
41 static_assert(std::is_trivially_destructible<raw>::value,
"cannot send message with dtor");
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>
70 bool trySend(Messages&&... msgs) {
71 return transport_->tryQueue(topic_, std::forward<Messages>(msgs)...);
82 template <
typename Message,
typename ... Args>
83 void sendInPlace(Args&&... 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);
112 void sendBytes(uint16_t tag, hasMemoryAttachment
const* att,
size_t len) {
113 transport_->queueBytes(topic_, tag, att, len);
116 SendTransport::ptr transport_;
121 using Sender = sender_detail::Sender;
Definition: TypedString.hpp:84