SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
CommandMonitor Class Reference

#include <CommandMonitor.hxx>

Inheritance diagram for CommandMonitor:
SoDa::Thread SoDa::Base SoDa::Debug

Public Member Functions

void subscribeToMailBoxes (const std::vector< SoDa::MailBoxBasePtr > &mailboxes)
 connect to useful mailboxes.
void run ()
 Each thread object must define its "run" loop.
void execGetCommand (SoDa::CommandPtr cmd)
 execute GET commands from the command channel
void execSetCommand (SoDa::CommandPtr cmd)
 handle SET commands from the command channel
void execRepCommand (SoDa::CommandPtr cmd)
 handle Report commands from the command channel
void shutDown ()
 optional method that performs cleanup – may not delete.
void printReport ()
Public Member Functions inherited from SoDa::Thread
void registerThread (SoDa::ThreadPtr me)
virtual void subscribeToMailBoxes (const std::vector< MailBoxBasePtr > &mailboxes)=0
 the creator of this thread may offer one or more mailboxes to this object.
void operator() ()
void start ()
 Execute the thread's run loop.
void join ()
 more properly "Wait for this thread to exit its run loop".
void execCommand (CommandPtr cmd)
 Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions.
void sleep_ms (unsigned int milliseconds)
void sleep_us (unsigned int microseconds)
uint32_t getID ()
 Get the process/thread ID for this thread – helps with figuring out who caused a segfault.
Public Member Functions inherited from SoDa::Base
 Base (const std::string &oname)
 The constructor – pass a name for the object.
void registerSelf (BasePtr ptr)
std::string & getObjName ()
 get the name of this object
BasePtr findSoDaObject (const std::string &oname)
 find a SoDa Object by name.
double getTime ()
 Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS).
BasePtr getSelfPtr ()
 get a pointer to myself.
Public Member Functions inherited from SoDa::Debug
 Debug (std::string _unit_name=std::string("UNKNOWN"))
 Debug (const char *_unit_name_cstr)
 Debug (unsigned int _debug_level, std::string _unit_name=std::string("UNKNOWN"))
 Debug (unsigned int _debug_level, const char *_unit_name_cstr)
void debugMsg (const std::string &msg, unsigned int threshold=1)
void debugMsg (const SoDa::Format &fmt, unsigned int threshold=1)
void debugMsg (const char *msg, unsigned int threshold=1)
void setDebugLevel (unsigned int v)
unsigned int getDebugLevel ()

Static Public Member Functions

static CommandMonitorPtr make (const std::string &name)
Static Public Member Functions inherited from SoDa::Debug
static void setDefaultLevel (unsigned int v)
static unsigned int getDefaultLevel ()
static void setGlobalLevel (unsigned int v)
static unsigned int getGlobalLevel ()

Public Attributes

SoDa::CmdMBox::Subscription cmd_subs
 mailbox subscription ID for command stream
SoDa::CmdMBoxPtr cmd_stream
 mailbox producing command stream from user
unsigned int get_count
unsigned int set_count
unsigned int rep_count

Private Member Functions

 CommandMonitor (const std::string &name)

Additional Inherited Members

Static Public Attributes inherited from SoDa::Debug
static std::mutex debug_msg_mutex
Protected Member Functions inherited from SoDa::Thread
 Thread (const std::string &oname, const std::string &version=std::string("12.2.0"))
 make the thread object.
Protected Member Functions inherited from SoDa::Debug
std::string curDateTime ()
Protected Attributes inherited from SoDa::Thread
std::weak_ptr< Threadself
 A pointer to ourself.
Protected Attributes inherited from SoDa::Debug
std::string unit_name
 the name of the unit reporting status
unsigned int debug_level
 the debug level (threshold) for messages
Static Protected Attributes inherited from SoDa::Debug
static unsigned int default_debug_level
static unsigned int global_debug_level

Detailed Description

Definition at line 53 of file CommandMonitor.hxx.

Constructor & Destructor Documentation

◆ CommandMonitor()

CommandMonitor::CommandMonitor ( const std::string & name)
private

Referenced by make().

Member Function Documentation

◆ execGetCommand()

void CommandMonitor::execGetCommand ( SoDa::CommandPtr cmd)
inlinevirtual

execute GET commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

Definition at line 79 of file CommandMonitor.hxx.

References get_count.

◆ execRepCommand()

void CommandMonitor::execRepCommand ( SoDa::CommandPtr cmd)
inlinevirtual

handle Report commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

Definition at line 93 of file CommandMonitor.hxx.

References rep_count.

◆ execSetCommand()

void CommandMonitor::execSetCommand ( SoDa::CommandPtr cmd)
inlinevirtual

handle SET commands from the command channel

Parameters
cmdthe incoming command

Reimplemented from SoDa::Thread.

Definition at line 86 of file CommandMonitor.hxx.

References set_count.

◆ make()

CommandMonitorPtr CommandMonitor::make ( const std::string & name)
inlinestatic

Definition at line 59 of file CommandMonitor.hxx.

References CommandMonitor().

◆ printReport()

void CommandMonitor::printReport ( )

Referenced by shutDown().

◆ run()

void CommandMonitor::run ( )
virtual

Each thread object must define its "run" loop.

This loop exits only when the thread has received a STOP command on one of its command mailboxes.

Reimplemented from SoDa::Thread.

◆ shutDown()

void CommandMonitor::shutDown ( )
inlinevirtual

optional method that performs cleanup – may not delete.

Reimplemented from SoDa::Thread.

Definition at line 97 of file CommandMonitor.hxx.

References printReport().

◆ subscribeToMailBoxes()

void CommandMonitor::subscribeToMailBoxes ( const std::vector< SoDa::MailBoxBasePtr > & mailboxes)

connect to useful mailboxes.

Parameters
mailboxeslist of mailboxes to which we might subscribe.

Member Data Documentation

◆ cmd_stream

SoDa::CmdMBoxPtr CommandMonitor::cmd_stream

mailbox producing command stream from user

Definition at line 105 of file CommandMonitor.hxx.

◆ cmd_subs

SoDa::CmdMBox::Subscription CommandMonitor::cmd_subs

mailbox subscription ID for command stream

Definition at line 104 of file CommandMonitor.hxx.

◆ get_count

unsigned int CommandMonitor::get_count

Definition at line 107 of file CommandMonitor.hxx.

Referenced by execGetCommand().

◆ rep_count

unsigned int CommandMonitor::rep_count

Definition at line 107 of file CommandMonitor.hxx.

Referenced by execRepCommand().

◆ set_count

unsigned int CommandMonitor::set_count

Definition at line 107 of file CommandMonitor.hxx.

Referenced by execSetCommand().


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