24 const uint Parameterization::HASH_CODE_NOT_COMPUTED = 0;
25 const uint Parameterization::HASH_FACTOR = 89;
26 const uint Parameterization::HASH_INITIAL =
qHash(
"berry::Parameterization");
29 : hashCode(HASH_CODE_NOT_COMPUTED), parameter(parameter), value(value)
33 throw ctkInvalidArgumentException(
34 "You cannot parameterize a null parameter");
39 : hashCode(p.hashCode), parameter(p.parameter), value(p.value)
46 this->hashCode = p.hashCode;
47 this->parameter = p.parameter;
48 this->value = p.value;
55 if (
this == ¶meterization)
64 if (this->parameter->GetId() != parameterization.parameter->GetId())
69 return (this->value == parameterization.value);
72 Parameterization::operator bool()
const
89 const QHash<QString,QString> parameterValues = parameter->GetValues()->GetParameterValues();
92 for (IParameter::ParameterValues::const_iterator parameterValueItr = parameterValues.begin();
93 parameterValueItr != parameterValues.end(); ++ parameterValueItr)
95 const QString currentValue(parameterValueItr.value());
96 if (value == currentValue)
98 returnValue = parameterValueItr.key();
108 if (hashCode == HASH_CODE_NOT_COMPUTED)
110 hashCode = HASH_INITIAL * HASH_FACTOR + parameter->HashCode();
111 hashCode = hashCode * HASH_FACTOR +
qHash(value);
112 if (hashCode == HASH_CODE_NOT_COMPUTED)
Parameterization(const SmartPointer< const IParameter > parameter, const QString &value)
SmartPointer< const IParameter > GetParameter() const
Implements transparent reference counting.
bool operator==(const Parameterization ¶meterization) const
QString GetValueName() const
Parameterization & operator=(const Parameterization &p)
uint qHash(const berry::Object &o)