class OroGen::TypekitMarshallers::TypeInfo::Plugin

Attributes

typekit[R]

Public Class Methods

name() click to toggle source
# File lib/orogen/marshallers/type_info.rb, line 10
def self.name; "type_info" end
new(typekit) click to toggle source
# File lib/orogen/marshallers/type_info.rb, line 14
def initialize(typekit)
    @typekit = typekit

    Typelib::Type          .extend(TypekitMarshallers::TypeInfo::Type)
    Typelib::NumericType   .extend(TypekitMarshallers::TypeInfo::NumericType)
    Typelib::ContainerType .extend(TypekitMarshallers::TypeInfo::ContainerType)
    Typelib::EnumType      .extend(TypekitMarshallers::TypeInfo::EnumType)
    Typelib::CompoundType  .extend(TypekitMarshallers::TypeInfo::CompoundType)
    Typelib::ArrayType     .extend(TypekitMarshallers::TypeInfo::ArrayType)
end

Public Instance Methods

dependencies() click to toggle source
# File lib/orogen/marshallers/type_info.rb, line 25
def dependencies
end
generate(typesets) click to toggle source
# File lib/orogen/marshallers/type_info.rb, line 30
def generate(typesets)
    headers, impl = [], []

    arrays, plain = typesets.registered_types.
        find_all { |t| !t.contains_opaques? }.
        partition { |t| t < Typelib::ArrayType }

    code_snippets = []
    code_snippets += plain.find_all { |t| !t.contains_opaques? }.map do |type|
        c = Gen::RTT_CPP.render_template "typekit", "type_info", "Info.cpp", binding
        [type, c]
    end

    # For arrays, we must define one type info object per element
    # type, not per type
    arrays_of = arrays.inject(Hash.new) do |h, t|
        h[t.deference] = t; h
    end
    code_snippets += arrays_of.values.find_all { |t| !t.contains_opaques? }.map do |type|
        c = Gen::RTT_CPP.render_template "typekit", "type_info", "ArrayInfo.cpp", binding
        [type.deference.name_as_word + "[]", c]
    end

    code_snippets += typesets.registered_types.find_all { |t| t.contains_opaques? }.map do |type|
        needs_copy =
            if type.opaque? then typekit.opaque_specification(type).needs_copy?
            else true
            end

        intermediate_type = typekit.intermediate_type_for(type)
        c  = Gen::RTT_CPP.render_template "typekit", "type_info", "OpaqueInfo.cpp", binding
        [type, c]
    end

    impl += typekit.render_typeinfo_snippets(code_snippets, "type_info")

    code  = Gen::RTT_CPP.render_template "typekit", "type_info", "TypeInfo.hpp", binding
    typekit.save_automatic("type_info",
            "Registration.hpp", code)

    return headers, impl
end
name() click to toggle source
# File lib/orogen/marshallers/type_info.rb, line 11
def name; "type_info" end
separate_cmake?() click to toggle source
# File lib/orogen/marshallers/type_info.rb, line 28
def separate_cmake?; false end