hmbdc
simplify-high-performance-messaging-programming
Classes | Public Member Functions | List of all members
hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > > Struct Template Reference

Classes

struct  OneBuffer
 

Public Member Functions

 NetPortal (Config cfg)
 ctor - only can be called after the NetContext singleton is created More...
 
void rotate ()
 run the portal to send and receive messages More...
 
template<typename MesssageRecver , typename MesssageRecverInterestsTuple = std::tuple<RecvMessages...>>
size_t pullIn (MesssageRecver &&recver)
 get the incoming messages and dispatch them to the receiving code More...
 
void flushOut ()
 just run the portal part that send messages More...
 
NetContext::Sender * getSender (comm::Topic const &t)
 get a sender for a topic More...
 
auto getSendEngine ()
 get a send engineng More...
 
void listenTo (comm::Topic const &t)
 listen to a topic - has impact on the pullIn call More...
 
void stopListenTo (comm::Topic const &t)
 stop listening to a topic - has impact on the pullIn call More...
 
size_t sendSessionsRemainingActive () const
 the sending session that are active which is how many receiver are active More...
 
size_t recvSessionsRemainingActive () const
 the recving session that are active which is how many sending parties are active More...
 

Constructor & Destructor Documentation

◆ NetPortal()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::NetPortal ( Config  cfg)
inline

ctor - only can be called after the NetContext singleton is created

it does not go thru the state machine for sender / receiver hand shake if the netowork transport dictates that calling rotate several times will make it happen

Parameters
cfga json configure that has a tx and / or rx sections the supported params are the same as individual transport

Member Function Documentation

◆ flushOut()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
void hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::flushOut ( )
inline

just run the portal part that send messages

it does NOT block - it is not garanteed the user will have sent messages depending on underly network transport. It is expected to be called multiple times thread safe

in low traffic cases the messages are always sent out by single call

◆ getSendEngine()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
auto hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::getSendEngine ( )
inline

get a send engineng

Returns
sender engine pointer. The sender engine is owned by the lib - do not delete

◆ getSender()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
NetContext::Sender* hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::getSender ( comm::Topic const &  t)
inline

get a sender for a topic

thread safe but a slow call

  • so the user cashing the result is expected
Parameters
ttopic for sending
Returns
sender pointer. The sender is owned by the lib - do not delete

◆ listenTo()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
void hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::listenTo ( comm::Topic const &  t)
inline

listen to a topic - has impact on the pullIn call

threadsafe

Parameters
ttopic to listen to

◆ pullIn()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
template<typename MesssageRecver , typename MesssageRecverInterestsTuple = std::tuple<RecvMessages...>>
size_t hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::pullIn ( MesssageRecver &&  recver)
inline

get the incoming messages and dispatch them to the receiving code

it does NOT block - it is not garanteed the user will have received messages if there is nothing received. It is expected to be called whenever the user code feels like receiving messages. This is NOT a thread safe or reentrant function.

Template Parameters
MesssageRecvera type that has the handleMessageCb() callbacks - see app::Client's doc for those callbacks
MesssageRecverInterestsTupletuple containing the message types of the receiver can handle; If a messages that the receiver is not interested is received, it is simply dropped.
Parameters
recveran instance of the receiver
Returns
the message count that has been dispatched to the recver in this call

◆ recvSessionsRemainingActive()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
size_t hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::recvSessionsRemainingActive ( ) const
inline

the recving session that are active which is how many sending parties are active

only supported for reliable transport types such as tcpcast, rmast, and rnemap

Returns
the count

◆ rotate()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
void hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::rotate ( )
inline

run the portal to send and receive messages

it does NOT block - it is not garanteed the user will have sent or received messages. It is expected to be called multiple times thread safe

◆ sendSessionsRemainingActive()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
size_t hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::sendSessionsRemainingActive ( ) const
inline

the sending session that are active which is how many receiver are active

only supported for reliable transport types such as tcpcast, rmast, and rnemap

Returns
the count - return numeric_limits<size_t>::max() when the first receiver is yet to connect (initial)

◆ stopListenTo()

template<typename NetContext , MessageC ... SendMessages, MessageC ... RecvMessages>
void hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::stopListenTo ( comm::Topic const &  t)
inline

stop listening to a topic - has impact on the pullIn call

threadsafe

Parameters
ttopic to forget

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