[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 11:12:10 CEST 2013
---
lib/orocos/ports_searchable.rb | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/orocos/ports_searchable.rb b/lib/orocos/ports_searchable.rb
index b741b72..0765298 100644
--- a/lib/orocos/ports_searchable.rb
+++ b/lib/orocos/ports_searchable.rb
@@ -22,13 +22,21 @@ 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
+ candidates.delete_if do |port|
+ #checkeing wether we should take the fullname or only the portname itself
+ if(port_name.include?("."))
+ p_name = port.full_name
+ else
+ p_name = port.name
+ end
+ !(port_name === p_name)
end
- candidates.delete_if { |port| port.full_name !~ port_name }
end
candidates
end
--
1.7.10.4
--------------080001010703040007030902--
More information about the Rock-dev
mailing list