Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

GtkStatsServer Class Reference

#include <gtkStatsServer.h>

Inheritance diagram for GtkStatsServer:

PStatServer ConnectionManager List of all members.

Public Member Functions

virtual PStatMonitormake_monitor ()
bool listen (int port=-1)
 Establishes a port number that the manager will listen on for TCP connections.

void poll ()
 Checks for any network activity and handles it, if appropriate, and then returns.

void main_loop (bool *interrupt_flag=NULL)
 An alternative to repeatedly calling poll(), this function yields control of the program to the PStatServer.

void add_reader (Connection *connection, PStatReader *reader)
 Adds the newly-created PStatReader to the list of currently active readers.

void add_reader (ConnectionReader *reader)
void remove_reader (Connection *connection, PStatReader *reader)
 Removes the indicated reader.

void remove_reader (ConnectionReader *reader)
int get_udp_port ()
 Returns a new port number that will probably be free to use as a UDP port.

void release_udp_port (int port)
 Indicates that the given UDP port is once again free for use.

virtual bool is_thread_safe ()
 This should be redefined to return true in derived classes that want to deal with multithreaded readers and such.

virtual void connection_reset (const PointerTo< Connection > &connection)=0
PointerTo< Connectionopen_UDP_connection (int port=0)
PointerTo< Connectionopen_TCP_server_rendezvous (int port, int backlog)
PointerTo< Connectionopen_TCP_client_connection (const NetAddress &address, int timeout_ms)
PointerTo< Connectionopen_TCP_client_connection (const string &hostname, int port, int timeout_ms)
bool close_connection (const PointerTo< Connection > &connection)
void new_connection (const PointerTo< Connection > &connection)
void add_writer (ConnectionWriter *writer)
void remove_writer (ConnectionWriter *writer)

Static Public Member Functions

string get_host_name ()

Public Attributes

pset< PointerTo< Connection > > Connections
pset< ConnectionWriter * > Writers
Connections _connections
Writers _writers
PRLock * _set_mutex

Friends

class ConnectionReader
class ConnectionWriter
class ConnectionListener
class Connection

Member Function Documentation

void PStatServer::add_reader Connection connection,
PStatReader reader
[inherited]
 

Adds the newly-created PStatReader to the list of currently active readers.

Definition at line 202 of file pStatServer.cxx.

References PStatServer::_available_udp_ports.

Referenced by PStatListener::PStatListener().

int PStatServer::get_udp_port  )  [inherited]
 

Returns a new port number that will probably be free to use as a UDP port.

The caller should be prepared to accept the possibility that it will be already in use by another process, however.

Definition at line 241 of file pStatServer.cxx.

References PStatServer::_lost_readers, PStatServer::_readers, and reader().

Referenced by PStatReader::close().

bool PStatServer::is_thread_safe  )  [virtual, inherited]
 

This should be redefined to return true in derived classes that want to deal with multithreaded readers and such.

If this returns true, the manager will create the listener in its own thread, and thus the PStatReader constructors at least will run in a different thread.

This is not related to the question of whether the reader can handle multiple different PStatThreadDatas; it's strictly a question of whether the readers themselves can run in a separate thread.

Definition at line 294 of file pStatServer.cxx.

bool PStatServer::listen int  port = -1  )  [inherited]
 

Establishes a port number that the manager will listen on for TCP connections.

This may be called more than once to listen simulataneously on multiple connections, as if that were at all useful.

The default parameter, -1, indicates the use of whatever port number has been indicated in the Config file.

This function returns true if the port was successfully opened, or false if it could not open the port.

Definition at line 84 of file pStatServer.cxx.

References PStatServer::_listener, PStatServer::_lost_readers, PStatServer::_readers, PStatServer::_removed_readers, ConnectionListener::poll(), and reader().

Referenced by TextStats::make_monitor().

void PStatServer::main_loop bool *  interrupt_flag = NULL  )  [inherited]
 

An alternative to repeatedly calling poll(), this function yields control of the program to the PStatServer.

It does not return until the program is done.

If interrupt_flag is non-NULL, it is the address of a bool variable that is initially false, and may be asynchronously set true to indicate the loop should terminate.

Definition at line 181 of file pStatServer.cxx.

References PStatServer::_available_udp_ports, and PStatServer::_next_udp_port.

PStatMonitor * GtkStatsServer::make_monitor  )  [virtual]
 

Implements PStatServer.

Definition at line 34 of file gtkStatsServer.cxx.

void PStatServer::poll  )  [inherited]
 

Checks for any network activity and handles it, if appropriate, and then returns.

This must be called periodically unless is_thread_safe() is redefined to return true on this class and also on all PStatMonitors in use.

Alternatively, a program may call main_loop() and yield control of the program entirely to the PStatServer.

Definition at line 132 of file pStatServer.cxx.

References NULL.

void PStatServer::release_udp_port int  port  )  [inherited]
 

Indicates that the given UDP port is once again free for use.

Definition at line 261 of file pStatServer.cxx.

void PStatServer::remove_reader Connection connection,
PStatReader reader
[inherited]
 

Removes the indicated reader.

Definition at line 215 of file pStatServer.cxx.

Referenced by PStatReader::~PStatReader().


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:27:13 2003 for Panda-Tool by doxygen1.3