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