181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
# File 'lib/orogen/gen/typekit.rb', line 181
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
|