[Rock-dev] How to explicit assign task ports to service ports?
Matthias Goldhoorn
matthias.goldhoorn at dfki.de
Wed Sep 4 10:49:04 CEST 2013
On 04.09.2013 10:43, Sylvain Joyeux wrote:
> On 09/04/2013 10:08 AM, Matthias Goldhoorn wrote:
>> Try apply the attached patch.
>>
>> @other rock dev's:
>> Are you fine with that patch, it will change the behavior of the
>> function. In the past every given portname-string was interpreted as a
>> regular expression, which causes the fault if there ports like this:
>>
>> a.somename
>> a.somenameextension
>>
>> There was no way to get ony the first port out of this function.
>>
>> Second Problem was/is that the function tool always uses the full_name
>> for comparison, that means the port names were compared with
>> "task.port" and not ony "port". I added the separation by checking if
>> an "." (dot) is present in the given string for the port-resolution.
> I personally don't see the point of testing against the task. The
> receiver *is* the task, so we should only match against the port name.
Don't know where this code was used, maybe internal for the logger?, to
get access ther.
sinc'e i don't know this special point i try to prevent breaking code.
>
> The "pattern matching" operator in Ruby is ===, so you can replace
>
> + if port_name.kind_of?(Regexp)
> + res = p_name !~ port_name
> + else
> + res = p_name != port_name
> + end
>
> by
>
> res = (port_name === p_name)
I specially want to handle RegularExpressions differently than strings
to keep the possibility to use the RegExp witin this function.
Handly everything as a RegExp causes the error above.
http://www.ruby-doc.org/core-1.9.3/String.html#method-i-3D-3D-3D
mention that == and === are equal?!
--
Dipl.-Inf. Matthias Goldhoorn
Space and Underwater Robotic
Universität Bremen
FB 3 - Mathematik und Informatik
AG Robotik
Robert-Hooke-Straße 5
28359 Bremen, Germany
Tel.: +49 421 178 45-4193
Zentrale: +49 421 178 45-6550
Fax: +49 421 178 45-4150
E-Mail: matthias.goldhoorn at uni-bremen.de
Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
More information about the Rock-dev
mailing list