20 const uint Parameterization::HASH_CODE_NOT_COMPUTED = 0;
21 const uint Parameterization::HASH_FACTOR = 89;
22 const uint Parameterization::HASH_INITIAL =
qHash(
"berry::Parameterization");
25 : hashCode(HASH_CODE_NOT_COMPUTED), parameter(parameter), value(value)
29 throw ctkInvalidArgumentException(
30 "You cannot parameterize a null parameter");
35 : hashCode(p.hashCode), parameter(p.parameter), value(p.value)
42 this->hashCode = p.hashCode;
43 this->parameter = p.parameter;
44 this->value = p.value;
51 if (
this == ¶meterization)
60 if (this->parameter->GetId() != parameterization.parameter->GetId())
65 return (this->value == parameterization.value);
68 Parameterization::operator bool()
const 85 const QHash<QString,QString> parameterValues = parameter->GetValues()->GetParameterValues();
88 for (IParameter::ParameterValues::const_iterator parameterValueItr = parameterValues.begin();
89 parameterValueItr != parameterValues.end(); ++ parameterValueItr)
91 const QString currentValue(parameterValueItr.value());
92 if (value == currentValue)
94 returnValue = parameterValueItr.key();
104 if (hashCode == HASH_CODE_NOT_COMPUTED)
106 hashCode = HASH_INITIAL * HASH_FACTOR + parameter->HashCode();
107 hashCode = hashCode * HASH_FACTOR +
qHash(value);
108 if (hashCode == HASH_CODE_NOT_COMPUTED)
Parameterization(const SmartPointer< const IParameter > parameter, const QString &value)
Implements transparent reference counting.
SmartPointer< const IParameter > GetParameter() const
QString GetValueName() const
bool operator==(const Parameterization ¶meterization) const
Parameterization & operator=(const Parameterization &p)
uint qHash(const berry::Object &o)