hmbdc
simplify-high-performance-messaging-programming
Public Member Functions | Static Public Member Functions | List of all members
hmbdc::app::utils::ConsoleClient< NetCtx > Struct Template Reference

a Client that work as a console to send and receive network messages More...

#include <ConsoleClient.hpp>

Inheritance diagram for hmbdc::app::utils::ConsoleClient< NetCtx >:
hmbdc::app::Client< ConsoleClient< NetCtx >, JustBytes > hmbdc::app::MessageHandler< ConsoleClient< NetCtx >, Messages... > hmbdc::pattern::PoolConsumer

Public Member Functions

 ConsoleClient (Context<> &ctx, istream &myCin=cin, ostream &myCout=cout, ostream &myCerr=cerr, string initCmd="")
 construct More...
 
char const * hmbdcName () const
 
void stoppedCb (exception const &e)
 
void handleJustBytesCb (uint16_t tag, uint8_t *bytes)
 callback for JustBytes More...
 
void waitUntilFinish ()
 wait until the console closes
 
- Public Member Functions inherited from hmbdc::app::Client< ConsoleClient< NetCtx >, JustBytes >
 Client ()
 trivial constructor
 
void messageDispatchingStartedCb (uint16_t threadSerialNumber) override
 called before any messages got dispatched - only once More...
 
void stoppedCb (std::exception const &e) override
 callback called when this Client is taken out of message dispatching More...
 
bool droppedCb () override
 callback called after the Client is safely taken out of the Context More...
 
void invokedCb (uint16_t threadSerialNumber) override
 this callback is called all the time (frequently) More...
 
char const * hmbdcName () const
 return the name of thread that runs this client, override if necessary More...
 
std::tuple< char const *, int > schedSpec () const
 an overrideable method. returns the schedule policy and priority, override if necessary priority is only used when policy is "SCHED_RR", or "SCHED_FIFO" More...
 
size_t maxBatchMessageCount () const
 an overridable method. client receives events in batches and the max batch size is controllable when running in direct mode Context. Here is to specify the max size. More...
 
void handleRangeImpl (BufIt &it, BufIt const &end, uint16_t threadSerialNumber) override
 internal use, don't change or override
 
- Public Member Functions inherited from hmbdc::app::MessageHandler< ConsoleClient< NetCtx >, Messages... >
void handleMessage (MessageHead &w)
 
- Public Member Functions inherited from hmbdc::pattern::PoolConsumer
 PoolConsumer (bool interestedInMessages=true)
 
void stopped (std::exception const &) noexcept
 
bool dropped () noexcept
 
void messageDispatchingStarted (uint16_t threadId)
 
void invoked (uint16_t threadId)
 

Static Public Member Functions

static char const * help ()
 documentation for all commands the console interprets More...
 
- Static Public Member Functions inherited from hmbdc::app::MessageHandler< ConsoleClient< NetCtx >, Messages... >
static void tryDispatch (ConsoleClient< NetCtx > *p, MessageHead &w)
 

Additional Inherited Members

- Public Types inherited from hmbdc::app::Client< ConsoleClient< NetCtx >, JustBytes >
enum  
 
- Protected Types inherited from hmbdc::pattern::PoolConsumer
using BufIt = lf_misc::iterator< HMBDC_SEQ_TYPE >
 

Detailed Description

template<typename NetCtx>
struct hmbdc::app::utils::ConsoleClient< NetCtx >

a Client that work as a console to send and receive network messages

a Client that receives all net messages deleived to the process it uses JustBytes to indicate it wants all the messages bytes regardless of their types - still Topic filtering is effective

Template Parameters
NetCtxsome NetContext type for a specific transport mechanism, for example mcast::NetContext, tcpcast::NetContext

Constructor & Destructor Documentation

template<typename NetCtx >
hmbdc::app::utils::ConsoleClient< NetCtx >::ConsoleClient ( Context<> &  ctx,
istream &  myCin = cin,
ostream &  myCout = cout,
ostream &  myCerr = cerr,
string  initCmd = "" 
)
inline

construct

just construct the Client - need to be run in the Context later

Parameters
ctxa runtime sized context that the Client will run in
myCinfor incoming commands
myCoutfor output
myCerrfor error

Member Function Documentation

template<typename NetCtx >
void hmbdc::app::utils::ConsoleClient< NetCtx >::handleJustBytesCb ( uint16_t  tag,
uint8_t *  bytes 
)
inline

callback for JustBytes

it is the user's responsibility to figure ouot the size of the message thru tag and interpret the bytes

Parameters
tagmessage tag - starting from 1000
bytescontents of the message - will not exceed the associated Context::maxMessageSize() return value
template<typename NetCtx >
static char const* hmbdc::app::utils::ConsoleClient< NetCtx >::help ( )
inlinestatic

documentation for all commands the console interprets

commands are seperated by
, when read eof, terminates console

Returns
a documentation string

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