hmbdc
simplify-high-performance-messaging-programming
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
hmbdc::app::ThreadCommBase< MaxMessageSize, ContextProperties > Struct Template Reference
Inheritance diagram for hmbdc::app::ThreadCommBase< MaxMessageSize, ContextProperties >:
hmbdc::app::detail::context_property_aggregator< ContextProperties... >

Public Types

enum  { MAX_MESSAGE_SIZE = MaxMessageSize, BUFFER_VALUE_SIZE = MaxMessageSize + 8u }
 
using cpa = context_property_aggregator< ContextProperties... >
 
using Buffer = typename cpa::Buffer
 
using Allocator = typename cpa::Allocator
 

Public Member Functions

size_t maxMessageSize () const
 
template<typename M0 , typename M1 , typename... Messages>
enable_if<!is_integral< M1 >::value, void >::type send (M0 &&m0, M1 &&m1, Messages &&...msgs)
 try send a batch of messages to the Context or attached ipc Contexts More...
 
template<typename M0 , typename M1 , typename... Messages>
enable_if<!is_integral< M1 >::value, bool >::type trySend (M0 &&m0, M1 &&m1, Messages &&...msgs)
 try to send a batch of message to the Context or attached ipc Contexts More...
 
template<typename ForwardIt >
void send (ForwardIt begin, size_t n)
 send a range of messages to the Context or attached ipc Contexts More...
 
template<typename ForwardIt >
bool trySend (ForwardIt begin, size_t n)
 try send a range of messages to the Context or attached ipc Contexts More...
 
template<typename Message >
void send (Message &&m)
 send a message to the Context or attached ipc Contexts More...
 
template<typename Message >
bool trySend (Message &&m)
 try to send a message to the Context or attached ipc Contexts More...
 
template<typename Message , typename... Args>
void sendInPlace (Args &&...args)
 send a message to all Clients in the Context or attached ipc Contexts More...
 
Buffer & buffer ()
 accessor - mostly used internally More...
 

Protected Member Functions

 ThreadCommBase (uint32_t messageQueueSizePower2Num, size_t maxMessageSizeRuntime=MAX_MESSAGE_SIZE, char const *shmName=nullptr)
 

Static Protected Member Functions

static void markDeadFrom (hmbdc::pattern::MonoLockFreeBuffer &buffer, uint16_t)
 
template<typename BroadCastBuf >
static void markDeadFrom (BroadCastBuf &buffer, uint16_t poolThreadCount)
 

Protected Attributes

Allocator allocator_
 
Buffer *__restrict__ bufferptr_
 
Buffer &__restrict__ buffer_
 

Member Function Documentation

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

accessor - mostly used internally

Returns
underlying buffer used in the Context
template<size_t MaxMessageSize, typename... ContextProperties>
template<typename M0 , typename M1 , typename... Messages>
enable_if<!is_integral<M1>::value, void>::type hmbdc::app::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
template<size_t MaxMessageSize, typename... ContextProperties>
template<typename ForwardIt >
void hmbdc::app::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
template<size_t MaxMessageSize, typename... ContextProperties>
template<typename Message >
void hmbdc::app::ThreadCommBase< MaxMessageSize, ContextProperties >::send ( Message &&  m)
inline

send a 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

Parameters
mmessage
Template Parameters
Messagetype
template<size_t MaxMessageSize, typename... ContextProperties>
template<typename Message , typename... Args>
void hmbdc::app::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
template<size_t MaxMessageSize, typename... ContextProperties>
template<typename M0 , typename M1 , typename... Messages>
enable_if<!is_integral<M1>::value, bool>::type hmbdc::app::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
template<size_t MaxMessageSize, typename... ContextProperties>
template<typename ForwardIt >
bool hmbdc::app::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
template<size_t MaxMessageSize, typename... ContextProperties>
template<typename Message >
bool hmbdc::app::ThreadCommBase< MaxMessageSize, ContextProperties >::trySend ( Message &&  m)
inline

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

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

Parameters
mmessage
Template Parameters
Messagetype
Returns
true if send successfully

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