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

PStatThreadData Class Reference

A collection of FrameData structures for recently-received frames within a particular thread. More...

#include <pStatThreadData.h>

Inheritance diagram for PStatThreadData:

ReferenceCount List of all members.

Public Member Functions

 PStatThreadData (const PStatClientData *client_data)
 ~PStatThreadData ()
const PStatClientDataget_client_data () const
 Returns a pointer to the ClientData structure associated with this data.

bool is_empty () const
 Returns true if the structure contains no frames, false otherwise.

int get_latest_frame_number () const
 Returns the frame number of the most recent frame stored in the data.

int get_oldest_frame_number () const
 Returns the frame number of the oldest frame still stored in the data.

bool has_frame (int frame_number) const
 Returns true if we have received data for the indicated frame number from the client and we still have it stored, or false otherwise.

const PStatFrameDataget_frame (int frame_number) const
 Returns a FrameData structure associated with the indicated frame number.

float get_latest_time () const
 Returns the timestamp (in seconds elapsed since connection) of the latest available frame.

float get_oldest_time () const
 Returns the timestamp (in seconds elapsed since connection) of the oldest available frame.

const PStatFrameDataget_frame_at_time (float time) const
 Returns the FrameData structure associated with the latest frame not later than the indicated time.

int get_frame_number_at_time (float time, int hint=-1) const
 Returns the frame number of the latest frame not later than the indicated time.

const PStatFrameDataget_latest_frame () const
 Returns the FrameData associated with the most recent frame.

float get_frame_rate (float time=3.0) const
 Computes the average frame rate over the past number of seconds, by counting up the number of frames elapsed in that time interval.

void set_history (float time)
 Sets the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added.

float get_history () const
 Returns the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added.

void record_new_frame (int frame_number, PStatFrameData *frame_data)
 Makes room for and stores a new frame's worth of data.

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 ()

Protected Attributes

int _ref_count

Static Protected Attributes

TypeHandle _type_handle

Private Types

typedef pdeque< PStatFrameData * > Frames

Private Attributes

const PStatClientData_client_data
Frames _frames
int _first_frame_number
float _history

Static Private Attributes

PStatFrameData _null_frame

Detailed Description

A collection of FrameData structures for recently-received frames within a particular thread.

This holds the raw data as reported by the client, and it automatically handles frames received out-of-order or skipped. You can ask for a particular frame by frame number or time and receive the data for the nearest frame.

Definition at line 54 of file pStatThreadData.h.


Member Typedef Documentation

typedef pdeque<PStatFrameData *> PStatThreadData::Frames [private]
 

Definition at line 86 of file pStatThreadData.h.


Constructor & Destructor Documentation

PStatThreadData::PStatThreadData const PStatClientData client_data  ) 
 

Definition at line 39 of file pStatThreadData.cxx.

PStatThreadData::~PStatThreadData  ) 
 

Definition at line 54 of file pStatThreadData.cxx.

References _frames.


Member Function Documentation

const PStatClientData * PStatThreadData::get_client_data  )  const [inline]
 

Returns a pointer to the ClientData structure associated with this data.

Definition at line 34 of file pStatThreadData.I.

const PStatFrameData & PStatThreadData::get_frame int  frame_number  )  const
 

Returns a FrameData structure associated with the indicated frame number.

If the frame data has not yet been received from the client, returns the newest frame older than the requested frame.

Definition at line 140 of file pStatThreadData.cxx.

References nassertr.

Referenced by PStatStripChart::draw_cursor(), PStatStripChart::get_collector_under_pixel(), and PStatPianoRoll::PStatPianoRoll().

const PStatFrameData & PStatThreadData::get_frame_at_time float  time  )  const
 

Returns the FrameData structure associated with the latest frame not later than the indicated time.

Definition at line 213 of file pStatThreadData.cxx.

int PStatThreadData::get_frame_number_at_time float  time,
int  hint = -1
const
 

