Panda3D
Classes | Public Member Functions | Friends | List of all members
WinStatsMonitor Class Reference

This class represents a connection to a PStatsClient and manages the data exchange with the client. More...

#include "winStatsMonitor.h"

Inheritance diagram for WinStatsMonitor:
PStatMonitor ReferenceCount MemoryBase

Classes

class  MenuDef
 

Public Member Functions

 WinStatsMonitor (WinStatsServer *server)
 
int get_menu_id (const MenuDef &menu_def)
 Returns the menu ID that is reserved for the indicated MenuDef properties. More...
 
virtual string get_monitor_name ()
 Should be redefined to return a descriptive name for the type of PStatsMonitor this is. More...
 
HWND get_window () const
 Returns the window handle to the monitor's window. More...
 
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. More...
 
virtual void got_hello ()
 Called when the "hello" message has been received from the client. More...
 
virtual bool has_idle ()
 Should be redefined to return true if you want to redefine idle() and expect it to be called. More...
 
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. More...
 
virtual void initialized ()
 Called after the monitor has been fully set up. More...
 
const MenuDeflookup_menu (int menu_id) const
 Returns the MenuDef properties associated with the indicated menu ID. More...
 
virtual void lost_connection ()
 Called whenever the connection to the client has been lost. More...
 
virtual void new_collector (int collector_index)
 Called whenever a new Collector definition is received from the client. More...
 
virtual void new_data (int thread_index, int frame_number)
 Called as each frame's data is made available. More...
 
virtual void new_thread (int thread_index)
 Called whenever a new Thread definition is received from the client. More...
 
void open_piano_roll (int thread_index)
 Opens a new piano roll showing the indicated data. More...
 
void open_strip_chart (int thread_index, int collector_index, bool show_level)
 Opens a new strip chart showing the indicated data. More...
 
void set_pause (bool pause)
 Called when the user selects a pause on or pause off option from the menu. More...
 
void set_scroll_speed (double scroll_speed)
 Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speeds for all graphs to the indicated value. More...
 
void set_time_units (int unit_mask)
 Called when the user selects a new time units from the monitor pulldown menu, this should adjust the units for all graphs to the indicated mask if it is a time-based graph. More...
 
virtual void user_guide_bars_changed ()
 Called when the user guide bars have been changed. More...
 
- Public Member Functions inherited from PStatMonitor
 PStatMonitor (PStatServer *server)
 
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. More...
 
void close ()
 Closes the client connection if it is active. More...
 
const PStatClientDataget_client_data () const
 Returns the client data associated with this monitor. More...
 
string get_client_hostname () const
 Returns the hostname of the client we're connected to, if known. More...
 
string get_client_progname () const
 Returns the program name of the client we're connected to, if known. More...
 
const LRGBColorget_collector_color (int collector_index)
 Returns the color associated with the indicated collector. More...
 
string get_collector_name (int collector_index)
 Returns the name of the indicated collector, if it is known. More...
 
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. More...
 
PStatServerget_server ()
 Returns the server that owns this monitor. More...
 
PStatViewget_view (int thread_index)
 Returns a view on the given thread index. More...
 
void hello_from (const string &hostname, const string &progname)
 Called shortly after startup time with the greeting from the client. More...
 
bool is_alive () const
 Returns true if the client is alive and connected, false otherwise. More...
 
bool is_client_known () const
 Returns true if we've yet received the "hello" message from the client indicating its name, etc. More...
 
virtual bool is_thread_safe ()
 Should be redefined to return true if this monitor class can handle running in a sub-thread. More...
 
void set_client_data (PStatClientData *client_data)
 Called by the PStatServer at setup time to set the new data pointer for the first time. More...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 Returns the current reference count. More...
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Friends

class WinStatsGraph
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Detailed Description

This class represents a connection to a PStatsClient and manages the data exchange with the client.

Definition at line 37 of file winStatsMonitor.h.

Member Function Documentation

◆ get_menu_id()

int WinStatsMonitor::get_menu_id ( const MenuDef menu_def)

Returns the menu ID that is reserved for the indicated MenuDef properties.

If this is the first time these particular properties have been requested, a new menu ID is returned; otherwise, the existing menu ID is returned.

Definition at line 352 of file winStatsMonitor.cxx.

References set_time_units().

Referenced by lookup_menu().

◆ get_monitor_name()

string WinStatsMonitor::get_monitor_name ( )
virtual

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

Implements PStatMonitor.

Definition at line 82 of file winStatsMonitor.cxx.

References initialized().

◆ get_window()

HWND WinStatsMonitor::get_window ( ) const

