- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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

A singleton for monitoring SimpleClient and ServerPeer connections. More...

`#include <gmonitor.h>`

Inheritance diagram for GNet::Monitor:

## 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...
Public Member Functions inherited from G::noncopyable
| noncopyable ()

## Static Public Member Functions
static Monitor * | instance ()
| Returns the singleton pointer. Returns null if none. More...

## Detailed Description

A singleton for monitoring SimpleClient and ServerPeer connections.

See also
  GNet::SimpleClient, GNet::ServerPeer

Definition at line 43 of file gmonitor.h.

## Constructor & Destructor Documentation

GNet::Monitor::Monitor | ( |  | ) |

Default constructor.

Definition at line 92 of file gmonitor.cpp.

References G_ASSERT.

GNet::Monitor::~Monitor | ( |  | ) |
| virtual

Destructor.

Definition at line 99 of file gmonitor.cpp.

## Member Function Documentation

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.

GNet::Monitor * GNet::Monitor::instance | ( |  | ) |
| 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.

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

- gmonitor.h
- gmonitor.cpp