Module: OroGen::TypekitMarshallers::ROS::ArrayTypeExtension

Defined in:
lib/orogen/marshallers/ros.rb

Instance Method Summary collapse

Instance Method Details

#call_from_ros(value_var, ros_var) ⇒ Object



555
556
557
# File 'lib/orogen/marshallers/ros.rb', line 555

def call_from_ros(value_var, ros_var)
    "fromROS(#{value_var}, #{ros_var}, #{length})"
end

#call_to_ros(ros_var, value_var) ⇒ Object



552
553
554
# File 'lib/orogen/marshallers/ros.rb', line 552

def call_to_ros(ros_var, value_var)
    "toROS(#{ros_var}, #{value_var}, #{length})"
end

#from_ros(typekit, buffer, indent) ⇒ Object

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



576
577
578
579
580
# File 'lib/orogen/marshallers/ros.rb', line 576

def from_ros(typekit, buffer, indent)
    buffer <<
        "#{indent}for (size_t idx = 0; idx < length; ++idx)\n" <<
        "#{indent}#{deference.call_from_ros("value[idx]", "ros[idx]")};\n"
end

#to_ros(typekit, buffer, indent) ⇒ Object

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



564
565
566
567
568
569
# File 'lib/orogen/marshallers/ros.rb', line 564

def to_ros(typekit, buffer, indent)
    buffer <<
        "#{indent}ros.resize(#{length});\n" <<
        "#{indent}for (size_t idx = 0; idx < length; ++idx)\n" <<
        "#{indent}#{deference.call_to_ros("ros[idx]", "value[idx]")};\n"
end