Returns the window handle to the monitor's window.

Definition at line 292 of file winStatsMonitor.cxx.

References open_strip_chart().

Referenced by WinStatsPianoRoll::set_horizontal_scale(), WinStatsStripChart::set_vertical_scale(), and user_guide_bars_changed().

◆ got_bad_version()

void WinStatsMonitor::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 126 of file winStatsMonitor.cxx.

References new_collector().

Referenced by got_hello().

◆ got_hello()

void WinStatsMonitor::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 109 of file winStatsMonitor.cxx.

References got_bad_version().

Referenced by initialized().

◆ has_idle()

bool WinStatsMonitor::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 268 of file winStatsMonitor.cxx.

References user_guide_bars_changed().

Referenced by idle().

◆ idle()

void WinStatsMonitor::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 237 of file winStatsMonitor.cxx.

References PStatThreadData::get_frame_rate(), and has_idle().

Referenced by lost_connection().

◆ initialized()

void WinStatsMonitor::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 98 of file winStatsMonitor.cxx.

References got_hello().

Referenced by get_monitor_name().

◆ lookup_menu()

const WinStatsMonitor::MenuDef & WinStatsMonitor::lookup_menu ( int  menu_id) const

Returns the MenuDef properties associated with the indicated menu ID.

This specifies what we expect to do when the given menu has been selected.

Definition at line 335 of file winStatsMonitor.cxx.

References get_menu_id().

Referenced by open_piano_roll().

◆ lost_connection()

void WinStatsMonitor::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 220 of file winStatsMonitor.cxx.

References idle().

Referenced by new_data().

◆ new_collector()

void WinStatsMonitor::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 159 of file winStatsMonitor.cxx.

References WinStatsGraph::new_collector(), and new_thread().

Referenced by got_bad_version().

◆ new_data()

void WinStatsMonitor::new_data ( int  thread_index,
int  frame_number 
)
virtual

Called as each frame's data is made available.

There is no guarantee 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 202 of file winStatsMonitor.cxx.

References lost_connection(), and WinStatsGraph::new_data().

Referenced by new_thread().

◆ new_thread()

void WinStatsMonitor::new_thread ( int  thread_index)
virtual

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.

Reimplemented from PStatMonitor.

Definition at line 185 of file winStatsMonitor.cxx.

References WinStatsChartMenu::add_to_menu_bar(), and new_data().

Referenced by new_collector().

◆ open_piano_roll()

void WinStatsMonitor::open_piano_roll ( int  thread_index)

Opens a new piano roll showing the indicated data.

Definition at line 318 of file winStatsMonitor.cxx.

References lookup_menu(), WinStatsGraph::set_pause(), WinStatsGraph::set_scroll_speed(), and WinStatsPianoRoll::set_time_units().

Referenced by open_strip_chart().

◆ open_strip_chart()

void WinStatsMonitor::open_strip_chart ( int  thread_index,
int  collector_index,
bool  show_level 
)

Opens a new strip chart showing the indicated data.

Definition at line 302 of file winStatsMonitor.cxx.

References open_piano_roll(), WinStatsGraph::set_pause(), WinStatsStripChart::set_scroll_speed(), and WinStatsStripChart::set_time_units().

Referenced by WinStatsPianoRoll::clicked_label(), and get_window().

◆ set_pause()

void WinStatsMonitor::set_pause ( bool  pause)

Called when the user selects a pause on or pause off option from the menu.

Definition at line 453 of file winStatsMonitor.cxx.

References WinStatsGraph::set_pause().

Referenced by set_scroll_speed().

◆ set_scroll_speed()

void WinStatsMonitor::set_scroll_speed ( double  scroll_speed)

Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speeds for all graphs to the indicated value.

Definition at line 409 of file winStatsMonitor.cxx.

References set_pause(), and WinStatsGraph::set_scroll_speed().

Referenced by set_time_units().

◆ set_time_units()

void WinStatsMonitor::set_time_units ( int  unit_mask)

Called when the user selects a new time units from the monitor pulldown menu, this should adjust the units for all graphs to the indicated mask if it is a time-based graph.

Definition at line 376 of file winStatsMonitor.cxx.

References set_scroll_speed(), and WinStatsGraph::set_time_units().

Referenced by get_menu_id().

◆ user_guide_bars_changed()

void WinStatsMonitor::user_guide_bars_changed ( )
virtual

Called when the user guide bars have been changed.

Reimplemented from PStatMonitor.

Definition at line 278 of file winStatsMonitor.cxx.

References get_window(), and WinStatsGraph::user_guide_bars_changed().

Referenced by has_idle().


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