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