Returns the frame number of the latest frame not later than the indicated time.

If the hint is nonnegative, it represents a frame number that we believe the correct answer to be near, which may speed the search for the frame.

Definition at line 236 of file pStatThreadData.cxx.

References PStatFrameData::get_start(), nassertr, NULL, and num_frames.

Referenced by PStatStripChart::set_default_vertical_scale().

float PStatThreadData::get_frame_rate float  time = 3.0  )  const
 

Computes the average frame rate over the past number of seconds, by counting up the number of frames elapsed in that time interval.

Definition at line 299 of file pStatThreadData.cxx.

References _history.

float PStatThreadData::get_history  )  const
 

Returns the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added.

This affects how old the oldest frame that may be queried is.

Definition at line 376 of file pStatThreadData.cxx.

const PStatFrameData & PStatThreadData::get_latest_frame  )  const
 

Returns the FrameData associated with the most recent frame.

Definition at line 281 of file pStatThreadData.cxx.

References _history.

int PStatThreadData::get_latest_frame_number  )  const
 

Returns the frame number of the most recent frame stored in the data.

Definition at line 84 of file pStatThreadData.cxx.

Referenced by PStatStripChart::draw_cursor(), PStatStripChart::new_data(), and PStatPianoRoll::PStatPianoRoll().

float PStatThreadData::get_latest_time  )  const
 

Returns the timestamp (in seconds elapsed since connection) of the latest available frame.

Definition at line 181 of file pStatThreadData.cxx.

References _first_frame_number, and NULL.

int PStatThreadData::get_oldest_frame_number  )  const
 

Returns the frame number of the oldest frame still stored in the data.

Definition at line 100 of file pStatThreadData.cxx.

References _first_frame_number, _frames, NULL, and num_frames.

float PStatThreadData::get_oldest_time  )  const
 

Returns the timestamp (in seconds elapsed since connection) of the oldest available frame.

Definition at line 197 of file pStatThreadData.cxx.

bool PStatThreadData::has_frame int  frame_number  )  const
 

Returns true if we have received data for the indicated frame number from the client and we still have it stored, or false otherwise.

Definition at line 118 of file pStatThreadData.cxx.

Referenced by PStatStripChart::set_default_vertical_scale().

bool PStatThreadData::is_empty  )  const
 

Returns true if the structure contains no frames, false otherwise.

Definition at line 69 of file pStatThreadData.cxx.

References _first_frame_number, _frames, and nassertr.

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

void PStatThreadData::record_new_frame int  frame_number,
PStatFrameData frame_data
 

Makes room for and stores a new frame's worth of data.

Calling this function may cause old frame data to be discarded to make room, according to the amount of time set up via set_history().

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

Definition at line 402 of file pStatThreadData.cxx.

void PStatThreadData::set_history float  time  ) 
 

Sets the number of seconds worth of frames that will be retained by the ThreadData structure as each new frame is added.

This affects how old the oldest frame that may be queried is.

Definition at line 357 of file pStatThreadData.cxx.

References nout, and NULL.


Member Data Documentation

const PStatClientData* PStatThreadData::_client_data [private]
 

Definition at line 84 of file pStatThreadData.h.

int PStatThreadData::_first_frame_number [private]
 

Definition at line 88 of file pStatThreadData.h.

Referenced by get_latest_time(), get_oldest_frame_number(), and is_empty().

Frames PStatThreadData::_frames [private]
 

Definition at line 87 of file pStatThreadData.h.

Referenced by get_oldest_frame_number(), is_empty(), and ~PStatThreadData().

float PStatThreadData::_history [private]
 

Definition at line 89 of file pStatThreadData.h.

Referenced by get_frame_rate(), and get_latest_frame().

PStatFrameData PStatThreadData::_null_frame [static, private]
 

Definition at line 29 of file pStatThreadData.cxx.


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