1 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/app/Client.hpp" 5 #include "hmbdc/app/Message.hpp" 9 namespace hmbdc {
namespace app {
24 template <
typename CcClient,
size_t MaxStashedMessageSizeIn, MessageC ... Messages>
26 :
Client<CcClient, Messages...> {
28 using Interests =
typename Base::Interests;
29 using Requests =
typename Base::Requests;
30 using Replies =
typename Base::Replies;
33 MaxStashedMessageSize = MaxStashedMessageSizeIn
34 ?MaxStashedMessageSizeIn
45 template <MessageC Message>
46 void stash(Message
const& message) {
47 static_assert(
index_in_tuple<Message, std::tuple<Messages...>>::value !=
sizeof...(Messages)
48 ,
"cannot stash uninterested message");
49 stash_.push_back(
typename decltype(stash_)::value_type{});
62 stashOpenCount_ = stash_.size();
67 CcClient& c =
static_cast<CcClient&
>(*this);
68 while (hmbdc_unlikely(stashOpenCount_)) {
70 MessageDispacher<CcClient, Interests>()(c, *m);
75 size_t stashOpenCount_ = 0;
76 std::deque<std::array<char, MaxStashedMessageSize + sizeof(MessageHead)>> stash_;
82 template <
typename Iterator>
84 Base::handleRangeImpl(it, end, threadId);
Definition: MetaUtils.hpp:44
void handleRangeImpl(Iterator it, Iterator end, uint16_t threadId)
do not touch - internal use
Definition: ClientWithStash.hpp:83
a std tuple holding REPLY messages types it can dispatch
void openStash()
release the stashed messages - after this call is returned, the callbacks of the stahsed message will...
Definition: ClientWithStash.hpp:61
Definition: Message.hpp:78
Definition: Message.hpp:112
Definition: MetaUtils.hpp:96
It behaves like Client, with the extra capability of storing messages received and processing them la...
Definition: ClientWithStash.hpp:25
A Client represents a thread of execution/a task. The execution is managed by a Context. a Client object could participate in message dispatching as the receiver of specifed message types.
Definition: Client.hpp:57
a std tuple holding messages types it can dispatch except REPLYs
Definition: BlockingContext.hpp:183
void stash(Message const &message)
stash a message that will be delivered later to the same callback
Definition: ClientWithStash.hpp:46
a std tuple holding REQUEST messages types it can dispatch