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 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>
73 template <uint16_t c,
typename... ContextProperties>
75 , ContextProperties...>
85 template <
typename... ContextProperties>
87 , ContextProperties...>
96 template <
typename... ContextProperties>
98 , ContextProperties...>
106 template <
typename... ContextProperties>
108 , ContextProperties...>
116 template <
typename... ContextProperties>
118 , ContextProperties...>
129 template <
bool is_timer_manager>
132 void operator()(C&) {}
138 tm.checkTimers(SysTime::now());
142 template <
typename LFB,
typename CcClient>
143 bool runOnceImpl(uint16_t hmbdcNumber,
bool& HMBDC_RESTRICT stopped, LFB& HMBDC_RESTRICT lfb, CcClient& HMBDC_RESTRICT c) {
144 typename LFB::iterator begin, end;
149 const bool clientParticipateInMessaging =
150 std::remove_reference<CcClient>::type::REGISTERED_MESSAGE_SIZE != 0;
151 if (clientParticipateInMessaging) {
152 uint64_t count = lfb.peek(hmbdcNumber, begin, end, c.maxBatchMessageCount());
153 c.CcClient::handleRangeImpl(begin, end, hmbdcNumber);
154 c.CcClient::invokedCb(hmbdcNumber);
155 lfb.wasteAfterPeek(hmbdcNumber, count);
157 c.CcClient::invokedCb(0xffffu - hmbdcNumber);
159 }
catch (std::exception
const& e) {
178 template <
typename CcClient>
185 const bool clientParticipateInMessaging =
186 std::remove_reference<CcClient>::type::REGISTERED_MESSAGE_SIZE;
187 if (clientParticipateInMessaging) {
188 uint64_t count = lfb.peek(begin, end, c.maxBatchMessageCount());
189 c.CcClient::handleRangeImpl(begin, 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:130
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:10
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