]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/FloatType.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / FloatType.cpp
1 #include "FloatType.h"
2
3 #include "Range.h"
4 #include "Limit.h"
5
6 #include <cfloat>
7
8 namespace Databoard {
9         namespace Type {
10
11                 FloatType::FloatType() : NumberType()
12                 {
13                         this->range = NULL;
14                 }
15
16                 FloatType::FloatType(std::string unit) : NumberType(unit)
17                 {
18                         this->unit = unit;
19                         this->range = NULL;
20                 }
21
22                 FloatType::FloatType(std::string unit, Range* range) : NumberType(unit, range)
23                 {
24                         this->unit = unit;
25                         this->range = range;
26                 }
27
28                 FloatType::~FloatType()
29                 {
30                 }
31
32                 float FloatType::minValue()
33                 {
34                         if(range == NULL) return FLT_MIN;
35
36                         Limit* l = range->getLower();
37
38                         float value = l->getFloat(FLT_MIN);
39
40                         return value;
41                 }
42
43                 float FloatType::maxValue()
44                 {
45                         if(range == NULL) return FLT_MAX;
46
47                         Limit* l = range->getUpper();
48
49                         float value = l->getFloat(FLT_MAX);
50
51                         return value;
52                 }
53
54                 std::string FloatType::writeOut(int indent)
55                 {
56                         std::string s;
57
58                         s.append("Float");
59
60                         s += NumberType::writeOut(indent + 1);
61
62                         return s;
63                 }
64         }
65 }