2
// Copyright (c) 1994, 1995, 2006 by Mike Romberg ( mike.romberg@noaa.gov )
4
// This file may be distributed under terms of the GPL
10
#define _FIELDMETER_H_
12
#define FIELDMETER_H_CVSID "$Id$"
17
class FieldMeter : public Meter {
19
FieldMeter( XOSView *parent, int numfields,
20
const char *title = "", const char *legend = "",
21
int docaptions = 0, int dolegends = 0, int dousedlegends = 0 );
22
virtual ~FieldMeter( void );
24
virtual void drawfields( int manditory = 0 );
25
void setfieldcolor( int field, const char *color );
26
void setfieldcolor( int field, unsigned long color);
27
void docaptions( int val ) { docaptions_ = val; }
28
void dolegends( int val ) { dolegends_ = val; }
29
void dousedlegends( int val ) { dousedlegends_ = val; }
31
/* These next two are deprecated -- use setUsed instead. bgrayson */
32
void used_obsolete( int val ) { print_ = PERCENT; used_ = val; }
33
void absolute_obsolete( float val ) { print_ = FLOAT; used_ = val; }
35
void setUsed (float val, float total);
37
void checkevent( void );
38
void disableMeter ( void );
40
virtual void checkResources( void );
43
enum UsedType { INVALID_0, FLOAT, PERCENT, AUTOSCALE, INVALID_TAIL };
47
float total_, used_, lastused_;
48
int *lastvals_, *lastx_;
49
unsigned long *colors_;
50
unsigned long usedcolor_;
52
int printedZeroTotalMesg_;
55
void SetUsedFormat ( const char * const str );
56
void drawlegend( void );
57
void drawused( int manditory );
58
bool checkX(int x, int width) const;
60
void setNumFields(int n);
66
void IntervalTimerStart() { _timer.start(); }
67
void IntervalTimerStop() { _timer.stop(); }
68
// Before, we simply called _timer.report(), which returns usecs.
69
// However, it suffers from wrap/overflow/sign-bit problems, so
70
// instead we use doubles for everything.
71
double IntervalTimeInMicrosecs() { return _timer.report_usecs(); }
72
double IntervalTimeInSecs() { return _timer.report_usecs()/1e6; }