Panda3D
Public Member Functions | List of all members
TextMonitor Class Reference

A simple, scrolling-text stats monitor. More...

#include "textMonitor.h"

Inheritance diagram for TextMonitor:
PStatMonitor ReferenceCount MemoryBase

Public Member Functions

 TextMonitor (TextStats *server, std::ostream *outStream, bool show_raw_data)
 
virtual std::string get_monitor_name ()
 Should be redefined to return a descriptive name for the type of PStatsMonitor this is. More...
 
TextStatsget_server ()
 Returns the server that owns this monitor. 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 is_thread_safe ()
 Should be redefined to return true if this monitor class can handle running in a sub-thread. More...
 
virtual void lost_connection ()
 Called whenever the connection to the client has been lost. More...
 
virtual void new_data (int thread_index, int frame_number)
 Called as each frame's data is made available. More...
 
void show_level (const PStatViewLevel *level, int indent_level)
 
void show_ms (const PStatViewLevel *level, int indent_level)
 
- Public Member Functions inherited from PStatMonitor
 PStatMonitor (PStatServer *server)
 
void bad_version (const std::string &hostname, const std::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...
 
std::string get_client_hostname () const
 Returns the hostname of the client we're connected to, if known. More...
 
std::string get_client_progname () const
 Returns the program name of the client we're connected to, if known. More...
 
const LRGBColor & get_collector_color (int collector_index)
 Returns the color associated with the indicated collector. More...
 
std::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...
 
virtual bool has_idle ()
 Should be redefined to return true if you want to redefine idle() and expect it to be called. More...
 
void hello_from (const std::string &hostname, const std::string &progname)
 Called shortly after startup time with the greeting from the client. 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...
 
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 void new_collector (int collector_index)
 Called whenever a new Collector definition is received from the client. More...
 
virtual void new_thread (int thread_index)
 Called whenever a new Thread definition is received from the client. 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...
 
virtual void user_guide_bars_changed ()
 Called when the user guide bars have been changed. More...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
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 ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. 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...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Detailed Description

A simple, scrolling-text stats monitor.

Guaranteed to compile on every platform.

Definition at line 30 of file textMonitor.h.

Member Function Documentation

◆ get_monitor_name()

std::string TextMonitor::get_monitor_name ( )
virtual

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

Implements PStatMonitor.

Definition at line 43 of file textMonitor.cxx.

◆ get_server()

TextStats * TextMonitor::get_server ( )

Returns the server that owns this monitor.

Definition at line 34 of file textMonitor.cxx.

References PStatMonitor::get_server().

◆ got_bad_version()

void TextMonitor::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 65 of file textMonitor.cxx.

◆ got_hello()

void TextMonitor::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 52 of file textMonitor.cxx.

◆ is_thread_safe()

bool TextMonitor::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 163 of file textMonitor.cxx.

◆ lost_connection()

void TextMonitor::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 150 of file textMonitor.cxx.

◆ new_data()

void TextMonitor::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 83 of file textMonitor.cxx.

References PStatView::all_collectors_known(), PStatMonitor::get_client_data(), PStatThreadData::get_frame(), PStatThreadData::get_frame_rate(), PStatThreadData::get_latest_frame_number(), PStatView::get_net_value(), PStatFrameData::get_num_events(), PStatView::get_thread_data(), PStatClientData::get_thread_name(), PStatMonitor::get_view(), and PStatView::set_to_frame().


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