bibi21000, 29.08.2012 21:38:
> Hi all
> I try to update python-openzwave and I've got some problems. The first is
> an ambiguous overloaded method when trying to compile
> I try to compile it on 0.14 (oneiric) and 0.15 (precise)
> Here is the pyx :
>
> if values_map.find(id) != values_map.end():
> datatype = PyValueTypes[
values_map.at(id).GetType()]
>
> if datatype == "Bool":
> type_bool = value
> self.manager.SetValue(
values_map.at(id), type_bool)
> elif datatype == "Byte":
> type_byte = value
> self.manager.SetValue(
values_map.at(id),
> type_byte)
> elif datatype == "Decimal":
> type_float = value
> self.manager.SetValue(
values_map.at(id), type_float)
> # TODO: this gives me an "ambiguous overloaded method", I don't
> understand why.
> elif datatype == "Int":
> type_int = value
> self.manager.SetValue(
values_map.at(id), type_int)
> #elif datatype == "Short":
> # type_short = value
> # self.manager.SetValue(
values_map.at(id), type_short)
> elif datatype == "String":
> type_string = string(value)
> self.manager.SetValue(
values_map.at(id), type_string)
>
> The C headers
> bool SetValue( ValueID const& _id, bool const _value );
> bool SetValue( ValueID const& _id, uint8 const _value );
> bool SetValue( ValueID const& _id, float const _value );
> bool SetValue( ValueID const& _id, int32 const _value );
> bool SetValue( ValueID const& _id, int16 const _value );
> bool SetValue( ValueID const& _id, string const& _value );
>
> And the result of the compilation :
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> type_float = value
> self.manager.SetValue(
values_map.at(id), type_float)
> # TODO: this gives me an "ambiguous overloaded method", I don't
> understand why.
> elif datatype == "Int":
> type_int = value
> self.manager.SetValue(
values_map.at(id), type_int)
> ^
> ------------------------------------------------------------
>
> openzwave.pyx:1229:37: ambiguous overloaded method
Apparently, the author(s) had the same problem:
https://github.com/maartendamen/py-openzwave/blob/master/openzwave.pyx#L1134
It's based on these declarations further above in the file:
bint SetValue(ValueID& valueid, bint value)
bint SetValue(ValueID& valueid, uint8 value)
bint SetValue(ValueID& valueid, float value)
bint SetValue(ValueID& valueid, int32 value)
bint SetValue(ValueID& valueid, int16 value)
bint SetValue(ValueID& valueid, string value)
Note that the first parameter that is passed into the method is not a C++
reference type but the plain value type. Just a guess, but that might lead
to a slight difference in the signature matching that prevents an exact
match. IMHO, it shouldn't.
As a work-around, use the github version of their code.
Stefan