File xosview-1.9.2-double.patch of Package xosview
--- fieldmeter.cc
+++ fieldmeter.cc 2012-02-01 09:30:38.581933416 +0000
@@ -12,7 +12,61 @@
#include "fieldmeter.h"
#include "xosview.h"
-FieldMeter::FieldMeter( XOSView *parent, int numfields, const char *title,
+
+template FieldMeter<float>::FieldMeter(XOSView *, int, const char *, const char *, int, int, int);
+template FieldMeter<float>::~FieldMeter(void);
+template void FieldMeter<float>::drawfields(int);
+template void FieldMeter<float>::setfieldcolor(int, const char *);
+template void FieldMeter<float>::setfieldcolor(int, unsigned long);
+template void FieldMeter<float>::docaptions(int);
+template void FieldMeter<float>::dolegends(int);
+template void FieldMeter<float>::dousedlegends(int);
+template void FieldMeter<float>::reset(void);
+template void FieldMeter<float>::used_obsolete(int);
+template void FieldMeter<float>::absolute_obsolete(float);
+template void FieldMeter<float>::setUsed(float, float);
+template void FieldMeter<float>::draw(void);
+template void FieldMeter<float>::checkevent(void);
+template void FieldMeter<float>::disableMeter(void);
+template void FieldMeter<float>::checkResources(void);
+template void FieldMeter<float>::SetUsedFormat(const char * const);
+template void FieldMeter<float>::drawlegend(void);
+template void FieldMeter<float>::drawused(int manditory);
+template bool FieldMeter<float>::checkX(int, int) const;
+template void FieldMeter<float>::setNumFields(int);
+template void FieldMeter<float>::IntervalTimerStart();
+template void FieldMeter<float>::IntervalTimerStop();
+template double FieldMeter<float>::IntervalTimeInMicrosecs();
+template double FieldMeter<float>::IntervalTimeInSecs();
+
+template FieldMeter<double>::FieldMeter(XOSView *, int, const char *, const char *, int, int, int);
+template FieldMeter<double>::~FieldMeter(void);
+template void FieldMeter<double>::drawfields(int);
+template void FieldMeter<double>::setfieldcolor(int, const char *);
+template void FieldMeter<double>::setfieldcolor(int, unsigned long);
+template void FieldMeter<double>::docaptions(int);
+template void FieldMeter<double>::dolegends(int);
+template void FieldMeter<double>::dousedlegends(int);
+template void FieldMeter<double>::reset(void);
+template void FieldMeter<double>::used_obsolete(int);
+template void FieldMeter<double>::absolute_obsolete(double);
+template void FieldMeter<double>::setUsed(double, double);
+template void FieldMeter<double>::draw(void);
+template void FieldMeter<double>::checkevent(void);
+template void FieldMeter<double>::disableMeter(void);
+template void FieldMeter<double>::checkResources(void);
+template void FieldMeter<double>::SetUsedFormat(const char * const);
+template void FieldMeter<double>::drawlegend(void);
+template void FieldMeter<double>::drawused(int manditory);
+template bool FieldMeter<double>::checkX(int, int) const;
+template void FieldMeter<double>::setNumFields(int);
+template void FieldMeter<double>::IntervalTimerStart();
+template void FieldMeter<double>::IntervalTimerStop();
+template double FieldMeter<double>::IntervalTimeInMicrosecs();
+template double FieldMeter<double>::IntervalTimeInSecs();
+
+template<typename F>
+FieldMeter<F>::FieldMeter( XOSView *parent, int numfields, const char *title,
const char *legend, int docaptions, int dolegends,
int dousedlegends )
: Meter(parent, title, legend, docaptions, dolegends, dousedlegends){
@@ -30,8 +84,8 @@ FieldMeter::FieldMeter( XOSView *parent,
setNumFields(numfields);
}
-void
-FieldMeter::disableMeter ( )
+template<typename F> void
+FieldMeter<F>::disableMeter ( )
{
setNumFields(1);
setfieldcolor (0, "gray");
@@ -42,20 +96,22 @@ FieldMeter::disableMeter ( )
}
-FieldMeter::~FieldMeter( void ){
+template<typename F>
+FieldMeter<F>::~FieldMeter( void ){
delete[] fields_;
delete[] colors_;
delete[] lastvals_;
delete[] lastx_;
}
-void FieldMeter::checkResources( void ){
+template<typename F> void
+FieldMeter<F>::checkResources( void ){
Meter::checkResources();
usedcolor_ = parent_->allocColor( parent_->getResource( "usedLabelColor") );
}
-
-void FieldMeter::SetUsedFormat ( const char * const fmt ) {
+template<typename F> void
+FieldMeter<F>::SetUsedFormat ( const char * const fmt ) {
/* Do case-insensitive compares. */
if (!strncasecmp (fmt, "percent", 8))
print_ = PERCENT;
@@ -72,7 +128,8 @@ void FieldMeter::SetUsedFormat ( const c
}
}
-void FieldMeter::setUsed (float val, float total)
+template<typename F> void
+FieldMeter<F>::setUsed (F val, F total)
{
if (print_ == FLOAT)
used_ = val;
@@ -100,20 +157,24 @@ void FieldMeter::setUsed (float val, flo
}
}
-void FieldMeter::reset( void ){
+template<typename F> void
+FieldMeter<F>::reset( void ){
for ( int i = 0 ; i < numfields_ ; i++ )
lastvals_[i] = lastx_[i] = -1;
}
-void FieldMeter::setfieldcolor( int field, const char *color ){
+template<typename F> void
+FieldMeter<F>::setfieldcolor( int field, const char *color ){
colors_[field] = parent_->allocColor( color );
}
-void FieldMeter::setfieldcolor( int field, unsigned long color ) {
+template<typename F> void
+FieldMeter<F>::setfieldcolor( int field, unsigned long color ) {
colors_[field] = color;
}
-void FieldMeter::draw( void ){
+template<typename F> void
+FieldMeter<F>::draw( void ){
/* Draw the outline for the fieldmeter. */
parent_->setForeground( parent_->foreground() );
parent_->drawRectangle( x_ - 1, y_ - 1, width_ + 2, height_ + 2 );
@@ -133,7 +194,8 @@ void FieldMeter::draw( void ){
drawfields( 1 );
}
-void FieldMeter::drawlegend( void ){
+template<typename F> void
+FieldMeter<F>::drawlegend( void ){
char *tmp1, *tmp2, buff[100];
int n, x = x_;
@@ -166,7 +228,8 @@ void FieldMeter::drawlegend( void ){
parent_->setStippleN(0); /* Restore default all-bits stipple. */
}
-void FieldMeter::drawused( int manditory ){
+template<typename F> void
+FieldMeter<F>::drawused( int manditory ){
if ( !manditory )
if ( lastused_ == used_ )
return;
@@ -182,7 +245,7 @@ void FieldMeter::drawused( int manditory
}
else if (print_ == AUTOSCALE){
char scale;
- float scaled_used;
+ F scaled_used;
/* Unfortunately, we have to do our comparisons by 1000s (otherwise
* a value of 1020, which is smaller than 1K, could end up
* being printed as 1020, which is wider than what can fit) */
@@ -242,7 +305,8 @@ void FieldMeter::drawused( int manditory
lastused_ = used_;
}
-void FieldMeter::drawfields( int manditory ){
+template<typename F> void
+FieldMeter<F>::drawfields( int manditory ){
int twidth, x = x_;
if ( total_ == 0 )
@@ -262,7 +326,7 @@ void FieldMeter::drawfields( int mandito
"will not be displayed.\n", name());
}
- twidth = (int) ((width_ * (float) fields_[i]) / total_);
+ twidth = (int) ((width_ * (F) fields_[i]) / total_);
// twidth = (int)((fields_[i] * width_) / total_);
if ( (i == numfields_ - 1) && ((x + twidth) != (x_ + width_)) )
twidth = width_ + x_ - x;
@@ -284,17 +348,19 @@ void FieldMeter::drawfields( int mandito
//parent_->flush();
}
-void FieldMeter::checkevent( void ){
+template<typename F> void
+FieldMeter<F>::checkevent( void ){
drawfields();
}
-void FieldMeter::setNumFields(int n){
+template<typename F> void
+FieldMeter<F>::setNumFields(int n){
numfields_ = n;
delete[] fields_;
delete[] colors_;
delete[] lastvals_;
delete[] lastx_;
- fields_ = new double[numfields_];
+ fields_ = new F[numfields_];
colors_ = new unsigned long[numfields_];
lastvals_ = new int[numfields_];
lastx_ = new int[numfields_];
@@ -308,7 +374,8 @@ void FieldMeter::setNumFields(int n){
}
}
-bool FieldMeter::checkX(int x, int width) const {
+template<typename F> bool
+FieldMeter<F>::checkX(int x, int width) const {
if ((x < x_) || (x + width < x_)
|| (x > x_ + width_) || (x + width > x_ + width_)){
std::cerr << "FieldMeter::checkX() : bad horiz values for meter : "
--- fieldmeter.h
+++ fieldmeter.h 2012-02-01 09:31:04.350275317 +0000
@@ -10,6 +10,7 @@
#include "meter.h"
#include "timer.h"
+template<typename F>
class FieldMeter : public Meter {
public:
FieldMeter( XOSView *parent, int numfields,
@@ -26,9 +27,9 @@ public:
void reset( void );
/* These next two are deprecated -- use setUsed instead. bgrayson */
void used_obsolete( int val ) { print_ = PERCENT; used_ = val; }
- void absolute_obsolete( float val ) { print_ = FLOAT; used_ = val; }
+ void absolute_obsolete( F val ) { print_ = FLOAT; used_ = val; }
- void setUsed (float val, float total);
+ void setUsed (F val, F total);
void draw( void );
void checkevent( void );
void disableMeter ( void );
@@ -39,8 +40,8 @@ protected:
enum UsedType { INVALID_0, FLOAT, PERCENT, AUTOSCALE, INVALID_TAIL };
int numfields_;
- double *fields_;
- double total_, used_, lastused_;
+ F *fields_;
+ F total_, used_, lastused_;
int *lastvals_, *lastx_;
unsigned long *colors_;
unsigned long usedcolor_;
--- fieldmeterdecay.cc
+++ fieldmeterdecay.cc 2006-07-26 15:36:14.000000000 +0000
@@ -32,15 +32,24 @@
#include "fieldmeterdecay.h"
#include "xosview.h"
-FieldMeterDecay::FieldMeterDecay( XOSView *parent,
+template FieldMeterDecay<float>::FieldMeterDecay(XOSView *, int, const char *, const char *, int, int, int);
+template FieldMeterDecay<float>::~FieldMeterDecay(void);
+template void FieldMeterDecay<float>::drawfields(int);
+
+template FieldMeterDecay<double>::FieldMeterDecay(XOSView *, int, const char *, const char *, int, int, int);
+template FieldMeterDecay<double>::~FieldMeterDecay(void);
+template void FieldMeterDecay<double>::drawfields(int);
+
+template<typename F>
+FieldMeterDecay<F>::FieldMeterDecay( XOSView *parent,
int numfields, const char *title,
const char *legend, int docaptions, int dolegends,
int dousedlegends )
-: FieldMeter (parent, numfields, title, legend, docaptions, dolegends,
+: FieldMeter<F> (parent, numfields, title, legend, docaptions, dolegends,
dousedlegends)
{
- decay_ = new float[numfields];
- lastDecayval_ = new float[numfields];
+ decay_ = new F[numfields];
+ lastDecayval_ = new F[numfields];
for (int decayCtr = 0; decayCtr < numfields; decayCtr++) {
decay_[decayCtr] = 0.0;
lastDecayval_[decayCtr] = 0.0;
@@ -50,27 +59,29 @@ FieldMeterDecay::FieldMeterDecay( XOSVie
dodecay_ = 1;
}
-FieldMeterDecay::~FieldMeterDecay( void ){
+template<typename F>
+FieldMeterDecay<F>::~FieldMeterDecay( void ){
delete[] decay_;
delete[] lastDecayval_;
}
-void FieldMeterDecay::drawfields( int manditory ){
- int twidth, x = x_;
+template<typename F>
+void FieldMeterDecay<F>::drawfields( int manditory ){
+ int twidth, x = this->x_;
if (!dodecay_)
{
// If this meter shouldn't be done as a decaying splitmeter,
// call the ordinary fieldmeter code.
- FieldMeter::drawfields (manditory);
+ FieldMeter<F>::drawfields (manditory);
return;
}
- if ( total_ == 0.0 )
+ if ( this->total_ == 0.0 )
return;
- int halfheight = height_ / 2;
- int decaytwidth, decayx = x_;
+ int halfheight = this->height_ / 2;
+ int decaytwidth, decayx = this->x_;
// This code is supposed to make the average display look just like
// the ordinary display for the first drawfields, but it doesn't seem
@@ -79,9 +90,9 @@ void FieldMeterDecay::drawfields( int ma
if (firsttime_) {
firsttime_ = 0;
- for (int i = 0; i < numfields_; i++)
+ for (int i = 0; i < this->numfields_; i++)
{
- decay_[i] = 1.0*fields_[i]/total_;
+ decay_[i] = 1.0*this->fields_[i]/this->total_;
}
}
@@ -104,58 +115,58 @@ void FieldMeterDecay::drawfields( int ma
* then turn to ints. I think this will solve a whole bunch of
* our problems with rounding that before we tackled at a whole
* lot of places. BCG */
- for ( int i = 0 ; i < numfields_ ; i++ ){
+ for ( int i = 0 ; i < this->numfields_ ; i++ ){
- decay_[i] = ALPHA*decay_[i] + (1-ALPHA)*(fields_[i]*1.0/total_);
+ decay_[i] = ALPHA*decay_[i] + (1-ALPHA)*(this->fields_[i]*1.0/this->total_);
// We want to round the widths, rather than truncate.
- twidth = (int) (0.5 + (width_ * (float) fields_[i]) / total_);
- decaytwidth = (int) (0.5 + width_ * decay_[i]);
+ twidth = (int) (0.5 + (this->width_ * (F) this->fields_[i]) / this->total_);
+ decaytwidth = (int) (0.5 + this->width_ * decay_[i]);
if (decaytwidth < 0.0) {
- std::cerr << "Error: FieldMeterDecay " << name() << ": decaytwidth of ";
- std::cerr << decaytwidth << ", width of " << width_ << ", decay_[" << i;
+ std::cerr << "Error: FieldMeterDecay " << this->name() << ": decaytwidth of ";
+ std::cerr << decaytwidth << ", width of " << this->width_ << ", decay_[" << i;
std::cerr << "] of " << decay_[i] << std::endl;
}
// However, due to rounding, we may have gone one
// pixel too far by the time we get to the later fields...
- if (x + twidth > x_ + width_)
- twidth = width_ + x_ - x;
- if (decayx + decaytwidth > x_ + width_)
- decaytwidth = width_ + x_ - decayx;
+ if (x + twidth > this->x_ + this->width_)
+ twidth = this->width_ + this->x_ - x;
+ if (decayx + decaytwidth > this->x_ + this->width_)
+ decaytwidth = this->width_ + this->x_ - decayx;
// Also, due to rounding error, the last field may not go far
// enough...
- if ( (i == numfields_ - 1) && ((x + twidth) != (x_ + width_)) )
- twidth = width_ + x_ - x;
- if ( (i == numfields_ - 1) && ((decayx + decaytwidth) != (x_ + width_)))
- decaytwidth = width_ + x_ - decayx;
+ if ( (i == this->numfields_ - 1) && ((x + twidth) != (this->x_ + this->width_)) )
+ twidth = this->width_ + this->x_ - x;
+ if ( (i == this->numfields_ - 1) && ((decayx + decaytwidth) != (this->x_ + this->width_)))
+ decaytwidth = this->width_ + this->x_ - decayx;
- parent_->setForeground( colors_[i] );
- parent_->setStippleN(i%4);
+ this->parent_->setForeground( this->colors_[i] );
+ this->parent_->setStippleN(i%4);
// drawFilledRectangle() adds one to its width and height.
// Let's correct for that here.
- if ( manditory || (twidth != lastvals_[i]) || (x != lastx_[i]) ){
- if (!checkX(x, twidth))
+ if ( manditory || (twidth != this->lastvals_[i]) || (x != this->lastx_[i]) ){
+ if (!this->checkX(x, twidth))
std::cerr <<__FILE__ << ":" << __LINE__ <<std::endl;
- parent_->drawFilledRectangle( x, y_, twidth, halfheight );
+ this->parent_->drawFilledRectangle( x, this->y_, twidth, halfheight );
}
if ( manditory || (decay_[i] != lastDecayval_[i]) ){
- if (!checkX(decayx, decaytwidth))
+ if (!this->checkX(decayx, decaytwidth))
std::cerr <<__FILE__ << ":" << __LINE__ <<std::endl;
- parent_->drawFilledRectangle( decayx, y_+halfheight+1,
- decaytwidth, height_ - halfheight-1);
+ this->parent_->drawFilledRectangle( decayx, this->y_+halfheight+1,
+ decaytwidth, this->height_ - halfheight-1);
}
- lastvals_[i] = twidth;
- lastx_[i] = x;
+ this->lastvals_[i] = twidth;
+ this->lastx_[i] = x;
lastDecayval_[i] = decay_[i];
- parent_->setStippleN(0); /* Restore all-bits stipple. */
- if ( dousedlegends_ )
- drawused( manditory );
+ this->parent_->setStippleN(0); /* Restore all-bits stipple. */
+ if ( this->dousedlegends_ )
+ this->drawused( manditory );
x += twidth;
decayx += decaytwidth;
--- fieldmeterdecay.h
+++ fieldmeterdecay.h 2006-07-26 15:13:10.000000000 +0000
@@ -19,7 +19,8 @@
#include "meter.h"
#include "fieldmeter.h"
-class FieldMeterDecay : public FieldMeter {
+template<typename F>
+class FieldMeterDecay : public FieldMeter<F> {
public:
FieldMeterDecay( XOSView *parent, int numfields,
const char *title = "", const char *legend = "",
@@ -31,8 +32,8 @@ public:
protected:
int dodecay_;
int firsttime_; // Used to set up decaying fields right the first time.
- float *decay_;
- float *lastDecayval_;
+ F *decay_;
+ F *lastDecayval_;
private:
};
--- fieldmetergraph.cc
+++ fieldmetergraph.cc 2006-07-26 15:45:06.000000000 +0000
@@ -29,11 +29,26 @@
#include "fieldmetergraph.h"
#include "xosview.h"
-FieldMeterGraph::FieldMeterGraph( XOSView *parent,
+template FieldMeterGraph<float>::FieldMeterGraph(XOSView *, int, const char *, const char *, int, int, int);
+template FieldMeterGraph<float>::~FieldMeterGraph(void);
+template void FieldMeterGraph<float>::drawfields(int);
+template void FieldMeterGraph<float>::drawBar(int);
+template void FieldMeterGraph<float>::checkResources(void);
+template void FieldMeterGraph<float>::setNumCols(int);
+
+template FieldMeterGraph<double>::FieldMeterGraph(XOSView *, int, const char *, const char *, int, int, int);
+template FieldMeterGraph<double>::~FieldMeterGraph(void);
+template void FieldMeterGraph<double>::drawfields(int);
+template void FieldMeterGraph<double>::drawBar(int);
+template void FieldMeterGraph<double>::checkResources(void);
+template void FieldMeterGraph<double>::setNumCols(int);
+
+template<typename F>
+FieldMeterGraph<F>::FieldMeterGraph( XOSView *parent,
int numfields, const char *title,
const char *legend, int docaptions, int dolegends,
int dousedlegends )
-: FieldMeterDecay (parent, numfields, title, legend, docaptions,
+: FieldMeterDecay<F> (parent, numfields, title, legend, docaptions,
dolegends, dousedlegends)
{
@@ -47,12 +62,14 @@ FieldMeterGraph::FieldMeterGraph( XOSVie
}
-FieldMeterGraph::~FieldMeterGraph( void )
+template<typename F>
+FieldMeterGraph<F>::~FieldMeterGraph( void )
{
delete [] heightfield_;
}
-void FieldMeterGraph::drawfields( int manditory )
+template<typename F>
+void FieldMeterGraph<F>::drawfields( int manditory )
{
int i,j;
@@ -60,11 +77,11 @@ void FieldMeterGraph::drawfields( int ma
{
// Call FieldMeterDecay code if this meter should not be
// drawn as a graph
- FieldMeterDecay::drawfields( manditory );
+ FieldMeterDecay<F>::drawfields( manditory );
return;
}
- if( total_ <= 0.0 )
+ if( this->total_ <= 0.0 )
return;
// allocate memory for height field graph storage
@@ -72,18 +89,18 @@ void FieldMeterGraph::drawfields( int ma
// numfields_ and graphNumCols_ are defined in the constructor
if( heightfield_ == NULL )
{
- if( numfields_ > 0 && graphNumCols_ > 0 )
+ if( this->numfields_ > 0 && graphNumCols_ > 0 )
{
- heightfield_ = new float [numfields_*graphNumCols_];
+ heightfield_ = new F [this->numfields_*graphNumCols_];
for( i = 0; i < graphNumCols_; i++ )
{
- for( j = 0; j < numfields_; j++ )
+ for( j = 0; j < this->numfields_; j++ )
{
- if( j < numfields_-1 )
- heightfield_[i*numfields_+j] = 0.0;
+ if( j < this->numfields_-1 )
+ heightfield_[i*this->numfields_+j] = 0.0;
else
- heightfield_[i*numfields_+j] = 1.0;
+ heightfield_[i*this->numfields_+j] = 1.0;
}
}
}
@@ -94,54 +111,54 @@ void FieldMeterGraph::drawfields( int ma
{
for( i = 0; i < graphNumCols_-1; i++ )
{
- for( j = 0; j < numfields_; j++ )
+ for( j = 0; j < this->numfields_; j++ )
{
- heightfield_[i*numfields_+j] = heightfield_[(i+1)*numfields_+j];
+ heightfield_[i*this->numfields_+j] = heightfield_[(i+1)*this->numfields_+j];
}
}
graphpos_ = graphNumCols_ - 1;
}
// get current values to be plotted
- for( i = 0; i < numfields_; i++ )
+ for( i = 0; i < this->numfields_; i++ )
{
- float a = fields_[i] / total_;
+ F a = this->fields_[i] / this->total_;
if( a <= 0.0 )
a = 0.0;
if( a >= 1.0 )
a = 1.0;
- heightfield_[graphpos_*numfields_+i] = a;
+ heightfield_[graphpos_*this->numfields_+i] = a;
}
/* For the first time, we need to draw everything, so
* skip the optimized copyArea case. Also, if we are
* not fully visible, then the copy-area won't work
* properly. */
- if( !firstTimeDrawn_ && parent_->hasBeenExposedAtLeastOnce() && !parent_->isExposed() && parent_->isFullyVisible() )
+ if( !firstTimeDrawn_ && this->parent_->hasBeenExposedAtLeastOnce() && !this->parent_->isExposed() && this->parent_->isFullyVisible() )
{
// scroll area
- int col_width = width_/graphNumCols_;
+ int col_width = this->width_/graphNumCols_;
if( col_width < 1 )
{
col_width = 1;
}
- int sx = x_ + col_width;
- int swidth = width_ - col_width;
- int sheight = height_ + 1;
- if( sx > x_ && swidth > 0 && sheight > 0 )
- parent_->copyArea( sx, y_, swidth, sheight, x_, y_ );
+ int sx = this->x_ + col_width;
+ int swidth = this->width_ - col_width;
+ int sheight = this->height_ + 1;
+ if( sx > this->x_ && swidth > 0 && sheight > 0 )
+ this->parent_->copyArea( sx, this->y_, swidth, sheight, this->x_, this->y_ );
drawBar( graphNumCols_ - 1 );
} else {
if (firstTimeDrawn_ &&
- parent_->isAtLeastPartiallyVisible() &&
- parent_->hasBeenExposedAtLeastOnce()) {
+ this->parent_->isAtLeastPartiallyVisible() &&
+ this->parent_->hasBeenExposedAtLeastOnce()) {
XOSDEBUG("True exposure! %d\n", firstTimeDrawn_);
firstTimeDrawn_ = 0;
}
else XOSDEBUG("Full draw: isAtLeastPart %d, hasBeenExposed %d\n",
- parent_->isAtLeastPartiallyVisible(),
- parent_->hasBeenExposedAtLeastOnce());
+ this->parent_->isAtLeastPartiallyVisible(),
+ this->parent_->hasBeenExposedAtLeastOnce());
// need to draw entire graph on expose event
for( i = 0; i < graphNumCols_; i++ ) {
drawBar( i );
@@ -149,49 +166,53 @@ void FieldMeterGraph::drawfields( int ma
}
graphpos_++;
- parent_->setStippleN(0); // Restore all-bits stipple.
- if ( dousedlegends_ )
+ this->parent_->setStippleN(0); // Restore all-bits stipple.
+ if ( this->dousedlegends_ )
{
- drawused( manditory );
+ this->drawused( manditory );
}
}
-void FieldMeterGraph::drawBar( int i )
+
+template<typename F>
+void FieldMeterGraph<F>::drawBar( int i )
{
int j;
- int y = y_ + height_;
- int x = x_ + i*width_/graphNumCols_;
- int barwidth = (x_ + (i+1)*width_/graphNumCols_)-x;
+ int y = this->y_ + this->height_;
+ int x = this->x_ + i*this->width_/graphNumCols_;
+ int barwidth = (this->x_ + (i+1)*this->width_/graphNumCols_)-x;
if( barwidth>0 )
{
int barheight;
- for( j = 0 ; j < numfields_; j++ )
+ for( j = 0 ; j < this->numfields_; j++ )
{
/* Round up, by adding 0.5 before
* converting to an int. */
- barheight = (int)((heightfield_[i*numfields_+j]*height_)+0.5);
+ barheight = (int)((heightfield_[i*this->numfields_+j]*this->height_)+0.5);
- parent_->setForeground( colors_[j] );
- parent_->setStippleN(j%4);
+ this->parent_->setForeground( this->colors_[j] );
+ this->parent_->setStippleN(j%4);
- if( barheight > (y-y_) )
- barheight = (y-y_);
+ if( barheight > (y-this->y_) )
+ barheight = (y-this->y_);
// hack to ensure last field always reaches top of graph area
- if( j == numfields_-1 )
- barheight = (y-y_);
+ if( j == this->numfields_-1 )
+ barheight = (y-this->y_);
y -= barheight;
if( barheight>0 )
- parent_->drawFilledRectangle( x, y, barwidth, barheight );
+ this->parent_->drawFilledRectangle( x, y, barwidth, barheight );
}
}
}
-void FieldMeterGraph::checkResources( void )
+
+template<typename F>
+void FieldMeterGraph<F>::checkResources( void )
{
- FieldMeterDecay::checkResources();
+ FieldMeterDecay<F>::checkResources();
- const char *ptr = parent_->getResource( "graphNumCols" );
+ const char *ptr = this->parent_->getResource( "graphNumCols" );
if( ptr )
{
int i;
@@ -204,7 +225,9 @@ void FieldMeterGraph::checkResources( vo
}
}
}
-void FieldMeterGraph::setNumCols( int n )
+
+template<typename F>
+void FieldMeterGraph<F>::setNumCols( int n )
{
graphNumCols_ = n;
graphpos_ = graphNumCols_-1;
--- fieldmetergraph.h
+++ fieldmetergraph.h 2006-07-26 15:46:37.000000000 +0000
@@ -15,7 +15,8 @@
#include "meter.h"
#include "fieldmeterdecay.h"
-class FieldMeterGraph : public FieldMeterDecay {
+template<typename F>
+class FieldMeterGraph : public FieldMeterDecay<F> {
public:
FieldMeterGraph( XOSView *parent, int numfields,
const char *title = "", const char *legend = "",
@@ -36,7 +37,7 @@ protected:
/* There's some sort of corruption going on -- we can't have
* variables after the heightfield_ below, otherwise they get
* corrupted??? */
- float *heightfield_;
+ F *heightfield_;
private:
void drawBar( int i );
};
--- bsd/btrymeter.cc
+++ bsd/btrymeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -26,14 +26,14 @@
static const char APMFILENAME[] = "/dev/apm";
BtryMeter::BtryMeter( XOSView *parent )
- : FieldMeter( parent, 2, "BAT", "% LEFT/% USED", 1, 1 ){
+ : FieldMeter<float>( parent, 2, "BAT", "% LEFT/% USED", 1, 1 ){
}
BtryMeter::~BtryMeter( void ){
}
void BtryMeter::checkResources( void ){
- FieldMeter::checkResources();
+ FieldMeter<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "batteryUsedColor" ) );
setfieldcolor( 1, parent_->getResource( "batteryLeftColor" ) );
--- bsd/btrymeter.h
+++ bsd/btrymeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -13,7 +13,7 @@
#include "fieldmeter.h"
-class BtryMeter : public FieldMeter {
+class BtryMeter : public FieldMeter<float> {
public:
BtryMeter( XOSView *parent );
~BtryMeter( void );
--- bsd/cpumeter.cc
+++ bsd/cpumeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -31,10 +31,10 @@
CPUMeter::CPUMeter( XOSView *parent )
#if defined(XOSVIEW_FREEBSD) || defined(XOSVIEW_BSDI) || \
(defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000))
-: FieldMeterGraph( parent, 5, "CPU", "USR/NICE/SYS/INT/FREE" ){
+: FieldMeterGraph<float>( parent, 5, "CPU", "USR/NICE/SYS/INT/FREE" ){
#define FREE_INDEX 4
#else
-: FieldMeterGraph( parent, 4, "CPU", "USR/NICE/SYS/FREE" ){
+: FieldMeterGraph<float>( parent, 4, "CPU", "USR/NICE/SYS/FREE" ){
#define FREE_INDEX 3
#endif
for ( int i = 0 ; i < 2 ; i++ )
@@ -51,7 +51,7 @@ CPUMeter::~CPUMeter( void ){
}
void CPUMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource("cpuUserColor") );
setfieldcolor( 1, parent_->getResource("cpuNiceColor") );
--- bsd/cpumeter.h
+++ bsd/cpumeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -18,7 +18,7 @@
#include "fieldmetergraph.h"
-class CPUMeter : public FieldMeterGraph {
+class CPUMeter : public FieldMeterGraph<float> {
public:
CPUMeter( XOSView *parent );
~CPUMeter( void );
--- bsd/diskmeter.cc
+++ bsd/diskmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -17,7 +17,7 @@
#include "kernel.h" // For NetBSD-specific icky (but handy) kvm_ code. BCG
DiskMeter::DiskMeter( XOSView *parent, float max )
-: FieldMeterGraph( parent, 2, "DISK", "XFER/IDLE" ){
+: FieldMeterGraph<float>( parent, 2, "DISK", "XFER/IDLE" ){
// The setting of the priority will be done in checkResources(). BCG
dodecay_ = 0;
@@ -70,7 +70,7 @@ DiskMeter::~DiskMeter( void ){
}
void DiskMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
if (kernelHasStats_) {
setfieldcolor( 0, parent_->getResource("diskUsedColor") );
--- bsd/diskmeter.h
+++ bsd/diskmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -17,7 +17,7 @@
#include "fieldmetergraph.h"
#include <sys/types.h> // For u_int64_t
-class DiskMeter : public FieldMeterGraph {
+class DiskMeter : public FieldMeterGraph<float> {
public:
DiskMeter( XOSView *parent, float max );
~DiskMeter( void );
--- bsd/intratemeter.cc
+++ bsd/intratemeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -15,7 +15,7 @@
#include "xosview.h"
IrqRateMeter::IrqRateMeter( XOSView *parent )
- : FieldMeterGraph( parent, 2, "IRQs", "IRQs per sec/IDLE", 1, 1, 0 ){
+ : FieldMeterGraph<float>( parent, 2, "IRQs", "IRQs per sec/IDLE", 1, 1, 0 ){
kernelHasStats_ = BSDIntrInit();
if (!kernelHasStats_) {
@@ -32,7 +32,7 @@ IrqRateMeter::~IrqRateMeter( void ){
}
void IrqRateMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
if (kernelHasStats_) {
oncol_ = parent_->allocColor(parent_->getResource("irqrateUsedColor"));
idlecol_ = parent_->allocColor(parent_->getResource("irqrateIdleColor"));
--- bsd/intratemeter.h
+++ bsd/intratemeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -14,7 +14,7 @@
#include "fieldmetergraph.h"
#include "kernel.h"
-class IrqRateMeter : public FieldMeterGraph {
+class IrqRateMeter : public FieldMeterGraph<float> {
public:
IrqRateMeter( XOSView *parent );
~IrqRateMeter( void );
--- bsd/loadmeter.cc
+++ bsd/loadmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -19,14 +19,14 @@
#include "xosview.h"
LoadMeter::LoadMeter( XOSView *parent )
- : FieldMeterGraph( parent, 2, "LOAD", "PROCS per MIN/IDLE", 1, 1, 0 ){
+ : FieldMeterGraph<float>( parent, 2, "LOAD", "PROCS per MIN/IDLE", 1, 1, 0 ){
}
LoadMeter::~LoadMeter( void ){
}
void LoadMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
procloadcol_ = parent_->allocColor(parent_->getResource( "loadProcColor" ));
warnloadcol_ = parent_->allocColor(parent_->getResource( "loadWarnColor" ));
--- bsd/loadmeter.h
+++ bsd/loadmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -19,7 +19,7 @@
#include "fieldmetergraph.h"
-class LoadMeter : public FieldMeterGraph {
+class LoadMeter : public FieldMeterGraph<float> {
public:
LoadMeter( XOSView *parent );
~LoadMeter( void );
--- bsd/memmeter.cc
+++ bsd/memmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -30,12 +30,12 @@
MemMeter::MemMeter( XOSView *parent )
#ifdef XOSVIEW_FREEBSD
-: FieldMeterGraph( parent, 5, "MEM", "ACT/INACT/WRD/CA/FRE" ) {
+: FieldMeterGraph<double>( parent, 5, "MEM", "ACT/INACT/WRD/CA/FRE" ) {
#define FREE_INDEX 4
#else
// Once we figure out how to get the buffers field for NetBSD,
// change the next line.
-: FieldMeterGraph( parent, 4, "MEM", "ACT/INACT/WIRE/FREE" ){
+: FieldMeterGraph<double>( parent, 4, "MEM", "ACT/INACT/WIRE/FREE" ){
#define FREE_INDEX 3
#endif
BSDPageInit();
@@ -44,7 +44,7 @@ MemMeter::MemMeter( XOSView *parent )
MemMeter::~MemMeter( void ){ }
void MemMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<double>::checkResources();
// The Active and Inactive colors are new.
setfieldcolor( 0, parent_->getResource("memActiveColor") );
--- bsd/memmeter.h
+++ bsd/memmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -18,7 +18,7 @@
#include "fieldmetergraph.h"
-class MemMeter : public FieldMeterGraph {
+class MemMeter : public FieldMeterGraph<double> {
public:
MemMeter( XOSView *parent );
~MemMeter( void );
--- bsd/netmeter.cc
+++ bsd/netmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -20,7 +20,7 @@
#include "kernel.h"
NetMeter::NetMeter( XOSView *parent, float max )
- : FieldMeterGraph( parent, 3, "NET", "IN/OUT/IDLE" ){
+ : FieldMeterGraph<float>( parent, 3, "NET", "IN/OUT/IDLE" ){
kernelHasStats_ = BSDNetInit();
if (!kernelHasStats_) {
warnx(
@@ -41,7 +41,7 @@ NetMeter::~NetMeter( void ){
}
void NetMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
if (kernelHasStats_) {
setfieldcolor( 0, parent_->getResource("netInColor") );
--- bsd/netmeter.h
+++ bsd/netmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -21,7 +21,7 @@
class Host;
-class NetMeter : public FieldMeterGraph {
+class NetMeter : public FieldMeterGraph<float> {
public:
NetMeter(XOSView *parent, float max);
~NetMeter( void );
--- bsd/pagemeter.cc
+++ bsd/pagemeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -24,7 +24,7 @@
#endif
PageMeter::PageMeter( XOSView *parent, double total )
-: FieldMeterGraph( parent, 3, "PAGE", "IN/OUT/IDLE" ){
+: FieldMeterGraph<float>( parent, 3, "PAGE", "IN/OUT/IDLE" ){
total_ = total;
BSDPageInit();
#ifdef UVM
@@ -43,7 +43,7 @@ PageMeter::PageMeter( XOSView *parent, d
PageMeter::~PageMeter( void ){ }
void PageMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
// The Active and Inactive colors are new.
setfieldcolor( 0, parent_->getResource("pageInColor") );
--- bsd/pagemeter.h
+++ bsd/pagemeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -31,7 +31,7 @@
#include <sys/vmmeter.h>
#endif
-class PageMeter : public FieldMeterGraph {
+class PageMeter : public FieldMeterGraph<float> {
public:
PageMeter( XOSView *parent, double total );
~PageMeter( void );
--- bsd/swapmeter.cc
+++ bsd/swapmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -25,7 +25,7 @@
static int doSwap = 1;
SwapMeter::SwapMeter( XOSView *parent )
-: FieldMeterGraph( parent, 2, "SWAP", "USED/FREE" ){
+: FieldMeterGraph<float>( parent, 2, "SWAP", "USED/FREE" ){
#ifdef HAVE_SWAPCTL
useSwapCtl = 0;
#endif
@@ -56,7 +56,7 @@ SwapMeter::~SwapMeter( void ){
}
void SwapMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource("swapUsedColor") );
setfieldcolor( 1, parent_->getResource("swapFreeColor") );
--- bsd/swapmeter.h
+++ bsd/swapmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -16,7 +16,7 @@
#include "fieldmetergraph.h"
-class SwapMeter : public FieldMeterGraph {
+class SwapMeter : public FieldMeterGraph<float> {
public:
SwapMeter( XOSView *parent );
~SwapMeter( void );
--- hpux/cpumeter.cc
+++ hpux/cpumeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -10,7 +10,7 @@
#include <stdlib.h>
CPUMeter::CPUMeter( XOSView *parent )
-: FieldMeterGraph( parent, 5, "CPU", "USR/NICE/SYS/INT/FREE" ){
+: FieldMeterGraph<float>( parent, 5, "CPU", "USR/NICE/SYS/INT/FREE" ){
for ( int i = 0 ; i < 2 ; i++ )
for ( int j = 0 ; j < 5 ; j++ )
cputime_[i][j] = 0;
@@ -21,7 +21,7 @@ CPUMeter::~CPUMeter( void ){
}
void CPUMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "cpuUserColor" ) );
setfieldcolor( 1, parent_->getResource( "cpuNiceColor" ) );
--- hpux/cpumeter.h
+++ hpux/cpumeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include "fieldmetergraph.h"
-class CPUMeter : public FieldMeterGraph {
+class CPUMeter : public FieldMeterGraph<float> {
public:
CPUMeter( XOSView *parent );
~CPUMeter( void );
--- irix65/cpumeter.cc
+++ irix65/cpumeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -10,7 +10,7 @@
#include <sstream>
CPUMeter::CPUMeter(XOSView *parent, int cpuid)
- : FieldMeterGraph(parent, USED_CPU_STATES, toUpper(cpuStr(cpuid)),
+ : FieldMeterGraph<float>(parent, USED_CPU_STATES, toUpper(cpuStr(cpuid)),
"USER/SYS/INTR/WAIT/IDLE")
{
for (int i = 0 ; i < 2 ; i++)
@@ -32,7 +32,7 @@ CPUMeter::~CPUMeter(void)
void CPUMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor(0, parent_->getResource("cpuUserColor"));
setfieldcolor(1, parent_->getResource("cpuSystemColor"));
--- irix65/cpumeter.h
+++ irix65/cpumeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -12,7 +12,7 @@
#define USED_CPU_STATES (CPU_STATES-1) // SXBRK + IDLE merged
-class CPUMeter : public FieldMeterGraph {
+class CPUMeter : public FieldMeterGraph<float> {
public:
CPUMeter(XOSView *parent, const int cpuid = 0);
~CPUMeter(void);
--- irix65/diskmeter.cc
+++ irix65/diskmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include <stdlib.h>
-DiskMeter::DiskMeter( XOSView *parent, float max ) : FieldMeterGraph(
+DiskMeter::DiskMeter( XOSView *parent, float max ) : FieldMeterGraph<float>(
parent, 3, "DISK", "READ/WRITE/IDLE")
{
maxspeed_ = max;
@@ -22,7 +22,7 @@ DiskMeter::~DiskMeter( void )
void DiskMeter::checkResources( void )
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource("diskReadColor") );
setfieldcolor( 1, parent_->getResource("diskWriteColor") );
--- irix65/diskmeter.h
+++ irix65/diskmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -7,7 +7,7 @@
#include "fieldmetergraph.h"
-class DiskMeter : public FieldMeterGraph
+class DiskMeter : public FieldMeterGraph<float>
{
public:
DiskMeter( XOSView *parent, float max );
--- irix65/gfxmeter.cc
+++ irix65/gfxmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -15,7 +15,7 @@ using namespace std;
// GfxMeter display swapbuffers per second. max is base rate for one gfx pipe.
GfxMeter::GfxMeter(XOSView *parent, int max)
- : FieldMeterGraph(parent, 2, "GFX","SWAPBUF/S", 1, 1, 0 )
+ : FieldMeterGraph<float>(parent, 2, "GFX","SWAPBUF/S", 1, 1, 0 )
{
lastalarmstate = -1;
total_ = 0;
@@ -49,7 +49,7 @@ int GfxMeter::nPipes(void)
void GfxMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
swapgfxcol_ = parent_->allocColor(parent_->getResource( "gfxSwapColor" ));
warngfxcol_ = parent_->allocColor(parent_->getResource( "gfxWarnColor" ));
--- irix65/gfxmeter.h
+++ irix65/gfxmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include <rpcsvc/rstat.h>
-class GfxMeter : public FieldMeterGraph
+class GfxMeter : public FieldMeterGraph<float>
{
public:
GfxMeter(XOSView *parent, int max);
--- irix65/loadmeter.cc
+++ irix65/loadmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -21,7 +21,7 @@
using namespace std;
LoadMeter::LoadMeter(XOSView *parent)
- : FieldMeterGraph( parent, 2, "LOAD", "PROCS/MIN", 1, 1, 0 )
+ : FieldMeterGraph<float>( parent, 2, "LOAD", "PROCS/MIN", 1, 1, 0 )
{
lastalarmstate = -1;
total_ = 2.0;
@@ -39,7 +39,7 @@ LoadMeter::~LoadMeter(void)
void LoadMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
procloadcol_ = parent_->allocColor(parent_->getResource( "loadProcColor" ));
warnloadcol_ = parent_->allocColor(parent_->getResource( "loadWarnColor" ));
--- irix65/loadmeter.h
+++ irix65/loadmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -7,7 +7,7 @@
#include "fieldmetergraph.h"
#include <rpcsvc/rstat.h>
-class LoadMeter : public FieldMeterGraph {
+class LoadMeter : public FieldMeterGraph<float> {
public:
LoadMeter(XOSView *parent);
~LoadMeter(void);
--- irix65/memmeter.cc
+++ irix65/memmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -8,7 +8,7 @@
#include <invent.h>
MemMeter::MemMeter(XOSView *parent)
- : FieldMeterGraph(parent, 4, "MEM","KERNEL/FS/USER/FREE")
+ : FieldMeterGraph<double>(parent, 4, "MEM","KERNEL/FS/USER/FREE")
{
inventory_t *inv;
_pageSize = getpagesize();
@@ -32,7 +32,7 @@ MemMeter::MemMeter(XOSView *parent)
void MemMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<double>::checkResources();
setfieldcolor(0, parent_->getResource("memKernelColor"));
setfieldcolor(1, parent_->getResource("memCacheColor"));
--- irix65/memmeter.h
+++ irix65/memmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include <sys/sysmp.h>
#include <sys/sysinfo.h> /* for SAGET and MINFO structures */
-class MemMeter : public FieldMeterGraph {
+class MemMeter : public FieldMeterGraph<double> {
public:
MemMeter(XOSView *parent);
~MemMeter(void);
--- linux/btrymeter.cc
+++ linux/btrymeter.cc 2006-07-26 15:29:02.000000000 +0000
@@ -28,7 +28,7 @@ static const char ACPIBATTERYDIR[] = "/p
static const char SYSPOWERDIR[] = "/sys/class/power_supply";
BtryMeter::BtryMeter( XOSView *parent )
- : FieldMeter( parent, 2, "BTRY", "AVAIL/USED", 1, 1, 0 ){
+ : FieldMeter<float>( parent, 2, "BTRY", "AVAIL/USED", 1, 1, 0 ){
// find out ONCE whether to use ACPI, APM or sysfs
use_acpi = use_apm = use_syspower = false;
@@ -137,7 +137,7 @@ bool BtryMeter::has_syspower( void ){
}
void BtryMeter::checkResources( void ){
- FieldMeter::checkResources();
+ FieldMeter<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "batteryLeftColor" ) );
setfieldcolor( 1, parent_->getResource( "batteryUsedColor" ) );
--- linux/btrymeter.h
+++ linux/btrymeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -12,7 +12,7 @@
#include <string>
-class BtryMeter : public FieldMeter {
+class BtryMeter : public FieldMeter<float> {
public:
BtryMeter( XOSView *parent );
~BtryMeter( void );
--- linux/cpumeter.cc
+++ linux/cpumeter.cc 2012-02-01 09:31:49.857932948 +0000
@@ -18,7 +18,7 @@ static const char STATFILENAME[] = "/pro
#define MAX_PROCSTAT_LENGTH BUFFER_SIZE
CPUMeter::CPUMeter(XOSView *parent, const char *cpuID)
-: FieldMeterGraph( parent, 9, toUpper(cpuID), "USR/NICE/SYS/SI/HI/WIO/GST/ST/IDLE" ) {
+: FieldMeterGraph<float>( parent, 9, toUpper(cpuID), "USR/NICE/SYS/SI/HI/WIO/GST/ST/IDLE" ) {
_lineNum = findLine(cpuID);
for ( int i = 0 ; i < 2 ; i++ )
for ( int j = 0 ; j < 9 ; j++ )
@@ -31,7 +31,7 @@ CPUMeter::~CPUMeter( void ){
}
void CPUMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "cpuUserColor" ) );
setfieldcolor( 1, parent_->getResource( "cpuNiceColor" ) );
--- linux/cpumeter.h
+++ linux/cpumeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include "fieldmetergraph.h"
-class CPUMeter : public FieldMeterGraph {
+class CPUMeter : public FieldMeterGraph<float> {
public:
CPUMeter(XOSView *parent, const char *cpuID = "cpu");
~CPUMeter(void);
--- linux/diskmeter.cc
+++ linux/diskmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -17,7 +17,7 @@
#define MAX_PROCSTAT_LENGTH BUFFER_SIZE
-DiskMeter::DiskMeter( XOSView *parent, float max ) : FieldMeterGraph(
+DiskMeter::DiskMeter( XOSView *parent, float max ) : FieldMeterGraph<float>(
parent, 3, "DISK", "READ/WRITE/IDLE"), _vmstat(false),
_statFileName("/proc/stat")
{
@@ -59,7 +59,7 @@ DiskMeter::~DiskMeter( void )
void DiskMeter::checkResources( void )
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource("diskReadColor") );
setfieldcolor( 1, parent_->getResource("diskWriteColor") );
--- linux/diskmeter.h
+++ linux/diskmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include "fieldmetergraph.h"
-class DiskMeter : public FieldMeterGraph
+class DiskMeter : public FieldMeterGraph<float>
{
public:
DiskMeter( XOSView *parent, float max );
--- linux/lmstemp.cc
+++ linux/lmstemp.cc 2012-02-01 09:32:28.718433659 +0000
@@ -24,7 +24,7 @@ static const char PROC_SENSORS_26[] = "/
LmsTemp::LmsTemp( XOSView *parent, const char *filename, const char *label,
const char *caption)
- : FieldMeter( parent, 3, label, caption, 1, 1, 0 ){
+ : FieldMeter<float>( parent, 3, label, caption, 1, 1, 0 ){
if(!checksensors(1, PROC_SENSORS_24, filename)) {
if(!checksensors(0, PROC_SENSORS_26, filename)) {
std::cerr <<"Can not find file : " <<PROC_SENSORS_24 <<"/*/" << filename
@@ -107,7 +107,7 @@ int LmsTemp::checksensors(int isproc, c
}
void LmsTemp::checkResources( void ){
- FieldMeter::checkResources();
+ FieldMeter<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "lmstempActColor" ) );
setfieldcolor( 1, parent_->getResource( "lmstempIdleColor") );
--- linux/lmstemp.h
+++ linux/lmstemp.h 2006-07-26 15:13:10.000000000 +0000
@@ -15,7 +15,7 @@
#include "fieldmeter.h"
-class LmsTemp : public FieldMeter {
+class LmsTemp : public FieldMeter<float> {
public:
LmsTemp( XOSView *parent, const char * filename, const char *label,
const char * caption);
--- linux/loadmeter.cc
+++ linux/loadmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -20,7 +20,7 @@ static const char SPEEDFILENAME[] = "/pr
LoadMeter::LoadMeter( XOSView *parent )
- : FieldMeterGraph( parent, 2, "LOAD", "PROCS/MIN", 1, 1, 0 ){
+ : FieldMeterGraph<float>( parent, 2, "LOAD", "PROCS/MIN", 1, 1, 0 ){
lastalarmstate = -1;
total_ = 2.0;
old_cpu_speed_= cur_cpu_speed_=0;
@@ -32,7 +32,7 @@ LoadMeter::~LoadMeter( void ){
}
void LoadMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
procloadcol_ = parent_->allocColor(parent_->getResource( "loadProcColor" ));
warnloadcol_ = parent_->allocColor(parent_->getResource( "loadWarnColor" ));
--- linux/loadmeter.h
+++ linux/loadmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -14,7 +14,7 @@
#include "fieldmetergraph.h"
-class LoadMeter : public FieldMeterGraph {
+class LoadMeter : public FieldMeterGraph<float> {
public:
LoadMeter( XOSView *parent );
~LoadMeter( void );
--- linux/memmeter.cc
+++ linux/memmeter.cc 2012-02-01 09:34:02.801933958 +0000
@@ -14,7 +14,7 @@ static const char MEMFILENAME[] = "/proc
static const char MEMSTATFNAME[] = "/proc/memstat";
MemMeter::MemMeter( XOSView *parent )
-: FieldMeterGraph( parent, 6, "MEM", "USED/BUFF/SLAB/MAP/CACHE/FREE" ){
+: FieldMeterGraph<double>( parent, 6, "MEM", "USED/BUFF/SLAB/MAP/CACHE/FREE" ){
_shAdj = -1;
// Check and see if the memstat module has been loaded
@@ -36,7 +36,7 @@ MemMeter::~MemMeter( void ){
}
void MemMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<double>::checkResources();
setfieldcolor( 0, parent_->getResource( "memUsedColor" ) );
if (_shAdj == 0)
@@ -82,7 +82,7 @@ void MemMeter::getmeminfo( void ){
}
if (total_)
- FieldMeterDecay::setUsed (total_ - fields_[6 + _shAdj], total_);
+ FieldMeterDecay<double>::setUsed (total_ - fields_[6 + _shAdj], total_);
}
MemMeter::LineInfo *MemMeter::findLines(LineInfo *tmplate, int len,
--- linux/memmeter.h
+++ linux/memmeter.h 2006-07-26 15:30:32.000000000 +0000
@@ -9,7 +9,7 @@
#include "fieldmetergraph.h"
-class MemMeter : public FieldMeterGraph {
+class MemMeter : public FieldMeterGraph<double> {
public:
MemMeter( XOSView *parent );
~MemMeter( void );
--- linux/netmeter.cc
+++ linux/netmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -48,7 +48,7 @@
#include <string>
NetMeter::NetMeter( XOSView *parent, float max )
- : FieldMeterGraph( parent, 3, "NET", "IN/OUT/IDLE" ){
+ : FieldMeterGraph<float>( parent, 3, "NET", "IN/OUT/IDLE" ){
_timer.start();
maxpackets_ = max;
_lastBytesIn = _lastBytesOut = 0;
@@ -119,7 +119,7 @@ void NetMeter::checkOSVersion(void)
}
void NetMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "netInColor" ) );
setfieldcolor( 1, parent_->getResource( "netOutColor" ) );
--- linux/netmeter.h
+++ linux/netmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -12,7 +12,7 @@
class Host;
-class NetMeter : public FieldMeterGraph {
+class NetMeter : public FieldMeterGraph<float> {
public:
NetMeter(XOSView *parent, float max);
~NetMeter( void );
--- linux/nfsmeter.cc
+++ linux/nfsmeter.cc 2012-02-01 09:35:03.062433741 +0000
@@ -34,7 +34,7 @@ static const char * NFSCLTSTAT = "/proc/
NFSMeter::NFSMeter(XOSView *parent, const char *name, int nfields,
const char *fields, const char *statfile)
- : FieldMeterGraph( parent, nfields, name, fields ){
+ : FieldMeterGraph<float>( parent, nfields, name, fields ){
_statfile = statfile;
_statname = name;
}
@@ -43,7 +43,7 @@ NFSMeter::~NFSMeter( void ){
}
void NFSMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
}
NFSDStats::NFSDStats(XOSView *parent)
--- linux/nfsmeter.h
+++ linux/nfsmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -11,7 +11,7 @@
class Host;
-class NFSMeter : public FieldMeterGraph {
+class NFSMeter : public FieldMeterGraph<float> {
public:
NFSMeter(
XOSView *parent,
--- linux/pagemeter.cc
+++ linux/pagemeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -16,7 +16,7 @@
PageMeter::PageMeter( XOSView *parent, float max )
- : FieldMeterGraph( parent, 3, "PAGE", "IN/OUT/IDLE" ),
+ : FieldMeterGraph<float>( parent, 3, "PAGE", "IN/OUT/IDLE" ),
_vmstat(false), _statFileName("/proc/stat"){
for ( int i = 0 ; i < 2 ; i++ )
for ( int j = 0 ; j < 2 ; j++ )
@@ -38,7 +38,7 @@ PageMeter::~PageMeter( void ){
}
void PageMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "pageInColor" ) );
setfieldcolor( 1, parent_->getResource( "pageOutColor" ) );
--- linux/pagemeter.h
+++ linux/pagemeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include "fieldmetergraph.h"
-class PageMeter : public FieldMeterGraph {
+class PageMeter : public FieldMeterGraph<float> {
public:
PageMeter( XOSView *parent, float max );
~PageMeter( void );
--- linux/swapmeter.cc
+++ linux/swapmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -24,7 +24,7 @@ static const char MEMFILENAME[] = "/proc
SwapMeter::SwapMeter( XOSView *parent )
-: FieldMeterGraph( parent, 2, "SWAP", "USED/FREE" ){
+: FieldMeterGraph<float>( parent, 2, "SWAP", "USED/FREE" ){
}
@@ -32,7 +32,7 @@ SwapMeter::~SwapMeter( void ){
}
void SwapMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource( "swapUsedColor" ) );
setfieldcolor( 1, parent_->getResource( "swapFreeColor" ) );
--- linux/swapmeter.h
+++ linux/swapmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -11,7 +11,7 @@
#include "fieldmetergraph.h"
-class SwapMeter : public FieldMeterGraph {
+class SwapMeter : public FieldMeterGraph<float> {
public:
SwapMeter( XOSView *parent );
~SwapMeter( void );
--- sunos5/cpumeter.cc
+++ sunos5/cpumeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -10,7 +10,7 @@
#include <sstream>
CPUMeter::CPUMeter(XOSView *parent, kstat_ctl_t *_kc, int cpuid)
- : FieldMeterGraph(parent, CPU_STATES, toUpper(cpuStr(cpuid)),
+ : FieldMeterGraph<float>(parent, CPU_STATES, toUpper(cpuStr(cpuid)),
"USER/SYS/WAIT/IDLE")
{
kc = _kc;
@@ -35,7 +35,7 @@ CPUMeter::~CPUMeter(void)
void CPUMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor(0, parent_->getResource("cpuUserColor"));
setfieldcolor(1, parent_->getResource("cpuSystemColor"));
--- sunos5/cpumeter.h
+++ sunos5/cpumeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include <kstat.h>
#include <sys/sysinfo.h>
-class CPUMeter : public FieldMeterGraph {
+class CPUMeter : public FieldMeterGraph<float> {
public:
CPUMeter(XOSView *parent, kstat_ctl_t *kcp, int cpuid = 0);
~CPUMeter(void);
--- sunos5/diskmeter.cc
+++ sunos5/diskmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -10,7 +10,7 @@
DiskMeter::DiskMeter( XOSView *parent, kstat_ctl_t *_kc, float max )
- : FieldMeterGraph( parent, 3, "DISK", "READ/WRITE/IDLE")
+ : FieldMeterGraph<float>( parent, 3, "DISK", "READ/WRITE/IDLE")
{
kc = _kc;
read_prev_ = 0;
@@ -35,7 +35,7 @@ DiskMeter::~DiskMeter( void )
void DiskMeter::checkResources( void )
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource("diskReadColor") );
setfieldcolor( 1, parent_->getResource("diskWriteColor") );
--- sunos5/diskmeter.h
+++ sunos5/diskmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -11,7 +11,7 @@
#include <kstat.h>
#define NPARTS 100
-class DiskMeter : public FieldMeterGraph
+class DiskMeter : public FieldMeterGraph<float>
{
public:
DiskMeter( XOSView *parent, kstat_ctl_t *_kc, float max );
--- sunos5/loadmeter.cc
+++ sunos5/loadmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -10,7 +10,7 @@
using std::cerr;
LoadMeter::LoadMeter(XOSView *parent, kstat_ctl_t *_kc)
- : FieldMeterGraph(parent, 2, "LOAD", "PROCS/MIN", 1, 1, 0)
+ : FieldMeterGraph<float>(parent, 2, "LOAD", "PROCS/MIN", 1, 1, 0)
{
kc = _kc;
ksp = kstat_lookup(kc, "unix", 0, "system_misc");
@@ -26,7 +26,7 @@ LoadMeter::~LoadMeter(void)
void LoadMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
warnloadcol_ = parent_->allocColor(
parent_->getResource("loadWarnColor" ));
--- sunos5/loadmeter.h
+++ sunos5/loadmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -7,7 +7,7 @@
#include "fieldmetergraph.h"
#include <kstat.h>
-class LoadMeter : public FieldMeterGraph {
+class LoadMeter : public FieldMeterGraph<float> {
public:
LoadMeter(XOSView *parent, kstat_ctl_t *kcp);
~LoadMeter(void);
--- sunos5/memmeter.cc
+++ sunos5/memmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -7,7 +7,7 @@
#include <stdlib.h>
MemMeter::MemMeter(XOSView *parent, kstat_ctl_t *_kc)
- : FieldMeterGraph(parent, 2, "MEM", "USED/FREE")
+ : FieldMeterGraph<double>(parent, 2, "MEM", "USED/FREE")
{
kc = _kc;
@@ -23,7 +23,7 @@ MemMeter::MemMeter(XOSView *parent, ksta
void MemMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<double>::checkResources();
setfieldcolor(0, parent_->getResource("memUsedColor"));
setfieldcolor(1, parent_->getResource("memFreeColor"));
--- sunos5/memmeter.h
+++ sunos5/memmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -7,7 +7,7 @@
#include "fieldmetergraph.h"
#include <kstat.h>
-class MemMeter : public FieldMeterGraph {
+class MemMeter : public FieldMeterGraph<double> {
public:
MemMeter(XOSView *parent, kstat_ctl_t *kcp);
~MemMeter(void);
--- sunos5/netmeter.cc
+++ sunos5/netmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -9,7 +9,7 @@
#include <stdlib.h>
NetMeter::NetMeter( XOSView *parent, kstat_ctl_t *_kc, float max )
- : FieldMeterGraph( parent, 3, "NET", "IN/OUT/IDLE" ){
+ : FieldMeterGraph<float>( parent, 3, "NET", "IN/OUT/IDLE" ){
kc = _kc;
maxpackets_ = max;
nnet=0;
@@ -48,7 +48,7 @@ NetMeter::~NetMeter( void ){
}
void NetMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor( 0, parent_->getResource("netInColor") );
setfieldcolor( 1, parent_->getResource("netOutColor") );
--- sunos5/netmeter.h
+++ sunos5/netmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -14,7 +14,7 @@
class Host;
-class NetMeter : public FieldMeterGraph {
+class NetMeter : public FieldMeterGraph<float> {
public:
NetMeter(XOSView *parent, kstat_ctl_t *_kc, float max);
~NetMeter( void );
--- sunos5/pagemeter.cc
+++ sunos5/pagemeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -8,7 +8,7 @@
#include <sys/sysinfo.h>
PageMeter::PageMeter(XOSView *parent, kstat_ctl_t *_kc, float max)
- : FieldMeterGraph( parent, 3, "PAGE", "IN/OUT/IDLE")
+ : FieldMeterGraph<float>( parent, 3, "PAGE", "IN/OUT/IDLE")
{
kc = _kc;
@@ -34,7 +34,7 @@ PageMeter::~PageMeter(void)
void PageMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor(0, parent_->getResource("pageInColor"));
setfieldcolor(1, parent_->getResource("pageOutColor"));
--- sunos5/pagemeter.h
+++ sunos5/pagemeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -7,7 +7,7 @@
#include "fieldmetergraph.h"
#include <kstat.h>
-class PageMeter : public FieldMeterGraph {
+class PageMeter : public FieldMeterGraph<float> {
public:
PageMeter(XOSView *parent, kstat_ctl_t *kcp, float max);
~PageMeter(void);
--- sunos5/swapmeter.cc
+++ sunos5/swapmeter.cc 2006-07-26 15:13:10.000000000 +0000
@@ -11,7 +11,7 @@
static size_t Pagesize;
SwapMeter::SwapMeter(XOSView *parent, kstat_ctl_t *_kc)
- : FieldMeterGraph(parent, 3, "SWAP", "USED/RSVD/FREE")
+ : FieldMeterGraph<float>(parent, 3, "SWAP", "USED/RSVD/FREE")
{
if (!Pagesize)
Pagesize = sysconf(_SC_PAGESIZE);
@@ -23,7 +23,7 @@ SwapMeter::~SwapMeter(void)
void SwapMeter::checkResources(void)
{
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
setfieldcolor(0, parent_->getResource("swapUsedColor"));
setfieldcolor(1, parent_->getResource("swapReservedColor"));
--- sunos5/swapmeter.h
+++ sunos5/swapmeter.h 2006-07-26 15:13:10.000000000 +0000
@@ -7,7 +7,7 @@
#include "fieldmetergraph.h"
#include <kstat.h>
-class SwapMeter : public FieldMeterGraph {
+class SwapMeter : public FieldMeterGraph<float> {
public:
SwapMeter(XOSView *parent, kstat_ctl_t *kcp);
~SwapMeter(void);
--- linux/wirelessmeter.h
+++ linux/wirelessmeter.h 2012-02-07 18:20:40.385933873 +0000
@@ -13,7 +13,7 @@
#include "fieldmetergraph.h"
-class WirelessMeter : public FieldMeterGraph {
+class WirelessMeter : public FieldMeterGraph<float> {
public:
WirelessMeter( XOSView *parent, int ID = 1, const char *wlID = "WL");
~WirelessMeter( void );
--- linux/wirelessmeter.cc
+++ linux/wirelessmeter.cc 2012-02-07 18:21:03.602432023 +0000
@@ -20,7 +20,7 @@ using namespace std;
static const char WLFILENAME[] = "/proc/net/wireless";
WirelessMeter::WirelessMeter( XOSView *parent, int ID, const char *wlID)
- : FieldMeterGraph ( parent, 2, wlID, "LINK/LEVEL", 1, 1, 0 ), _number(ID) {
+ : FieldMeterGraph<float> ( parent, 2, wlID, "LINK/LEVEL", 1, 1, 0 ), _number(ID) {
lastqualitystate = -1;
strcpy(devname, "0");
}
@@ -29,7 +29,7 @@ WirelessMeter::~WirelessMeter( void ){
}
void WirelessMeter::checkResources( void ){
- FieldMeterGraph::checkResources();
+ FieldMeterGraph<float>::checkResources();
poorqualcol_ = parent_->allocColor(parent_->getResource( "PoorQualityColor" ));
fairqualcol_ = parent_->allocColor(parent_->getResource( "FairQualityColor" ));