1 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/app/MessageHandler.hpp" 5 #include "hmbdc/pattern/PoolConsumer.hpp" 6 #include "hmbdc/pattern/LockFreeBufferMisc.hpp" 7 #include "hmbdc/Compile.hpp" 11 namespace hmbdc {
namespace app {
46 template <
typename CcClient,
typename ... Messages>
50 REGISTERED_MESSAGE_SIZE =
sizeof...(Messages),
52 using Interests = std::tuple<Messages ...>;
70 return std::make_tuple<char const*, int>(
nullptr, 0);
146 void stopped(std::exception
const&e) noexcept {
152 bool dropped() noexcept {
160 template <
typename Iterator>
161 void handleRangeImpl(Iterator& it,
162 Iterator
const& end, uint16_t threadId) {
163 CcClient& c =
static_cast<CcClient&
>(*this);
164 for (;it != end; ++it) {
165 c.MessageHandler<CcClient, Messages ...>::handleMessage(*static_cast<MessageHead*>(*it));
virtual ~Client()
trivial
Definition: Client.hpp:141
virtual bool droppedCb()
callback called after the Client is safely taken out of the Context
Definition: Client.hpp:117
virtual void invokedCb(uint16_t threadSerialNumber)
this callback is called all the time (frequently) - the exact timing is after a batch of messages are...
Definition: Client.hpp:134
void stopped(std::exception const &e) noexcept
internal use, don't change or override
Definition: Client.hpp:146
std::tuple< char const *, int > schedSpec() const
an overrideable method. returns the schedule policy and priority, override if necessary priority is o...
Definition: Client.hpp:69
char const * hmbdcName() const
return the name of thread that runs this client, override if necessary
Definition: Client.hpp:59
size_t maxBatchMessageCount() const
an overridable method. client receives events in batches and the max batch size is controllable when ...
Definition: Client.hpp:81
virtual void stoppedCb(std::exception const &e)
callback called when this Client is taken out of message dispatching
Definition: Client.hpp:107
virtual void messageDispatchingStartedCb(uint16_t threadSerialNumber)
called before any messages got dispatched - only once
Definition: Client.hpp:93
a trait class, if a Client can only run on a single specific thread in Pool, derive the Client from i...
Definition: Client.hpp:17
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:47
a std tuple holding messages types it can dispatch
Definition: MessageHandler.hpp:36