class Typelib::EnumType
Public Class Methods
to_stream(typekit, result, indent)
click to toggle source
# File lib/orogen/marshallers/iostream.rb, line 42 def self.to_stream(typekit, result, indent) to_string(typekit, result, indent) result << "#{indent}io << enum_name;\n"; result end
to_string(typekit, result, indent)
click to toggle source
# File lib/orogen/gen/typekit.rb, line 180 def self.to_string(typekit, result, indent) seen_values = Set.new result << indent << "std::string enum_name;\n" result << indent << "switch(value) {\n" keys.each do |name, value| next if seen_values.include?(value) seen_values << value result << "#{indent} case #{namespace('::')}#{name}:\n" result << "#{indent} enum_name = \"#{name}\";\n" result << "#{indent} break;\n" end result << <<-EOT #{indent} default: #{indent} RTT::log(RTT::Error) << "invalid value '" << (int)value << "' for enum '#{cxx_name}'" << RTT::endlog(); #{indent} return false; #{indent}} EOT result end