module OroGen::TypekitMarshallers::ROS::OpaqueTypeExtension

Public Instance Methods

from_ros(typekit, buffer, indent) click to toggle source

Convert a C++ value into the corresponding ROS value The C++ value is called 'value' and is a ref to the C++ type. The ROS value is called 'ros' and is a const-ref.

The method must return the string that will be used for convertion

# File lib/orogen/marshallers/ros.rb, line 535
def from_ros(typekit, buffer, indent)
    needs_copy  = typekit.opaque_specification(self).needs_copy?
    target_type = typekit.intermediate_type_for(self)
    if needs_copy
        buffer <<
            "#{indent}#{target_type.cxx_name} temp;\n" <<
            "#{indent}#{target_type.call_from_ros("temp", "ros")};\n"
            "#{indent}orogen_typekits::fromIntermediate(value, temp);\n"
    else
        buffer <<
            "#{indent}std::auto_ptr< #{target_type.cxx_name} > temp(new #{target_type.cxx_name});\n" <<
            "#{indent}#{target_type.call_from_ros("*temp", "ros")};\n"
            "#{indent}if (orogen_typekits::fromIntermediate(value, temp.get())) temp.release();\n"
    end
end
to_ros(typekit, buffer, indent) click to toggle source

Convert a C++ value into the corresponding ROS value The C++ value is called 'value' and is a const-ref to the C++ type. The ROS value is called 'ros' and is a ref.

The method must return the string that will be used for convertion

# File lib/orogen/marshallers/ros.rb, line 515
def to_ros(typekit, buffer, indent)
    needs_copy  = typekit.opaque_specification(self).needs_copy?
    target_type = typekit.intermediate_type_for(self)
    if needs_copy
        buffer <<
            "#{indent}#{target_type.cxx_name} temp;\n" <<
            "#{indent}orogen_typekits::toIntermediate(temp, value);\n" <<
            "#{indent}#{target_type.call_to_ros("ros", "temp")};\n"
    else
        buffer <<
            "#{indent}#{target_type.arg_type} temp = orogen_typekits::toIntermediate(value);\n" <<
            "#{indent}#{target_type.call_to_ros("ros", "temp")};\n"
    end
end