module OroGen::TypekitMarshallers::Corba::EnumType

Public Instance Methods

from_corba(typekit, result, indent) click to toggle source
# File lib/orogen/marshallers/corba.rb, line 345
        def from_corba(typekit, result, indent)
            seen_values = Set.new
            namespace = namespace('::')
            result << indent << "switch(corba) {\n"
            keys.each do |name, value|
                next if seen_values.include?(value)
                seen_values << value

                result << indent << "  case orogen#{namespace}Corba::#{name}:\n"
                result << indent << "    value = #{namespace}#{name};\n"
                result << indent << "    break;\n"
            end
            result << <<-EOT
#{indent}  default:
#{indent}    RTT::log(RTT::Error) << "orogen_typekits::fromCORBA() invalid value '" << (int)corba << "' for enum '#{cxx_name}'" << RTT::endlog();
#{indent}    return false;
EOT
            result << indent << "}\n"
        end
to_corba(typekit, result, indent) click to toggle source
# File lib/orogen/marshallers/corba.rb, line 326
        def to_corba(typekit, result, indent)
            seen_values = Set.new
            namespace = namespace('::')
            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 << "    corba = orogen#{namespace}Corba::#{name};\n"
                result << indent << "    break;\n"
            end
            result << <<-EOT
#{indent}  default:
#{indent}    RTT::log(RTT::Error) << "orogen_typekits::toCORBA() invalid value '" << (int)value << "' for enum '#{cxx_name}'" << RTT::endlog();
#{indent}    return false;
EOT
            result << indent << "}\n"
        end