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

GtkStatsMonitor Class Reference

#include <gtkStatsMonitor.h>

Inheritance diagram for GtkStatsMonitor:

PStatMonitor ReferenceCount List of all members.

Public Types

typedef pset< GtkStatsWindow * > Windows

Public Member Functions

 GtkStatsMonitor ()
 ~GtkStatsMonitor ()
PointerTo< PStatMonitorclose_all_windows ()
 Closes all the windows associated with this client.

virtual string get_monitor_name ()
 Should be redefined to return a descriptive name for the type of PStatsMonitor this is.

virtual void initialized ()
 Called after the monitor has been fully set up.

virtual void got_hello ()
 Called when the "hello" message has been received from the client.

virtual void got_bad_version (int client_major, int client_minor, int server_major, int server_minor)
 Like got_hello(), this is called when the "hello" message has been received from the client.

virtual void new_collector (int collector_index)
 Called whenever a new Collector definition is received from the client.

virtual void new_data (int thread_index, int frame_number)
 Called as each frame's data is made available.

virtual void lost_connection ()
 Called whenever the connection to the client has been lost.

virtual void idle ()
 If has_idle() returns true, this will be called periodically to allow the monitor to update its display or whatever it needs to do.

virtual bool has_idle ()
 Should be redefined to return true if you want to redefine idle() and expect it to be called.

virtual bool is_thread_safe ()
 Should be redefined to return true if this monitor class can handle running in a sub-thread.

void add_window (GtkStatsWindow *window)
 Called only from the GtkStatsWindow constructor, this indicates a new window that we should track.

void remove_window (GtkStatsWindow *window)
 Called only from the GtkStatsWindow destructor, this indicates the end of a window that we should now no longer track.

void hello_from (const string &hostname, const string &progname)
 Called shortly after startup time with the greeting from the client.

void bad_version (const string &hostname, const string &progname, int client_major, int client_minor, int server_major, int server_minor)
 Called shortly after startup time with the greeting from the client.

void set_client_data (PStatClientData *client_data)
 Called by the PStatServer at setup time to set the new data pointer for the first time.

bool is_alive () const
 Returns true if the client is alive and connected, false otherwise.

void close ()
 Closes the client connection if it is active.

const PStatClientDataget_client_data () const
 Returns the client data associated with this monitor.

string get_collector_name (int collector_index)
 Returns the name of the indicated collector, if it is known.

const RGBColorfget_collector_color (int collector_index)
 Returns the color associated with the indicated collector.

bool is_client_known () const
 Returns true if we've yet received the "hello" message from the client indicating its name, etc.

string get_client_hostname () const
 Returns the hostname of the client we're connected to, if known.

string get_client_progname () const
 Returns the program name of the client we're connected to, if known.

PStatViewget_view (int thread_index)
 Returns a view on the given thread index.

PStatViewget_level_view (int collector_index, int thread_index)
 Returns a view on the level value (as opposed to elapsed time) for the given collector over the given thread.

virtual void new_thread (int thread_index)
 Called whenever a new Thread definition is received from the client.

int get_ref_count () const
int ref () const
int unref () const
void test_ref_count_integrity () const

Static Public Member Functions

TypeHandle get_class_type ()
void init_type ()

Public Attributes

Windows _windows
bool _destructing
bool _new_collector

Protected Attributes

int _ref_count

Static Protected Attributes

TypeHandle _type_handle

Member Typedef Documentation

typedef pset<GtkStatsWindow *> GtkStatsMonitor::Windows
 

Definition at line 66 of file gtkStatsMonitor.h.


Constructor & Destructor Documentation

GtkStatsMonitor::GtkStatsMonitor  ) 
 

Definition at line 40 of file gtkStatsMonitor.cxx.

References _destructing, _windows, and GtkStatsWindow::destruct().

GtkStatsMonitor::~GtkStatsMonitor  ) 
 

Definition at line 53 of file gtkStatsMonitor.cxx.


Member Function Documentation

void GtkStatsMonitor::add_window GtkStatsWindow window  ) 
 

Called only from the GtkStatsWindow constructor, this indicates a new window that we should track.

Definition at line 319 of file gtkStatsMonitor.cxx.

void PStatMonitor::bad_version const string &  hostname,
const string &  progname,
int  client_major,
int  client_minor,
int  server_major,
int  server_minor
[inherited]
 

Called shortly after startup time with the greeting from the client.

In this case, the client seems to have an incompatible version and will be automatically disconnected; the server should issue a message to that effect.

