~ubuntu-branches/ubuntu/maverick/xosview/maverick

« back to all changes in this revision

Viewing changes to .pc/11_float_to_double_151611.diff/fieldmeter.h

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2010-06-01 20:02:57 UTC
  • mfrom: (6.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100601200257-orz2mey0oilujocu
Tags: 1.8.3+debian-21
* debian/source/format:
  + Added to use source format 3.0 (quilt)
* debian/watch:
  + Fixed dversionmangle format
* Update debian/compat to 7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
//  Copyright (c) 1994, 1995, 2006 by Mike Romberg ( mike.romberg@noaa.gov )
 
3
//
 
4
//  This file may be distributed under terms of the GPL
 
5
//
 
6
//
 
7
// $Id$
 
8
//
 
9
#ifndef _FIELDMETER_H_
 
10
#define _FIELDMETER_H_
 
11
 
 
12
#define FIELDMETER_H_CVSID "$Id$"
 
13
 
 
14
#include "meter.h"
 
15
#include "timer.h"
 
16
 
 
17
class FieldMeter : public Meter {
 
18
public:
 
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 );
 
23
 
 
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; }
 
30
  void reset( void );
 
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; }
 
34
 
 
35
  void setUsed (float val, float total);
 
36
  void draw( void );
 
37
  void checkevent( void );
 
38
  void disableMeter ( void );
 
39
 
 
40
  virtual void checkResources( void );
 
41
 
 
42
protected:
 
43
  enum UsedType { INVALID_0, FLOAT, PERCENT, AUTOSCALE, INVALID_TAIL };
 
44
 
 
45
  int numfields_;
 
46
  float *fields_;
 
47
  float total_, used_, lastused_;
 
48
  int *lastvals_, *lastx_;
 
49
  unsigned long *colors_;
 
50
  unsigned long usedcolor_;
 
51
  UsedType print_;
 
52
  int printedZeroTotalMesg_;
 
53
  int numWarnings_;
 
54
 
 
55
  void SetUsedFormat ( const char * const str );
 
56
  void drawlegend( void );
 
57
  void drawused( int manditory );
 
58
  bool checkX(int x, int width) const;
 
59
 
 
60
  void setNumFields(int n);
 
61
 
 
62
 
 
63
private:
 
64
  Timer _timer;
 
65
protected:
 
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; }
 
73
};
 
74
 
 
75
#endif