E-MailRelay
Public Member Functions | Static Public Member Functions | List of all members
GNet::Monitor Class Reference

A singleton for monitoring GNet::Client and GNet::ServerPeer connections. More...

#include <gmonitor.h>

Public Member Functions

 Monitor ()
 Default constructor. More...
 
 ~Monitor ()
 Destructor. More...
 
void report (std::ostream &stream, const std::string &line_prefix=std::string(), const std::string &eol=std::string("\n")) const
 Reports itself onto a stream. More...
 
void report (G::StringArray &out) const
 Reports itself into a three-column table (ordered with the column index varying fastest). More...
 
G::Slot::Signal< const std::string &, const std::string & > & signal ()
 Provides a callback signal which can be connect()ed to a slot. More...
 
 Monitor (const Monitor &)=delete
 
 Monitor (Monitor &&)=delete
 
void operator= (const Monitor &)=delete
 
void operator= (Monitor &&)=delete
 

Static Public Member Functions

static Monitorinstance ()
 Returns the singleton pointer. Returns nullptr if none. More...
 
static void addClient (const Connection &client)
 Adds a client connection. More...
 
static void removeClient (const Connection &client) noexcept
 Removes a client connection. More...
 
static void addServerPeer (const Connection &server_peer)
 Adds a server connection. More...
 
static void removeServerPeer (const Connection &server_peer) noexcept
 Removes a server connection. More...
 
static void addServer (const Listener &server)
 Adds a server. More...
 
static void removeServer (const Listener &server) noexcept
 Removes a server. More...
 

Detailed Description

A singleton for monitoring GNet::Client and GNet::ServerPeer connections.

See also
GNet::Client, GNet::ServerPeer

Definition at line 42 of file gmonitor.h.

Constructor & Destructor Documentation

◆ Monitor()

GNet::Monitor::Monitor ( )

Default constructor.

Definition at line 86 of file gmonitor.cpp.

◆ ~Monitor()

GNet::Monitor::~Monitor ( )

Destructor.

Definition at line 93 of file gmonitor.cpp.

Member Function Documentation

◆ addClient()

void GNet::Monitor::addClient ( const Connection client)
static

Adds a client connection.

Definition at line 108 of file gmonitor.cpp.

◆ addServer()

void GNet::Monitor::addServer ( const Listener server)
static

Adds a server.

Definition at line 145 of file gmonitor.cpp.

◆ addServerPeer()

void GNet::Monitor::addServerPeer ( const Connection server_peer)
static

Adds a server connection.

Definition at line 126 of file gmonitor.cpp.

◆ instance()

GNet::Monitor * GNet::Monitor::instance ( )
static

Returns the singleton pointer. Returns nullptr if none.

Definition at line 98 of file gmonitor.cpp.

◆ removeClient()

void GNet::Monitor::removeClient ( const Connection client)
staticnoexcept

Removes a client connection.

Definition at line 117 of file gmonitor.cpp.

◆ removeServer()

void GNet::Monitor::removeServer ( const Listener server)
staticnoexcept

Removes a server.

Definition at line 154 of file gmonitor.cpp.

◆ removeServerPeer()

void GNet::Monitor::removeServerPeer ( const Connection server_peer)
staticnoexcept

Removes a server connection.

Definition at line 136 of file gmonitor.cpp.

◆ report() [1/2]

void GNet::Monitor::report ( G::StringArray out) const

Reports itself into a three-column table (ordered with the column index varying fastest).

Definition at line 168 of file gmonitor.cpp.

◆ report() [2/2]

void GNet::Monitor::report ( std::ostream &  stream,
const std::string &  line_prefix = std::string(),
const std::string &  eol = std::string("\n") 
) const

Reports itself onto a stream.

Definition at line 163 of file gmonitor.cpp.

◆ signal()

G::Slot::Signal< const std::string &, const std::string & > & GNet::Monitor::signal ( )

Provides a callback signal which can be connect()ed to a slot.

The signal emits events with two string parameters: the first is "in", "out" or "listen", and the second is "start" or "stop".

Definition at line 103 of file gmonitor.cpp.


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