Definition at line 87 of file pStatMonitor.cxx.

void PStatMonitor::close  )  [inherited]
 

Closes the client connection if it is active.

Definition at line 141 of file pStatMonitor.cxx.

References PStatMonitor::_colors.

Referenced by lost_connection().

PointerTo< PStatMonitor > GtkStatsMonitor::close_all_windows  ) 
 

Closes all the windows associated with this client.

This returns a PointerTo itself, just to guarantee that the monitor won't destruct until the function returns (as it might, if there were no other pointers to it).

Definition at line 80 of file gtkStatsMonitor.cxx.

Referenced by initialized().

const PStatClientData * PStatMonitor::get_client_data  )  const [inline, inherited]
 

Returns the client data associated with this monitor.

Definition at line 32 of file pStatMonitor.I.

References PStatMonitor::_client_data, INLINE, and PointerTo< PStatClientData >::is_null().

Referenced by PStatStripChart::new_data().

string PStatMonitor::get_client_hostname  )  const [inline, inherited]
 

Returns the hostname of the client we're connected to, if known.

This may not be known immediately at creation time, but should be learned shortly thereafter when we receive the client's "hello" message. See is_client_known().

Definition at line 87 of file pStatMonitor.I.

Referenced by TextMonitor::get_monitor_name(), and TextMonitor::got_hello().

string PStatMonitor::get_client_progname  )  const [inline, inherited]
 

Returns the program name of the client we're connected to, if known.

This may not be known immediately at creation time, but should be learned shortly thereafter when we receive the client's "hello" message. See is_client_known().

Definition at line 108 of file pStatMonitor.I.

Referenced by TextMonitor::get_monitor_name(), and TextMonitor::got_hello().

const RGBColorf & PStatMonitor::get_collector_color int  collector_index  )  [inherited]
 

Returns the color associated with the indicated collector.

If the collector has no associated color, or is unknown, a new color will be made up on the spot and associated with this collector for the rest of the session.

Definition at line 164 of file pStatMonitor.cxx.

References PStatMonitor::_client_data, and PStatMonitor::_views.

Referenced by GtkStatsStripChart::get_labels().

string PStatMonitor::get_collector_name int  collector_index  )  [inline, inherited]
 

Returns the name of the indicated collector, if it is known.

Definition at line 47 of file pStatMonitor.I.

References PStatMonitor::_client_known, and INLINE.

PStatView & PStatMonitor::get_level_view int  collector_index,
int  thread_index
[inherited]
 

Returns a view on the level value (as opposed to elapsed time) for the given collector over the given thread.

If there is no such view already for the indicated thread, this will create one.

Definition at line 233 of file pStatMonitor.cxx.

string GtkStatsMonitor::get_monitor_name  )  [virtual]
 

Should be redefined to return a descriptive name for the type of PStatsMonitor this is.

Implements PStatMonitor.

Definition at line 101 of file gtkStatsMonitor.cxx.

PStatView & PStatMonitor::get_view int  thread_index  )  [inherited]
 

Returns a view on the given thread index.

If there is no such view already for the indicated thread, this will create one. This view can be used to examine the accumulated data for the given thread.

Definition at line 208 of file pStatMonitor.cxx.

void GtkStatsMonitor::got_bad_version int  client_major,
int  client_minor,
int  server_major,
int  server_minor
[virtual]
 

Like got_hello(), this is called when the "hello" message has been received from the client.

At this time, the client's hostname and program name will be known. However, the client appears to be an incompatible version and the connection will be terminated; the monitor should issue a message to that effect.

Reimplemented from PStatMonitor.

Definition at line 172 of file gtkStatsMonitor.cxx.

References _windows.

void GtkStatsMonitor::got_hello  )  [virtual]
 

Called when the "hello" message has been received from the client.

At this time, the client's hostname and program name will be known.

Reimplemented from PStatMonitor.

Definition at line 144 of file gtkStatsMonitor.cxx.

References _new_collector.

bool GtkStatsMonitor::has_idle  )  [virtual]
 

Should be redefined to return true if you want to redefine idle() and expect it to be called.

Reimplemented from PStatMonitor.

Definition at line 279 of file gtkStatsMonitor.cxx.

void PStatMonitor::hello_from const string &  hostname,
const string &  progname
[inherited]
 

Called shortly after startup time with the greeting from the client.

This indicates the client's reported hostname and program name.

Definition at line 63 of file pStatMonitor.cxx.

