[PATCH] find_port: only find ports where the name match if no RegExp is given
Matthias Goldhoorn
matthias.goldhoorn at dfki.de
Wed Sep 4 09:42:57 CEST 2013
---
lib/orocos/ports_searchable.rb | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/lib/orocos/ports_searchable.rb b/lib/orocos/ports_searchable.rb
index b741b72..6b89252 100644
--- a/lib/orocos/ports_searchable.rb
+++ b/lib/orocos/ports_searchable.rb
@@ -22,13 +22,27 @@ def find_all_ports(type, port_name=nil)
end
candidates.delete_if { |port| port.type_name != type_name }
end
+
+
# Filter out on name
if port_name
- if !port_name.kind_of?(Regexp)
- port_name = Regexp.new(port_name)
+ p_name = nil
+ #checkeing wether we should take the fullname or only the portname itself
+ candidates.delete_if do |port|
+ if(port_name.include?("."))
+ p_name = port.full_name
+ else
+ p_name = port.name
+ end
+ res = nil
+ if port_name.kind_of?(Regexp)
+ res = p_name !~ port_name
+ else
+ res = p_name != port_name
+ end
+ res
end
- candidates.delete_if { |port| port.full_name !~ port_name }
end
candidates
end
--
1.7.10.4
--------------070006090004080105050105--
More information about the Rock-dev
mailing list