Class: OroGen::TypekitMarshallers::Corba::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/orogen/marshallers/corba.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(typekit) ⇒ Plugin


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/orogen/marshallers/corba.rb', line 6

def initialize(typekit)
    @typekit = typekit

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

Instance Attribute Details

#typekitObject (readonly)

Returns the value of attribute typekit


5
6
7
# File 'lib/orogen/marshallers/corba.rb', line 5

def typekit
  @typekit
end

Class Method Details

.nameObject


18
# File 'lib/orogen/marshallers/corba.rb', line 18

def self.name; "corba" end

Instance Method Details

#dependenciesObject


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/orogen/marshallers/corba.rb', line 21

def dependencies
    result = []
    typekit.used_typekits.each do |tk|
        next if tk.virtual?
        build_dep = Gen::RTT_CPP::BuildDependency.new(
            tk.name.upcase + "_TRANSPORT_CORBA",
            tk.pkg_transport_name('corba'))
        build_dep.in_context('corba', 'include')
        build_dep.in_context('corba', 'link')
        result << build_dep
    end
    typekit.used_libraries.each do |pkg|
        needs_link = typekit.linked_used_libraries.include?(pkg)
        result << Gen::RTT_CPP::BuildDependency.new(pkg.name.upcase, pkg.name).
            in_context('corba', 'include')
        if needs_link
            result.last.in_context('corba', 'link')
        end
    end
    result
end

#generate(typesets) ⇒ Object


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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/orogen/marshallers/corba.rb', line 45

def generate(typesets)
    headers, impl = [], []

    idl_registry = typesets.minimal_registry.dup
    opaques = idl_registry.each.find_all do |t|
        t.contains_opaques?
    end
    opaques.each do |t|
        idl_registry.remove(t)
    end
    idl_registry.clear_aliases
    
    idl = Gen::RTT_CPP.render_template "typekit", "corba", "Types.idl", binding
    idl_file = typekit.save_automatic("transports", "corba",
        "#{typekit.name}Types.idl", idl)

    code  = Gen::RTT_CPP.render_template "typekit", "corba", "Convertions.cpp", binding
    impl << typekit.save_automatic("transports", "corba",
            "Convertions.cpp", code)

    code  = Gen::RTT_CPP.render_template "typekit", "corba", "TransportPlugin.hpp", binding
    headers << typekit.save_automatic("transports", "corba",
            "TransportPlugin.hpp", code)
    code  = Gen::RTT_CPP.render_template "typekit", "corba", "TransportPlugin.cpp", binding
    impl << typekit.save_automatic("transports", "corba",
            "TransportPlugin.cpp", code)

    code_snippets = typesets.interface_types.map do |type|
        target_type = typekit.intermediate_type_for(type)
        code  = Gen::RTT_CPP.render_template "typekit", "corba", "Type.cpp", binding
        [type, code]
    end
    impl += typekit.render_typeinfo_snippets(code_snippets, "transports", "corba")

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

    impl = impl.map do |path|
        typekit.cmake_relative_path(path, "transports", "corba")
    end.sort
    headers = headers.map do |path|
        typekit.cmake_relative_path(path, "transports", "corba")
    end.sort

    pkg_config = Gen::RTT_CPP.render_template "typekit", "corba", "transport-corba.pc", binding
    typekit.save_automatic("transports", "corba", "#{typekit.name}-transport-corba.pc.in", pkg_config)
    code = Gen::RTT_CPP.render_template "typekit", "corba", "CMakeLists.txt", binding
    typekit.save_automatic("transports", "corba", "CMakeLists.txt", code)

    # We generate our own CMake code, no need to export anything to the
    # main typekit code
    return [], []
end

#nameObject


19
# File 'lib/orogen/marshallers/corba.rb', line 19

def name; "corba" end

#separate_cmake?Boolean


43
# File 'lib/orogen/marshallers/corba.rb', line 43

def separate_cmake?; true end