Class: OroGen::TypekitMarshallers::TypeInfo::Plugin
- Inherits:
-
Object
- Object
- OroGen::TypekitMarshallers::TypeInfo::Plugin
- Defined in:
- lib/orogen/marshallers/type_info.rb
Instance Attribute Summary collapse
-
#typekit ⇒ Object
readonly
Returns the value of attribute typekit.
Class Method Summary collapse
Instance Method Summary collapse
- #dependencies ⇒ Object
- #generate(typesets) ⇒ Object
-
#initialize(typekit) ⇒ Plugin
constructor
A new instance of Plugin.
- #name ⇒ Object
- #separate_cmake? ⇒ Boolean
Constructor Details
#initialize(typekit) ⇒ Plugin
Returns a new instance of Plugin
14 15 16 17 18 19 20 21 22 23 |
# 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 |
Instance Attribute Details
#typekit ⇒ Object (readonly)
Returns the value of attribute typekit
13 14 15 |
# File 'lib/orogen/marshallers/type_info.rb', line 13 def typekit @typekit end |
Class Method Details
.name ⇒ Object
10 |
# File 'lib/orogen/marshallers/type_info.rb', line 10 def self.name; "type_info" end |
.rtt_scripting=(value) ⇒ Boolean
6 |
# File 'lib/orogen/marshallers/type_info.rb', line 6 attr_predicate :rtt_scripting?, true |
.rtt_scripting? ⇒ Boolean
6 |
# File 'lib/orogen/marshallers/type_info.rb', line 6 attr_predicate :rtt_scripting?, true |
Instance Method Details
#dependencies ⇒ Object
25 26 |
# File 'lib/orogen/marshallers/type_info.rb', line 25 def dependencies end |
#generate(typesets) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# 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 ⇒ Object
11 |
# File 'lib/orogen/marshallers/type_info.rb', line 11 def name; "type_info" end |
#separate_cmake? ⇒ Boolean
28 |
# File 'lib/orogen/marshallers/type_info.rb', line 28 def separate_cmake?; false end |