Panda3D
Classes | Public Member Functions | Friends

PStatClientData Class Reference

The data associated with a particular client, but not with any one particular frame or thread: the list of collectors and threads, for instance. More...

#include "pStatClientData.h"

Inheritance diagram for PStatClientData:
PStatClientVersion ReferenceCount MemoryBase

List of all members.

Classes

class  Collector
class  Thread

Public Member Functions

 PStatClientData (PStatReader *reader)
void add_collector (PStatCollectorDef *def)
 Adds a new collector definition to the dataset.
void close ()
 Closes the client connection if it is open.
void define_thread (int thread_index, const string &name=string())
 Adds a new thread definition to the dataset.
int get_child_distance (int parent, int child) const
 Returns the number of Collectors between the indicated parent and the child Collector in the relationship graph.
const PStatCollectorDefget_collector_def (int index) const
 Returns the nth collector definition.
string get_collector_fullname (int index) const
 Returns the "full name" of the indicated collector.
bool get_collector_has_level (int index, int thread_index) const
 Returns whether the given collector has level data (and consequently, whether it should appear on the Levels menu).
string get_collector_name (int index) const
 Returns the name of the indicated collector.
int get_num_collectors () const
 Returns the total number of collectors the Data knows about.
int get_num_threads () const
 Returns the total number of threads the Data knows about.
int get_num_toplevel_collectors () const
 Returns the total number of collectors that are toplevel collectors.
const PStatThreadDataget_thread_data (int index) const
 Returns the data associated with the indicated thread.
string get_thread_name (int index) const
 Returns the name of the indicated thread.
int get_toplevel_collector (int index) const
 Returns the collector index of the nth toplevel collector.
bool has_collector (int index) const
 Returns true if the indicated collector has been defined by the client already, false otherwise.
bool has_thread (int index) const
 Returns true if the indicated thread has been defined by the client already, false otherwise.
bool is_alive () const
 Returns true if the data is actively getting filled by a connected client, or false if the client has terminated.
void record_new_frame (int thread_index, int frame_number, PStatFrameData *frame_data)
 Makes room for and stores a new frame's worth of data associated with some particular thread (which may or may not have already been defined).
bool set_collector_has_level (int index, int thread_index, bool flag)
 Indicates whether the given collector has level data (and consequently, whether it should appear on the Levels menu).

Friends

class PStatReader

Detailed Description

The data associated with a particular client, but not with any one particular frame or thread: the list of collectors and threads, for instance.

Definition at line 38 of file pStatClientData.h.


Member Function Documentation

void PStatClientData::add_collector ( PStatCollectorDef def)

Adds a new collector definition to the dataset.

Presumably this is information just arrived from the client.

The pointer will become owned by the PStatClientData object and will be freed on destruction.

Definition at line 314 of file pStatClientData.cxx.

References BitArray::get_bit(), BitArray::get_num_bits(), and set_collector_has_level().

void PStatClientData::close ( )

Closes the client connection if it is open.

Definition at line 67 of file pStatClientData.cxx.

References PStatReader::close().

void PStatClientData::define_thread ( int  thread_index,
const string &  name = string() 
)

Adds a new thread definition to the dataset.

Presumably this is information just arrived from the client.

Definition at line 345 of file pStatClientData.cxx.

Referenced by record_new_frame().

int PStatClientData::get_child_distance ( int  parent,
int  child 
) const

Returns the number of Collectors between the indicated parent and the child Collector in the relationship graph.

If child is the same as parent, returns zero. If child is an immediate child of parent, returns 1. If child is a grandchild of parent, returns 2, and so on. If child is not a descendant of parent at all, returns -1.

Definition at line 288 of file pStatClientData.cxx.

References get_collector_def(), and has_collector().

const PStatCollectorDef & PStatClientData::get_collector_def ( int  index) const
string PStatClientData::get_collector_fullname ( int  index) const

Returns the "full name" of the indicated collector.

This will be the concatenation of all of the collector's parents' names (except Frame) and the collector's own name.

Definition at line 136 of file pStatClientData.cxx.

References has_collector().

Referenced by PStatStripChart::get_title_text(), and TextMonitor::new_data().

