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