Panda3D

pStatGraph.I

00001 // Filename: pStatGraph.I
00002 // Created by:  drose (19Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: PStatGraph::get_monitor
00018 //       Access: Public
00019 //  Description: Returns the monitor associated with this chart.
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE PStatMonitor *PStatGraph::
00022 get_monitor() const {
00023   return _monitor;
00024 }
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: PStatGraph::get_num_labels
00028 //       Access: Public
00029 //  Description: Returns the number of labels to be drawn for this
00030 //               chart.
00031 ////////////////////////////////////////////////////////////////////
00032 INLINE int PStatGraph::
00033 get_num_labels() const {
00034   return _labels.size();
00035 }
00036 
00037 ////////////////////////////////////////////////////////////////////
00038 //     Function: PStatGraph::get_label_collector
00039 //       Access: Public
00040 //  Description: Returns the collector index associated with the nth
00041 //               label.
00042 ////////////////////////////////////////////////////////////////////
00043 INLINE int PStatGraph::
00044 get_label_collector(int n) const {
00045   nassertr(n >= 0 && n < (int)_labels.size(), 0);
00046   return _labels[n];
00047 }
00048 
00049 ////////////////////////////////////////////////////////////////////
00050 //     Function: PStatGraph::get_label_name
00051 //       Access: Public
00052 //  Description: Returns the text associated with the nth label.
00053 ////////////////////////////////////////////////////////////////////
00054 INLINE string PStatGraph::
00055 get_label_name(int n) const {
00056   nassertr(n >= 0 && n < (int)_labels.size(), string());
00057   return _monitor->get_client_data()->get_collector_name(_labels[n]);
00058 }
00059 
00060 ////////////////////////////////////////////////////////////////////
00061 //     Function: PStatGraph::get_label_color
00062 //       Access: Public
00063 //  Description: Returns the color associated with the nth label.
00064 ////////////////////////////////////////////////////////////////////
00065 INLINE LRGBColor PStatGraph::
00066 get_label_color(int n) const {
00067   nassertr(n >= 0 && n < (int)_labels.size(), LRGBColor(0.0, 0.0, 0.0));
00068   return _monitor->get_collector_color(_labels[n]);
00069 }
00070 
00071 ////////////////////////////////////////////////////////////////////
00072 //     Function: PStatGraph::set_target_frame_rate
00073 //       Access: Public
00074 //  Description: Sets the target frame rate of the application in Hz.
00075 //               This only affects the choice of initial scale and the
00076 //               placement of guide bars.
00077 ////////////////////////////////////////////////////////////////////
00078 INLINE void PStatGraph::
00079 set_target_frame_rate(double frame_rate) {
00080   if (_target_frame_rate != frame_rate) {
00081     _target_frame_rate = frame_rate;
00082     normal_guide_bars();
00083   }
00084 }
00085 
00086 ////////////////////////////////////////////////////////////////////
00087 //     Function: PStatGraph::get_target_frame_rate
00088 //       Access: Public
00089 //  Description: Returns the indicated target frame rate in Hz.  See
00090 //               set_target_frame_rate().
00091 ////////////////////////////////////////////////////////////////////
00092 INLINE double PStatGraph::
00093 get_target_frame_rate() const {
00094   return _target_frame_rate;
00095 }
00096 
00097 ////////////////////////////////////////////////////////////////////
00098 //     Function: PStatGraph::get_xsize
00099 //       Access: Public
00100 //  Description: Returns the width of the chart in pixels.
00101 ////////////////////////////////////////////////////////////////////
00102 INLINE int PStatGraph::
00103 get_xsize() const {
00104   return _xsize;
00105 }
00106 
00107 ////////////////////////////////////////////////////////////////////
00108 //     Function: PStatGraph::get_ysize
00109 //       Access: Public
00110 //  Description: Returns the height of the chart in pixels.
00111 ////////////////////////////////////////////////////////////////////
00112 INLINE int PStatGraph::
00113 get_ysize() const {
00114   return _ysize;
00115 }
00116 
00117 ////////////////////////////////////////////////////////////////////
00118 //     Function: PStatGraph::set_guide_bar_units
00119 //       Access: Public
00120 //  Description: Sets the units that are displayed for the guide bar
00121 //               labels.  This may be a union of one or more members
00122 //               of the GuideBarUnits enum.
00123 ////////////////////////////////////////////////////////////////////
00124 INLINE void PStatGraph::
00125 set_guide_bar_units(int guide_bar_units) {
00126   if (_guide_bar_units != guide_bar_units) {
00127     _guide_bar_units = guide_bar_units;
00128     normal_guide_bars();
00129   }
00130 }
00131 
00132 ////////////////////////////////////////////////////////////////////
00133 //     Function: PStatGraph::get_guide_bar_units
00134 //       Access: Public
00135 //  Description: Returns the units that are displayed for the guide bar
00136 //               labels.  This may be a union of one or more members
00137 //               of the GuideBarUnits enum.
00138 ////////////////////////////////////////////////////////////////////
00139 INLINE int PStatGraph::
00140 get_guide_bar_units() const {
00141   return _guide_bar_units;
00142 }
00143 
00144 ////////////////////////////////////////////////////////////////////
00145 //     Function: PStatGraph::set_guide_bar_unit_name
00146 //       Access: Public
00147 //  Description: Sets the name of the units to be used for the guide
00148 //               bars if the units type is set to GBU_named |
00149 //               GBU_show_units.
00150 ////////////////////////////////////////////////////////////////////
00151 INLINE void PStatGraph::
00152 set_guide_bar_unit_name(const string &unit_name) {
00153   _unit_name = unit_name;
00154 }
00155 
00156 ////////////////////////////////////////////////////////////////////
00157 //     Function: PStatGraph::get_guide_bar_unit_name
00158 //       Access: Public
00159 //  Description: Returns the name of the units to be used for the guide
00160 //               bars if the units type is set to GBU_named |
00161 //               GBU_show_units.
00162 ////////////////////////////////////////////////////////////////////
00163 INLINE const string &PStatGraph::
00164 get_guide_bar_unit_name() const {
00165   return _unit_name;
00166 }
 All Classes Functions Variables Enumerations