Class: OroGen::ROS::Spec::XML::NodeDescription
- Inherits:
-
Object
- Object
- OroGen::ROS::Spec::XML::NodeDescription
- Defined in:
- lib/orogen/ros/spec/launcher.rb
Overview
This class represents the node description which can be extracted from a launch file
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.from_xml_node(node) ⇒ OroGen::ROS::Spec::XML::NodeDescription
Create a node description from a xml node.
-
.optional_attr ⇒ Hash
Optional attributes in the ROS launcher specification.
Instance Method Summary collapse
-
#initialize(name, package, type) ⇒ NodeDescription
constructor
Initialize the node description.
-
#to_s ⇒ String
String description of this object.
Constructor Details
#initialize(name, package, type) ⇒ NodeDescription
Initialize the node description
30 31 32 33 34 35 36 37 38 |
# File 'lib/orogen/ros/spec/launcher.rb', line 30 def initialize(name, package, type) @name = name @package = package @type = type NodeDescription.optional_attr.each do |op, val| self.instance_variable_set "@#{op}", val end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name
12 13 14 |
# File 'lib/orogen/ros/spec/launcher.rb', line 12 def name @name end |
#package ⇒ Object (readonly)
Returns the value of attribute package
10 11 12 |
# File 'lib/orogen/ros/spec/launcher.rb', line 10 def package @package end |
#type ⇒ Object (readonly)
Returns the value of attribute type
11 12 13 |
# File 'lib/orogen/ros/spec/launcher.rb', line 11 def type @type end |
Class Method Details
.from_xml_node(node) ⇒ OroGen::ROS::Spec::XML::NodeDescription
Create a node description from a xml node
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/orogen/ros/spec/launcher.rb', line 42 def self.from_xml_node(node) name = node.attributes["name"].to_s package = node.attributes["pkg"].to_s type = node.attributes["type"].to_s nd = NodeDescription.new(name, package, type) NodeDescription.optional_attr.each do |o,_| if attr = node.attributes[o.to_s] nd.instance_variable_set("@#{o}",attr) end end nd end |
.optional_attr ⇒ Hash
Optional attributes in the ROS launcher specification
22 23 24 |
# File 'lib/orogen/ros/spec/launcher.rb', line 22 def self.optional_attr @optional_attr end |
Instance Method Details
#to_s ⇒ String
String description of this object
59 60 61 62 63 64 65 66 |
# File 'lib/orogen/ros/spec/launcher.rb', line 59 def to_s desc = "NodeDescription: name: #{name}, package: #{package}, type: #{type}" NodeDescription.optional_attr.each do |o,_| val = instance_variable_get("@#{o}") desc += ", #{o}: #{val}" end desc end |