A singleton for monitoring SimpleClient and ServerPeer connections. More...
#include <gmonitor.h>
Public Member Functions | |
Monitor () | |
Default constructor. More... | |
virtual | ~Monitor () |
Destructor. More... | |
void | addClient (const Connection &simple_client) |
Adds a client connection. More... | |
void | removeClient (const Connection &simple_client) |
Removes a client connection. More... | |
void | addServerPeer (const Connection &server_peer) |
Adds a server connection. More... | |
void | removeServerPeer (const Connection &server_peer) |
Removes a server connection. 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... | |
std::pair< std::string, bool > | findCertificate (const std::string &certificate) |
Returns a short id for the given certificate and a boolean flag to indicate if it is a new certificate id that has not been returned before. More... | |
G::Signal2< std::string, std::string > & | signal () |
Provides a callback signal which can be connect()ed to a slot. More... | |
![]() | |
noncopyable () | |
Static Public Member Functions | |
static Monitor * | instance () |
Returns the singleton pointer. Returns null if none. More... | |
A singleton for monitoring SimpleClient and ServerPeer connections.
Definition at line 43 of file gmonitor.h.
GNet::Monitor::Monitor | ( | ) |
|
virtual |
Destructor.
Definition at line 99 of file gmonitor.cpp.
void GNet::Monitor::addClient | ( | const Connection & | simple_client | ) |
Adds a client connection.
Definition at line 115 of file gmonitor.cpp.
Referenced by GNet::SimpleClient::SimpleClient().
void GNet::Monitor::addServerPeer | ( | const Connection & | server_peer | ) |
Adds a server connection.
Definition at line 127 of file gmonitor.cpp.
Referenced by GNet::ServerPeer::ServerPeer().
std::pair< std::string, bool > GNet::Monitor::findCertificate | ( | const std::string & | certificate | ) |
Returns a short id for the given certificate and a boolean flag to indicate if it is a new certificate id that has not been returned before.
Definition at line 140 of file gmonitor.cpp.
|
static |
Returns the singleton pointer. Returns null if none.
Definition at line 105 of file gmonitor.cpp.
Referenced by GNet::ServerPeer::ServerPeer(), GNet::SimpleClient::SimpleClient(), GNet::ServerPeer::~ServerPeer(), and GNet::SimpleClient::~SimpleClient().
void GNet::Monitor::removeClient | ( | const Connection & | simple_client | ) |
Removes a client connection.
Definition at line 121 of file gmonitor.cpp.
Referenced by GNet::SimpleClient::~SimpleClient().
void GNet::Monitor::removeServerPeer | ( | const Connection & | server_peer | ) |
Removes a server connection.
Definition at line 134 of file gmonitor.cpp.
Referenced by GNet::ServerPeer::~ServerPeer().
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 145 of file gmonitor.cpp.
G::Signal2< std::string, 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" or "out", and the second is "start" or "stop".
Definition at line 110 of file gmonitor.cpp.