hmbdc
simplify-high-performance-messaging-programming
Classes | Public Member Functions | List of all members
hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties > Class Template Reference

covers the inter-thread and ipc communication fascade More...

#include <Context.hpp>

Inheritance diagram for hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >:
hmbdc::app::context_detail::context_property_aggregator< ContextProperties... >

Classes

struct  ShmAttAllocator
 

Public Member Functions

template<MessageC M0, MessageC M1, typename ... Messages, typename Enabled = typename std::enable_if<!std::is_integral<M1>::value, void>::type>
void send (M0 &&m0, M1 &&m1, Messages &&... msgs)
 try send a batch of messages to the Context or attached ipc Contexts More...
 
template<MessageC M0, MessageC M1, typename ... Messages, typename Enabled = typename std::enable_if<!std::is_integral<M1>::value, void>::type>
bool trySend (M0 &&m0, M1 &&m1, Messages &&... msgs)
 try to send a batch of message to the Context or attached ipc Contexts More...
 
template<MessageForwardIterC ForwardIt>
void send (ForwardIt begin, size_t n)
 send a range of messages to the Context or attached ipc Contexts More...
 
template<MessageForwardIterC ForwardIt>
bool trySend (ForwardIt begin, size_t n)
 try send a range of messages to the Context or attached ipc Contexts More...
 
template<MessageC Message>
void send (Message &&m)
 send a message including hasMortAttachment message to the Context or attached ipc Contexts More...
 
template<MessageC Message>
auto allocateForSend (size_t n)
 preallocate consecutive buffers so they can be send out later More...
 
template<typename IteratorAdaptor >
void commitForSend (IteratorAdaptor itA)
 commit all the filled up buffers allocated by allocateForSend and send them out More...
 
template<MessageC Message>
bool trySend (Message &&m)
 try to send a message including hasMortAttachment message to the Context or attached ipc Contexts if it wouldn't block More...
 
template<MessageC Message, typename ... Args>
void sendInPlace (Args &&... args)
 send a message to all Clients in the Context or attached ipc Contexts More...
 
template<MessageC Message, typename ... Args>
bool trySendInPlace (Args &&... args)
 try send a message to all Clients in the Context or attached ipc Contexts if it wouldn't block More...
 
Buffer & buffer ()
 accessor - mostly used internally More...
 

Detailed Description

template<size_t MaxMessageSize, typename... ContextProperties>
class hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >

covers the inter-thread and ipc communication fascade

this type's interface is exposed thru Context and the type itself is not directly used by users

Template Parameters
MaxMessageSizeWhat is the max message size, need at compile time if the value can only be determined at runtime, set this to 0. Things can still work but will lost some compile time checking advantages, see maxMessageSizeRuntime below
ContextPropertiessee types in context_property namespace

Member Function Documentation

◆ allocateForSend()

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageC Message>
auto hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::allocateForSend ( size_t  n)
inline

preallocate consecutive buffers so they can be send out later

Parameters
nhow many buffers to allocate - each buffer has the same sizeof max
Returns
Buffer::iterator

◆ buffer()

template<size_t MaxMessageSize, typename... ContextProperties>
Buffer& hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::buffer ( )
inline

accessor - mostly used internally

Returns
underlying buffer used in the Context

◆ commitForSend()

template<size_t MaxMessageSize, typename... ContextProperties>
template<typename IteratorAdaptor >
void hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::commitForSend ( IteratorAdaptor  itA)
inline

commit all the filled up buffers allocated by allocateForSend and send them out

Template Parameters
IteratorAdaptorthe return value type of allocateForSend
Parameters
itAthe returned calue of allocateForSend

◆ send() [1/3]

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageC M0, MessageC M1, typename ... Messages, typename Enabled = typename std::enable_if<!std::is_integral<M1>::value, void>::type>
void hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::send ( M0 &&  m0,
M1 &&  m1,
Messages &&...  msgs 
)
inline

try send a batch of messages to the Context or attached ipc Contexts

only the Clients that handles the Message will get it of course This function is threadsafe, which means you can call it anywhere in the code

Parameters
msgsmessages
Template Parameters
Messagesmessage types

◆ send() [2/3]

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageForwardIterC ForwardIt>
void hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::send ( ForwardIt  begin,
size_t  n 
)
inline

send a range of messages to the Context or attached ipc Contexts

only the Clients that handles the Message will get it of course This function is threadsafe, which means you can call it anywhere in the code

Parameters
begina forward iterator point at the start of the range
nlength of the range

◆ send() [3/3]

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageC Message>
void hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::send ( Message &&  m)
inline

send a message including hasMortAttachment message to the Context or attached ipc Contexts

only the Clients that handles the Message will get it of course This function is threadsafe, which means you can call it anywhere in the code If sending hasMortAttachment message, the size of the attachment is runtime checked and restricted by Context capacity

Parameters
mmessage
Template Parameters
Messagetype

◆ sendInPlace()

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageC Message, typename ... Args>
void hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::sendInPlace ( Args &&...  args)
inline

send a message to all Clients in the Context or attached ipc Contexts

construct the Message in buffer directly This function is threadsafe, which means you can call it anywhere in the code

Parameters
argsctor args
Template Parameters
Messagetype
typename... Args args

◆ trySend() [1/3]

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageC M0, MessageC M1, typename ... Messages, typename Enabled = typename std::enable_if<!std::is_integral<M1>::value, void>::type>
bool hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::trySend ( M0 &&  m0,
M1 &&  m1,
Messages &&...  msgs 
)
inline

try to send a batch of message to the Context or attached ipc Contexts

this call does not block and it is transactional - send all or none This function is threadsafe, which means you can call it anywhere in the code

Parameters
msgsmessages
Template Parameters
Messagesmessage types
Returns
true if send successfully

◆ trySend() [2/3]

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageForwardIterC ForwardIt>
bool hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::trySend ( ForwardIt  begin,
size_t  n 
)
inline

try send a range of messages to the Context or attached ipc Contexts

this call does not block and it is transactional - send all or none This function is threadsafe, which means you can call it anywhere in the code

Parameters
begina forward iterator point at the start of the range
nlength of the range

◆ trySend() [3/3]

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageC Message>
bool hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::trySend ( Message &&  m)
inline

try to send a message including hasMortAttachment message to the Context or attached ipc Contexts if it wouldn't block

this call does not block - return false when buffer is full This function is threadsafe, which means you can call it anywhere in the code If sending hasMortAttachment message, the size of the attachment is runtime checked and restricted by Context capacity

Parameters
mmessage
Template Parameters
Messagetype
Returns
true if send successfully

◆ trySendInPlace()

template<size_t MaxMessageSize, typename... ContextProperties>
template<MessageC Message, typename ... Args>
bool hmbdc::app::context_detail::ThreadCommBase< MaxMessageSize, ContextProperties >::trySendInPlace ( Args &&...  args)
inline

try send a message to all Clients in the Context or attached ipc Contexts if it wouldn't block

this call does not block - return false when buffer is full constructed the Message in buffer directly if returns true This function is threadsafe, which means you can call it anywhere in the code

Parameters
argsctor args
Template Parameters
Messagetype
typename... Args args
Returns
true if send successfully

The documentation for this class was generated from the following file: