12 LongValue::LongValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)
16 LongValue::~LongValue()
20 void LongValue::setValue(long value)
22 Databoard::Type::LongType* longType = dynamic_cast<Databoard::Type::LongType*>(dataBoard);
30 long LongValue::getValue()
35 std::string LongValue::writeOut(int /*indent*/)
39 std::stringstream oss;
45 //if(unit.size() != 0)
47 // s += "(Unit=\"" + unit + "\")";
53 bool LongValue::equals(const Value* other)
55 LongValue* o = (LongValue*)other;
57 return (this->value < o->value);
61 std::string LongValue::isValid()
65 return "LongValue: There is no datatype.";
68 Databoard::Type::LongType* longType = (Databoard::Type::LongType*)dataBoard;
70 if(longType->getRange() == NULL)
75 int minValue = longType->minValue();
76 int maxValue = longType->maxValue();
78 if(longType->getRange()->getLower()->getInclusive() == true)
82 return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL;
85 else //if(longType->getRange()->getLower()->getInclusive() == false)
89 return std::string("LongValue: ") + STR_ERROR_VALUE_SMALL;
93 if(longType->getRange()->getUpper()->getInclusive() == true)
97 return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE;
100 else //if(longType->getRange()->getUpper()->getInclusive() == false)
102 if(value >= maxValue)
104 return std::string("LongValue: ") + STR_ERROR_VALUE_LARGE;