605 |
void DeviceCreationParameterInt::SetValue(String val) throw (Exception) { |
void DeviceCreationParameterInt::SetValue(String val) throw (Exception) { |
606 |
if (Fix()) throw Exception("Device parameter is read only"); |
if (Fix()) throw Exception("Device parameter is read only"); |
607 |
int i = __parse_int(val); |
int i = __parse_int(val); |
608 |
//if (RangeMinAsInt() && i < *RangeMinAsInt()) throw Exception("Invalid device parameter value: too small"); |
|
609 |
//if (RangeMaxAsInt() && i > *RangeMaxAsInt()) throw Exception("Invalid device parameter value: too big"); |
std::map<String,String> emptyMap; |
610 |
/*if (PossibilitiesAsInt()) { |
if (RangeMinAsInt(emptyMap) && i < *RangeMinAsInt(emptyMap)) { |
611 |
|
throw Exception("Invalid device parameter value: too small"); |
612 |
|
} |
613 |
|
if (RangeMaxAsInt(emptyMap) && i > *RangeMaxAsInt(emptyMap)) { |
614 |
|
throw Exception("Invalid device parameter value: too big"); |
615 |
|
} |
616 |
|
|
617 |
|
if (PossibilitiesAsInt(emptyMap).size()) { |
618 |
bool valid = false; |
bool valid = false; |
619 |
std::vector<int>* pPossibilities = PossibilitiesAsInt(); |
std::vector<int> possibilities = PossibilitiesAsInt(emptyMap); |
620 |
std::vector<int>::iterator iter = pPossibilities->begin(); |
std::vector<int>::iterator iter = possibilities.begin(); |
621 |
while (iter != pPossibilities->end()) { |
while (iter != possibilities.end()) { |
622 |
if (i == *iter) { |
if (i == *iter) { |
623 |
valid = true; |
valid = true; |
624 |
break; |
break; |
626 |
iter++; |
iter++; |
627 |
} |
} |
628 |
if (!valid) throw Exception("Invalid Device parameter value: not in set of possible values"); |
if (!valid) throw Exception("Invalid Device parameter value: not in set of possible values"); |
629 |
}*/ |
} |
630 |
SetValue(i); |
SetValue(i); |
631 |
} |
} |
632 |
|
|