References PStatMonitor::_client_hostname, PStatMonitor::_client_known, PStatMonitor::_client_progname, and PStatMonitor::got_bad_version().

void GtkStatsMonitor::idle  )  [virtual]
 

If has_idle() returns true, this will be called periodically to allow the monitor to update its display or whatever it needs to do.

Reimplemented from PStatMonitor.

Definition at line 260 of file gtkStatsMonitor.cxx.

void GtkStatsMonitor::initialized  )  [virtual]
 

Called after the monitor has been fully set up.

At this time, it will have a valid _client_data pointer, and things like is_alive() and close() will be meaningful. However, we may not yet know who we're connected to (is_client_known() may return false), and we may not know anything about the threads or collectors we're about to get data on.

Reimplemented from PStatMonitor.

Definition at line 126 of file gtkStatsMonitor.cxx.

References close_all_windows().

bool PStatMonitor::is_alive  )  const [inherited]
 

Returns true if the client is alive and connected, false otherwise.

Definition at line 124 of file pStatMonitor.cxx.

References PStatMonitor::_client_data, PStatMonitor::_colors, PStatCollectorDef::_suggested_color, PointerTo< PStatClientData >::is_null(), RGBColorf, and zero.

bool PStatMonitor::is_client_known  )  const [inline, inherited]
 

Returns true if we've yet received the "hello" message from the client indicating its name, etc.

Definition at line 66 of file pStatMonitor.I.

References PStatMonitor::_client_hostname.

bool GtkStatsMonitor::is_thread_safe  )  [virtual]
 

Should be redefined to return true if this monitor class can handle running in a sub-thread.

This is not related to the question of whether it can handle multiple different PStatThreadDatas; this is strictly a question of whether or not the monitor itself wants to run in a sub-thread.

Reimplemented from PStatMonitor.

Definition at line 304 of file gtkStatsMonitor.cxx.

void GtkStatsMonitor::lost_connection  )  [virtual]
 

Called whenever the connection to the client has been lost.

This is a permanent state change. The monitor should update its display to represent this, and may choose to close down automatically.

Reimplemented from PStatMonitor.

Definition at line 240 of file gtkStatsMonitor.cxx.

References _destructing, _windows, PStatMonitor::close(), and nassertv.

void GtkStatsMonitor::new_collector int  collector_index  )  [virtual]
 

Called whenever a new Collector definition is received from the client.

Generally, the client will send all of its collectors over shortly after connecting, but there's no guarantee that they will all be received before the first frames are received. The monitor should be prepared to accept new Collector definitions midstream.

Reimplemented from PStatMonitor.

Definition at line 200 of file gtkStatsMonitor.cxx.

void GtkStatsMonitor::new_data int  thread_index,
int  frame_number
[virtual]
 

Called as each frame's data is made available.

There is no gurantee the frames will arrive in order, or that all of them will arrive at all. The monitor should be prepared to accept frames received out-of-order or missing.

Reimplemented from PStatMonitor.

Definition at line 221 of file gtkStatsMonitor.cxx.

void PStatMonitor::new_thread int  thread_index  )  [virtual, inherited]
 

Called whenever a new Thread definition is received from the client.

Generally, the client will send all of its threads over shortly after connecting, but there's no guarantee that they will all be received before the first frames are received. The monitor should be prepared to accept new Thread definitions midstream.

Definition at line 360 of file pStatMonitor.cxx.

void GtkStatsMonitor::remove_window GtkStatsWindow window  ) 
 

Called only from the GtkStatsWindow destructor, this indicates the end of a window that we should now no longer track.

When the last window is deleted, this automatically closes the connection.

Definition at line 344 of file gtkStatsMonitor.cxx.

void PStatMonitor::set_client_data PStatClientData client_data  )  [inherited]
 

Called by the PStatServer at setup time to set the new data pointer for the first time.

Definition at line 108 of file pStatMonitor.cxx.

References PStatMonitor::_client_data, and PointerTo< PStatClientData >::is_null().


Member Data Documentation

bool GtkStatsMonitor::_destructing
 

Definition at line 69 of file gtkStatsMonitor.h.

Referenced by GtkStatsMonitor(), and lost_connection().

bool GtkStatsMonitor::_new_collector
 

Definition at line 70 of file gtkStatsMonitor.h.

Referenced by got_hello().

Windows GtkStatsMonitor::_windows
 

Definition at line 67 of file gtkStatsMonitor.h.

Referenced by got_bad_version(), GtkStatsMonitor(), and lost_connection().


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