1 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/app/Client.hpp" 5 #include "hmbdc/app/Message.hpp" 6 #include "hmbdc/comm/Topic.hpp" 8 #include "hmbdc/pattern/PoolT.hpp" 9 #include "hmbdc/pattern/PoolMinus.hpp" 10 #include "hmbdc/pattern/LockFreeBufferT.hpp" 11 #include "hmbdc/pattern/MonoLockFreeBuffer.hpp" 13 #include "hmbdc/os/Thread.hpp" 14 #include "hmbdc/os/Allocators.hpp" 15 #include "hmbdc/time/Timers.hpp" 18 #include <type_traits> 23 namespace hmbdc {
namespace app {
namespace context_detail {
27 template <
typename CcClient>
31 :
pattern::PoolConsumer(CcClient::REGISTERED_MESSAGE_SIZE != 0, dynamic_cast<time::TimerManager*>(&client))
34 virtual void handleRangeImpl(
BufIt& it,
35 BufIt const& end, uint16_t threadSerialNumber)
override {
36 client_.CcClient::handleRangeImpl(it, end, threadSerialNumber);
38 virtual void messageDispatchingStartedCb(uint16_t threadId)
override {
39 client_.CcClient::messageDispatchingStartedCb(threadId);
41 virtual void invokedCb(uint16_t threadId)
override {
42 client_.CcClient::invokedCb(threadId);
44 virtual void stoppedCb(std::exception
const&e)
override {
45 client_.CcClient::stoppedCb(e);
47 virtual bool droppedCb()
override {
48 if (client_.CcClient::droppedCb()) {
56 CcClient& HMBDC_RESTRICT client_;
59 template <
typename... ContextProperties>
72 template <uint16_t c,
typename... ContextProperties>
74 , ContextProperties...>
84 template <
typename... ContextProperties>
86 , ContextProperties...>
95 template <
typename... ContextProperties>
97 , ContextProperties...>
105 template <
typename... ContextProperties>
107 , ContextProperties...>
115 template <
typename... ContextProperties>
117 , ContextProperties...>
128 template <
bool is_timer_manager>
131 void operator()(C&) {}
137 tm.checkTimers(SysTime::now());
141 template <
typename LFB,
typename CcClient>
142 bool runOnceImpl(uint16_t hmbdcNumber,
bool& HMBDC_RESTRICT stopped, LFB& HMBDC_RESTRICT lfb, CcClient& HMBDC_RESTRICT c) {
143 typename LFB::iterator begin, end;
148 const bool clientParticipateInMessaging =
149 std::remove_reference<CcClient>::type::REGISTERED_MESSAGE_SIZE != 0;
150 if (clientParticipateInMessaging) {
151 uint64_t count = lfb.peek(hmbdcNumber, begin, end, c.maxBatchMessageCount());
152 c.CcClient::handleRangeImpl(begin, end, hmbdcNumber);
153 c.CcClient::invokedCb(hmbdcNumber);
154 lfb.wasteAfterPeek(hmbdcNumber, count);
156 c.CcClient::invokedCb(0xffffu - hmbdcNumber);
158 }
catch (std::exception
const& e) {
177 template <
typename CcClient>
184 const bool clientParticipateInMessaging =
185 std::remove_reference<CcClient>::type::REGISTERED_MESSAGE_SIZE;
186 if (clientParticipateInMessaging) {
187 uint64_t count = lfb.peek(begin, end, c.maxBatchMessageCount());
189 c.CcClient::handleRangeImpl(b, end, threadSerialNumber);
190 c.CcClient::invokedCb(threadSerialNumber);
191 lfb.wasteAfterPeek(begin, count);
193 c.CcClient::invokedCb(0xffffu - threadSerialNumber);
195 }
catch (std::exception
const& e) {
219 template <
typename Buffer>
220 void unblock(Buffer& lfb, uint16_t threadSerialNumber) {
221 lfb.markDead(threadSerialNumber);
Definition: MonoLockFreeBuffer.hpp:15
Definition: ContextDetail.hpp:60
Definition: ContextDetail.hpp:129
Definition: TypedString.hpp:74
Definition: Timers.hpp:65
the default vanilla allocate
Definition: Allocators.hpp:116
Unknown excpetion.
Definition: Exception.hpp:17
Definition: BlockingBuffer.hpp:11
Definition: ContextDetail.hpp:28
Definition: LockFreeBufferT.hpp:18
Definition: PoolConsumer.hpp:13
Exception that just has an exit code.
Definition: Exception.hpp:28
helping allocating object and its aggregated objects in a continouse shared memory ...
Definition: Allocators.hpp:88
Definition: LockFreeBufferMisc.hpp:74