- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gmonitor.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2013 Graeme Walker <graeme_walker@users.sourceforge.net>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
20
21 #ifndef G_GNET_MONITOR_H
22 #define G_GNET_MONITOR_H
23
24 #include "gdef.h"
25 #include "gslot.h"
26 #include "gnet.h"
27 #include "gconnection.h"
28 #include "gnoncopyable.h"
29 #include <iostream>
30 #include <utility>
31
33 namespace GNet
34 {
35 class Monitor ;
36 class MonitorImp ;
37 }
38
43 class GNet::Monitor : public G::noncopyable
44 {
45 public:
46 Monitor() ;
48
49 virtual ~Monitor() ;
51
52 static Monitor * instance() ;
54
55 void addClient( const Connection & simple_client ) ;
57
58 void removeClient( const Connection & simple_client ) ;
60
61 void addServerPeer( const Connection & server_peer ) ;
63
64 void removeServerPeer( const Connection & server_peer ) ;
66
67 void report( std::ostream & stream ,
68 const std::string & line_prefix = std::string() ,
69 const std::string & eol = std::string("\n") ) const ;
71
72 std::pair<std::string,bool> findCertificate( const std::string & certificate ) ;
76
77 G::Signal2<std::string,std::string> & signal() ;
84
85 private:
86 static Monitor * & pthis() ;
87 MonitorImp * m_imp ;
88 G::Signal2<std::string,std::string> m_signal ;
89 } ;
90
91 #endif
GNet::Monitor::removeServerPeer
void removeServerPeer(const Connection &server_peer)
Removes a server connection.
Definition: gmonitor.cpp:134
G::noncopyable
A noncopyable base class (a la boost).
Definition: gnoncopyable.h:35
G::Signal2< std::string, std::string >
GNet
Network classes.
GNet::Monitor::report
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.
Definition: gmonitor.cpp:145
GNet::Monitor::signal
G::Signal2< std::string, std::string > & signal()
Provides a callback signal which can be connect()ed to a slot.
Definition: gmonitor.cpp:110
GNet::Monitor::addClient
void addClient(const Connection &simple_client)
Adds a client connection.
Definition: gmonitor.cpp:115
gslot.h
GNet::MonitorImp
A pimple pattern implementation class for GNet::Monitor.
Definition: gmonitor.cpp:35
GNet::Monitor
A singleton for monitoring SimpleClient and ServerPeer connections.
Definition: gmonitor.h:43
GNet::Monitor::instance
static Monitor * instance()
Returns the singleton pointer. Returns null if none.
Definition: gmonitor.cpp:105
GNet::Monitor::~Monitor
virtual ~Monitor()
Destructor.
Definition: gmonitor.cpp:99
GNet::Monitor::removeClient
void removeClient(const Connection &simple_client)
Removes a client connection.
Definition: gmonitor.cpp:121
GNet::Monitor::addServerPeer
void addServerPeer(const Connection &server_peer)
Adds a server connection.
Definition: gmonitor.cpp:127
gnoncopyable.h
GNet::Connection
An interface which provides address information for a network connection.
Definition: gconnection.h:39
GNet::Monitor::findCertificate
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 certificat...
Definition: gmonitor.cpp:140
gconnection.h
GNet::Monitor::Monitor
Monitor()
Default constructor.
Definition: gmonitor.cpp:92