1 #include "IntegerValue.h"
3 #include "NumberType.h"
4 #include "IntegerType.h"
13 IntegerValue::IntegerValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)
17 IntegerValue::~IntegerValue()
21 void IntegerValue::setValue(int value)
23 Databoard::Type::IntegerType* integerType = dynamic_cast<Databoard::Type::IntegerType*>(dataBoard);
25 if(integerType != NULL)
31 int IntegerValue::getValue()
36 std::string IntegerValue::writeOut(int /*indent*/)
40 std::stringstream oss;
49 bool IntegerValue::equals(const Value* other)
51 IntegerValue* o = (IntegerValue*)other;
53 return (this->value < o->value);
56 std::string IntegerValue::isValid()
60 return "IntegerValue: There is no datatype.";
63 Databoard::Type::IntegerType* integerType = (Databoard::Type::IntegerType*)dataBoard;
65 if(integerType->getRange() == NULL)
70 int minValue = integerType->minValue();
71 int maxValue = integerType->maxValue();
73 if(integerType->getRange()->getLower()->getInclusive() == true)
77 return std::string("IntegerValue: ") + STR_ERROR_VALUE_SMALL;
80 else //if(integerType->getRange()->getLower()->getInclusive() == false)
84 return std::string("IntegerValue: ") + STR_ERROR_VALUE_SMALL;
88 if(integerType->getRange()->getUpper()->getInclusive() == true)
92 return std::string("IntegerValue: ") + STR_ERROR_VALUE_LARGE;
95 else //if(integerType->getRange()->getUpper()->getInclusive() == false)
99 return std::string("IntegerValue: ") + STR_ERROR_VALUE_LARGE;