X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FFloatType.cpp;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FFloatType.cpp;h=88f8d4d50cdf5f81ddb470059e093e5e9a368107;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/FloatType.cpp b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/FloatType.cpp new file mode 100644 index 000000000..88f8d4d50 --- /dev/null +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/FloatType.cpp @@ -0,0 +1,65 @@ +#include "FloatType.h" + +#include "Range.h" +#include "Limit.h" + +#include + +namespace Databoard { + namespace Type { + + FloatType::FloatType() : NumberType() + { + this->range = NULL; + } + + FloatType::FloatType(std::string unit) : NumberType(unit) + { + this->unit = unit; + this->range = NULL; + } + + FloatType::FloatType(std::string unit, Range* range) : NumberType(unit, range) + { + this->unit = unit; + this->range = range; + } + + FloatType::~FloatType() + { + } + + float FloatType::minValue() + { + if(range == NULL) return FLT_MIN; + + Limit* l = range->getLower(); + + float value = l->getFloat(FLT_MIN); + + return value; + } + + float FloatType::maxValue() + { + if(range == NULL) return FLT_MAX; + + Limit* l = range->getUpper(); + + float value = l->getFloat(FLT_MAX); + + return value; + } + + std::string FloatType::writeOut(int indent) + { + std::string s; + + s.append("Float"); + + s += NumberType::writeOut(indent + 1); + + return s; + } + } +}