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

Public Member Functions

 NetPortal (Config cfg, size_t messageQueueSizePower2Num=20)
 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 >
size_t pullIn (MesssageRecver &&recver)
 just run the portal part that receives messages 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...
 
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...
 

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,
size_t  messageQueueSizePower2Num = 20 
)
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
messageQueueSizePower2Num- see doc in NetContext

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

◆ 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 point. 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 >
size_t hmbdc::app::utils::NetPortal< NetContext, std::tuple< SendMessages... >, std::tuple< RecvMessages... > >::pullIn ( MesssageRecver &&  recver)
inline

just run the portal part that receives messages

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

Template Parameters
MesssageRecvera type that has the handleMessageCb() callbacks - see app::Client's doc for those callbacks
Parameters
recveran instance of the receiver
Returns
the message count that has been dispatched to the recver in this call

◆ 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: