class Typelib::Type

Public Class Methods

allocate_index() { |last| ... } click to toggle source
# File lib/orogen/gen/typekit.rb, line 109
def self.allocate_index
    index_var_stack.push "i#{index_var_stack.size}"
    yield(index_var_stack.last)
ensure
    index_var_stack.pop
end
arg_type() click to toggle source
# File lib/orogen/gen/typekit.rb, line 93
def self.arg_type; "#{cxx_name} const&" end
code_assign(result, indent, dest, src) click to toggle source
# File lib/orogen/gen/typekit.rb, line 118
def self.code_assign(result, indent, dest, src)
    result << "#{indent}#{dest} = #{src};\n"
end
contains_int64?() click to toggle source
# File lib/orogen/gen/typekit.rb, line 103
def self.contains_int64?
    dependencies.any? { |t| t.contains_int64? }
end
contains_opaques?() click to toggle source
# File lib/orogen/typenames.rb, line 84
def self.contains_opaques?
    if @contains_opaques.nil?
        @contains_opaques = contains?(Typelib::OpaqueType)
    end
    @contains_opaques
end
cxx_basename() click to toggle source
# File lib/orogen/gen/typekit.rb, line 83
def self.cxx_basename
    normalize_cxxname(basename)
end
cxx_name() click to toggle source
# File lib/orogen/gen/typekit.rb, line 80
def self.cxx_name
    normalize_cxxname(name)
end
cxx_namespace() click to toggle source
# File lib/orogen/gen/typekit.rb, line 86
def self.cxx_namespace
    namespace('::')
end
index_var_stack() click to toggle source
# File lib/orogen/gen/typekit.rb, line 108
def self.index_var_stack; @@index_var_stack end
inlines_code?() click to toggle source
# File lib/orogen/gen/typekit.rb, line 116
def self.inlines_code?; false end
method_name(fullname = true) click to toggle source
# File lib/orogen/gen/typekit.rb, line 96
def self.method_name(fullname = true)
    base = if fullname then full_name('_', true)
           else basename('_')
           end
    base.gsub(/[<>\[\], ]/, '_')
end
name_as_word() click to toggle source
# File lib/orogen/gen/typekit.rb, line 89
def self.name_as_word
    cxx_name.gsub(/[^\w+]/, '_')
end
normalize_cxxname(name) click to toggle source
# File lib/orogen/gen/typekit.rb, line 37
def self.normalize_cxxname(name)
    if name =~ /::/
        raise Orocos::Generation::InternalError, "normalize_cxxname called with a C++ type name (#{name})"
    end

    if name =~ /(.*)((?:\[\d+\])+)$/
        name = $1
        suffix = $2
    else
        suffix = ''
    end

    converted = Typelib.split_typename(name).map do |p|
        normalize_cxxname_part(p)
    end
    if converted.size == 1
        "#{converted.first}#{suffix}"
    else
        "::" + converted.join("::") + suffix
    end
end
normalize_cxxname_part(name) click to toggle source
# File lib/orogen/gen/typekit.rb, line 59
def self.normalize_cxxname_part(name)
    name, template_arguments = Typelib::CXX.parse_template(name)

    name = name.gsub('/', '::')
    if name =~ /^::(.*)/
        name = $1
    end

    if !template_arguments.empty?
        template_arguments.map! do |arg|
            if arg !~ /^\d+$/
                normalize_cxxname(arg)
            else arg
            end
        end

        "#{name}< #{template_arguments.join(", ")} >"
    else name
    end
end
normalize_typename(name) click to toggle source
# File lib/orogen/gen/typekit.rb, line 9
def self.normalize_typename(name)
    "/" + Typelib.split_typename(name).map do |part|
        normalize_typename_part(part)
    end.join("/")
end
normalize_typename_part(name) click to toggle source
# File lib/orogen/gen/typekit.rb, line 15
def self.normalize_typename_part(name)
    # Remove all trailing array modifiers first
    if name =~ /(.*)(\[\d+\]+)$/
        name, array_modifiers = $1, $2
    end

    name, template_arguments = Typelib::CXX.parse_template(name)
    template_arguments.map! do |arg|
        arg =
            if arg !~ /^\d+$/ && arg[0, 1] != "/"
                "/#{arg}"
            else arg
            end
    end

    if !template_arguments.empty?
        "#{name}<#{template_arguments.join(",")}>#{array_modifiers}"
    else
        "#{name}#{array_modifiers}"
    end
end
ref_type() click to toggle source
# File lib/orogen/gen/typekit.rb, line 94
def self.ref_type; "#{cxx_name}&" end
to_stream(typekit, result, indent) click to toggle source
# File lib/orogen/marshallers/iostream.rb, line 3
def self.to_stream(typekit, result, indent)
    STDERR.puts "to_ostream not implemented for #{name}"
    result
end