bool PStatClientData::get_collector_has_level ( int  index,
int  thread_index 
) const

Returns whether the given collector has level data (and consequently, whether it should appear on the Levels menu).

Definition at line 193 of file pStatClientData.cxx.

Referenced by WinStatsChartMenu::do_update(), GtkStatsChartMenu::do_update(), and TextMonitor::new_data().

string PStatClientData::get_collector_name ( int  index) const

Returns the name of the indicated collector.

Definition at line 119 of file pStatClientData.cxx.

References has_collector().

int PStatClientData::get_num_collectors ( ) const

Returns the total number of collectors the Data knows about.

Definition at line 82 of file pStatClientData.cxx.

Referenced by PStatStripChart::update(), and PStatPianoRoll::update().

int PStatClientData::get_num_threads ( ) const

Returns the total number of threads the Data knows about.

Definition at line 231 of file pStatClientData.cxx.

Referenced by PStatStripChart::update(), and PStatPianoRoll::update().

int PStatClientData::get_num_toplevel_collectors ( ) const

Returns the total number of collectors that are toplevel collectors.

These are the collectors that are the children of "Frame", which is collector 0.

Definition at line 206 of file pStatClientData.cxx.

Referenced by WinStatsChartMenu::do_update(), GtkStatsChartMenu::do_update(), and TextMonitor::new_data().

const PStatThreadData * PStatClientData::get_thread_data ( int  index) const

Returns the data associated with the indicated thread.

This will create a thread definition if it does not already exist.

Definition at line 270 of file pStatClientData.cxx.

Referenced by WinStatsMonitor::idle(), GtkStatsMonitor::idle(), and PStatPianoRoll::update().

string PStatClientData::get_thread_name ( int  index) const

Returns the name of the indicated thread.

Definition at line 255 of file pStatClientData.cxx.

References has_thread().

Referenced by WinStatsChartMenu::add_to_menu_bar(), GtkStatsChartMenu::add_to_menu_bar(), PStatStripChart::get_title_text(), and TextMonitor::new_data().

int PStatClientData::get_toplevel_collector ( int  n) const

Returns the collector index of the nth toplevel collector.

Use this function to iterate through the n toplevel collectors indicated by get_num_toplevel_collectors().

Definition at line 219 of file pStatClientData.cxx.

Referenced by WinStatsChartMenu::do_update(), GtkStatsChartMenu::do_update(), and TextMonitor::new_data().

bool PStatClientData::has_collector ( int  index) const

Returns true if the indicated collector has been defined by the client already, false otherwise.

It is possible for the client to start streaming data before all of the collectors have been defined.

Definition at line 95 of file pStatClientData.cxx.

Referenced by WinStatsStripChart::clicked_label(), GtkStatsStripChart::clicked_label(), WinStatsChartMenu::do_update(), GtkStatsChartMenu::do_update(), get_child_distance(), get_collector_def(), get_collector_fullname(), get_collector_name(), PStatStripChart::get_title_text(), TextMonitor::new_data(), and PStatStripChart::set_default_vertical_scale().

bool PStatClientData::has_thread ( int  index) const

Returns true if the indicated thread has been defined by the client already, false otherwise.

It is possible for the client to start streaming data before all of the threads have been defined.

Definition at line 244 of file pStatClientData.cxx.

Referenced by get_thread_name(), and PStatStripChart::get_title_text().

bool PStatClientData::is_alive ( ) const

Returns true if the data is actively getting filled by a connected client, or false if the client has terminated.

Definition at line 57 of file pStatClientData.cxx.

void PStatClientData::record_new_frame ( int  thread_index,
int  frame_number,
PStatFrameData frame_data 
)

Makes room for and stores a new frame's worth of data associated with some particular thread (which may or may not have already been defined).

The pointer will become owned by the PStatThreadData object and will be freed on destruction.

Definition at line 375 of file pStatClientData.cxx.

References define_thread().

bool PStatClientData::set_collector_has_level ( int  index,
int  thread_index,
bool  flag 
)

Indicates whether the given collector has level data (and consequently, whether it should appear on the Levels menu).

The return value is true if anything changed, false otherwise.

Definition at line 160 of file pStatClientData.cxx.

Referenced by add_collector().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations