Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/classStelRendererStatistics.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:50:42 2014
Кодировка:

Поисковые слова: hst
Stellarium: StelRendererStatistics Class Reference
Stellarium 0.12.3
List of all members | Public Member Functions
StelRendererStatistics Class Reference

Stores and provides access to statistics about a StelRenderer backend. More...

#include <StelRendererStatistics.hpp>

Public Member Functions

 StelRendererStatistics ()
 Construct an empty StelRendererStatistics object. More...
 
bool getNext (const char *&name, double &value)
 Get next statistic name and value. More...
 
void resetIteration ()
 Reset iteration to the beginning. More...
 
double & operator[] (int index)
 Access statistic with specified index to modify it. More...
 
int addStatistic (const char *name, const StatisticSwapMode swapMode=StatisticSwapMode_DoNothing)
 Add a statistic with specified name. More...
 
void swap ()
 Called at the end of frame - changes current statistics to previous statistics. More...
 

Detailed Description

Stores and provides access to statistics about a StelRenderer backend.

This acts as a map of stings (const char*) and doubles.

Two sets of statistics are stored: current (this frame, currently recorded) and previous (previous frame, currently readable.)

To read statistics (from previous frame), they can be iterated like this:

const char* name, double value;
while(statistics.getNext(name, value))
{
//Do something with name and value
}

To record statistics, the [] operator is used, modifying the current frame's statistics. The index is an integer previously returned by the addStatistic() member function:

statistics[statisticID] += 1.0;

The resetIteration() member fuction can be used to reset iteration to start.

Definition at line 58 of file StelRendererStatistics.hpp.

Constructor & Destructor Documentation

StelRendererStatistics::StelRendererStatistics ( )
inline

Construct an empty StelRendererStatistics object.

Definition at line 63 of file StelRendererStatistics.hpp.

Member Function Documentation

int StelRendererStatistics::addStatistic ( const char *  name,
const StatisticSwapMode  swapMode = StatisticSwapMode_DoNothing 
)
inline

Add a statistic with specified name.

Also returns the index of the statistic. Index will be 0 for the first statistic added, 1 for the second and so on.

Parameters
nameName of the statistic. This MUST exist as long as the statistics exist. The best way to ensure this is to use a string literal.
swapModeSpecifies what to do when when the swap() function is called (at the end of a frame). Used for statistics that are recorded separately each frame and need to be zeroed out.
Returns
Index of the statistic to use with the [] operator.

Definition at line 126 of file StelRendererStatistics.hpp.

bool StelRendererStatistics::getNext ( const char *&  name,
double &  value 
)
inline

Get next statistic name and value.

Parameters
nameName of the statistic will be stored here (only a pointer to it).
valueValue of the statistic will be stored here.
Returns
true if we got a name/value, false if we're done iterating and name and value were not set.

Definition at line 80 of file StelRendererStatistics.hpp.

double& StelRendererStatistics::operator[] ( int  index)
inline

Access statistic with specified index to modify it.

Statistics are accessed by integer indices. A clean way to do this is to use an enum with name corresponding to the name of the statistic.

Definition at line 107 of file StelRendererStatistics.hpp.

void StelRendererStatistics::resetIteration ( )
inline

Reset iteration to the beginning.

Definition at line 97 of file StelRendererStatistics.hpp.

void StelRendererStatistics::swap ( )
inline

Called at the end of frame - changes current statistics to previous statistics.

Also handles StatisticSwapMode logic, e.g. zeroing out statistics that have StatisticSwapMode_SetToZero.

Definition at line 140 of file StelRendererStatistics.hpp.


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