1 #include "hmbdc/Copyright.hpp" 3 #include "hmbdc/tips/TypeTagSet.hpp" 4 #include "hmbdc/app/Client.hpp" 5 #include "hmbdc/app/ClientWithStash.hpp" 6 #include "hmbdc/MetaUtils.hpp" 12 namespace hmbdc {
namespace tips {
13 template <
typename... Nodes>
15 using type = std::tuple<>;
18 template <
typename Node,
typename... Nodes>
25 template <
typename... Nodes>
27 using type = std::tuple<>;
30 template <
typename Node,
typename... Nodes>
50 template <
typename CcNode, MessageTupleC RecvMessageTuple,
bool HasMessageStash = false>
53 template <
typename CcNode, MessageC ...RecvMessages,
bool HasMessageStash>
54 struct Node<CcNode,
std::tuple<RecvMessages...>, HasMessageStash>
55 : std::conditional<HasMessageStash
56 , app::ClientWithStash<CcNode, 0, RecvMessages...>
57 , app::Client<CcNode, RecvMessages...>
60 manual_subscribe =
false,
86 using I =
typename CcNode::Interests;
88 ,
"need to override this function since JustBytes is used");
98 using I =
typename CcNode::Interests;
100 ,
"need to override this function since JustBytes is used");
110 using I =
typename CcNode::Interests;
112 ,
"need to override this function since JustBytes is used");
126 template <MessageC Message>
128 for (
auto i = 0; i < Message::typeTagRange; ++i) {
143 template <MessageC Message>
145 for (
auto i = 0; i < Message::typeTagRange; ++i) {
155 auto& node = *
static_cast<CcNode*
>(
this);
156 subscription.addSubsFor<
typename CcNode::Interests>(node, 1, 0);
170 template<MessageC Message>
172 if constexpr(!Message::hasRange) {
175 return subscription.check(message.getTypeTag());
192 bool ifDeliver(uint16_t tag, uint8_t
const* bytes)
const {
193 return subscription.check(tag);
215 template <
typename SendMessageTupleIn,
typename RecvMessageTupleIn>
217 :
Node<RegistrationNode<SendMessageTupleIn, RecvMessageTupleIn>, RecvMessageTupleIn> {
218 using SendMessageTuple = SendMessageTupleIn;
Definition: MetaUtils.hpp:84
void addTypeTagRangePubsFor(Message *, std::function< void(uint16_t)> addOffsetInRange) const
The concrete node overrides this function for each inTagRange type of Message to indicate which type ...
Definition: Node.hpp:144
Definition: TypedString.hpp:84
Definition: MetaUtils.hpp:48
void updateSubscription()
Domain calls this first before handles the subscritions for this Node.
Definition: Node.hpp:154
char const * hmbdcName() const
the thread name used to identify the thread the Node is running on
Definition: Node.hpp:78
bool ifDeliver(uint16_t tag, uint8_t const *bytes) const
an overridable method in the concrete Node that determine if a message should be deliverred to this N...
Definition: Node.hpp:192
void addJustBytesPubsFor(std::function< void(uint16_t)> addTag) const
What tags are going to published when JustBytes is in the SendMessageTuple.
Definition: Node.hpp:109
void addTypeTagRangeSubsFor(Message *, std::function< void(uint16_t)> addOffsetInRange) const
The concrete node overrides this function for each inTagRange type of Message to indicate which type ...
Definition: Node.hpp:127
std::tuple<> SendMessageTuple
Concrete Node needs to specify a list of Messages that would be sent out if this Node is active to he...
Definition: Node.hpp:69
a Node is a thread of execution that can suscribe and receive Messages
Definition: Node.hpp:51
Definition: MetaUtils.hpp:100
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:122
void addJustBytesSubsFor(std::function< void(uint16_t)> addTag) const
What tags are going to published when JustBytes is in the RecvMessageTuple.
Definition: Node.hpp:97
void invokedCb(size_t dispatched) override
this callback is called all the time (frequently) - the exact timing is after a batch of messages are...
Definition: Node.hpp:207
size_t maxMessageSize() const
unless JustBytes is used in Interests - this is automatic
Definition: Node.hpp:85
a std tuple holding messages types it can dispatch
Definition: BlockingContext.hpp:206
bool ifDeliver(Message const &message) const
an overridable method in the concrete Node that determine if a message should be deliverred to this N...
Definition: Node.hpp:171