Line | |
---|
1 | #ifndef _AXIS_RANGE_H |
---|
2 | #define _AXIS_RANGE_H |
---|
3 | |
---|
4 | #include <string.h> |
---|
5 | |
---|
6 | class AxisRange { |
---|
7 | double min_, max_; |
---|
8 | char *units_; |
---|
9 | public: |
---|
10 | AxisRange(void) { |
---|
11 | min(0.0); |
---|
12 | max(1.0); |
---|
13 | units_ = NULL; |
---|
14 | } |
---|
15 | ~AxisRange(void) { |
---|
16 | if (units_ != NULL) { |
---|
17 | delete [] units_; |
---|
18 | } |
---|
19 | } |
---|
20 | void SetRange(double min, double max) { |
---|
21 | min_ = min, max_ = max; |
---|
22 | } |
---|
23 | double min(void) { |
---|
24 | return min_; |
---|
25 | } |
---|
26 | void min(double min) { |
---|
27 | min_ = min; |
---|
28 | } |
---|
29 | double max(void) { |
---|
30 | return max_; |
---|
31 | } |
---|
32 | void max(double max) { |
---|
33 | max_ = max; |
---|
34 | } |
---|
35 | const char *units(void) { |
---|
36 | return units_; |
---|
37 | } |
---|
38 | void units(const char *units) { |
---|
39 | if (units_ != NULL) { |
---|
40 | delete [] units_; |
---|
41 | } |
---|
42 | if (units == NULL) { |
---|
43 | units_ = NULL; |
---|
44 | } else { |
---|
45 | units_ = new char [strlen(units) + 1]; |
---|
46 | strcpy(units_, units); |
---|
47 | } |
---|
48 | } |
---|
49 | }; |
---|
50 | |
---|
51 | #endif /*_AXIS_RANGE_H*/ |
---|
Note: See
TracBrowser
for help on using the repository browser.