Class: OroGen::Gen::RTT_CPP::ImportedProject

Inherits:
Project
  • Object
show all
Defined in:
lib/orogen/gen/imports.rb

Overview

Instances of this class represent a task library loaded in a component, i.e. a set of TaskContext defined externally and imported using #using_task_library.

For the task contexts imported this way, TaskContext#external_definition? returns true.

Constant Summary

Constants inherited from Project

Project::CMAKE_GENERATED_CONFIG

Instance Attribute Summary collapse

Attributes inherited from Project

#deffile, #define_default_deployments, #deployers, #disabled_namespaces, #enabled_transports, #extended_states, #loaded_deployments, #loaded_orogen_projects, #loaded_typekits, #opaque_registry, #opaques, #registry, #self_tasks, #tasks, #typekit_libraries, #used_libraries, #used_task_libraries, #used_typekits

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Project

#additional_plugin_source_dirs, #base_dir, #default_task_superclass, #define_default_deployments?, #define_dummy_types=, #define_dummy_types?, #deployment, #disable_namespace, #enable_extension, #enable_namespace, #enable_transports, #exported_type?, #extended_state_support?, #extended_states?, #external_task_context, #find_deployment_by_name, #find_interface_type, #find_task_context, #find_typekit, #has_deployment?, #has_library?, #has_namespace?, #has_task_context?, #has_task_library?, #has_typekit?, #import_typekit, #imported_type?, #imported_typekits_for, #inspect, #linux?, #load_orogen_deployment, #load_typekit, #max_sizes, #namespace_disabled?, #orocos_target, #orogen_project, #orogen_project=, #orogen_project?, #orogen_project_description, #orogen_typekit_description, #pretty_print, #project, #register_loaded_project, #register_orogen_file, #register_typekit, #resolve_type, #rtt_registry, #simple_deployment, standard_tasks, #static_deployment, #task_model_from_name, #tasklib_dependencies, #tasklib_used_task_libraries, #using_plugin, #using_project, using_rtt_typekit, #validate_max_sizes_spec, #xenomai?

Methods included from OpaqueHandling

#find_opaque_for_intermediate, #intermediate_type?, #intermediate_type_for, #intermediate_type_name_for, #m_type?, #opaque_specification

Constructor Details

#initialize(main_project, pkg = nil) ⇒ ImportedProject

Returns a new instance of ImportedProject



203
204
205
206
207
208
209
210
211
# File 'lib/orogen/gen/imports.rb', line 203

def initialize(main_project, pkg = nil)
    @main_project = main_project
    @pkg = pkg
    super()

    if pkg && main_project && main_project.has_typekit?(name)
        using_typekit pkg.project_name
    end
end

Instance Attribute Details

#main_projectObject (readonly)

The main Project instance that groups all the imported task libraries



181
182
183
# File 'lib/orogen/gen/imports.rb', line 181

def main_project
  @main_project
end

#pkgObject (readonly)

The pkg-config file defining this oroGen project



183
184
185
# File 'lib/orogen/gen/imports.rb', line 183

def pkg
  @pkg
end

Class Method Details

.load(main_project, pkg, file, verbose = true) ⇒ Object

Import in the base component the task library whose orogen specification is included in file



199
200
201
# File 'lib/orogen/gen/imports.rb', line 199

def self.load(main_project, pkg, file, verbose = true)
    new(main_project, pkg).load(file, verbose)
end

Instance Method Details

#eval(*args, &block) ⇒ Object



234
235
236
237
238
# File 'lib/orogen/gen/imports.rb', line 234

def eval(*args, &block)
    result = super
    validate_max_sizes_spec
    result
end

#export_types(*args) ⇒ Object

Simply ignore type export directives



292
# File 'lib/orogen/gen/imports.rb', line 292

def export_types(*args); self end

#find_type(*args) ⇒ Object



246
247
248
249
250
251
252
253
254
255
# File 'lib/orogen/gen/imports.rb', line 246

def find_type(*args)
    # Check first that this project has the requested type
    # definition
    t = super
    # But, then, return the equivalent type from the master project
    if main_project
        main_project.find_type(t.name)
    else t
    end
end

#generateObject

Task library objects represent an import, and as such they cannot be generated. This method raises NotImplementedError

Raises:

  • (NotImplementedError)


323
# File 'lib/orogen/gen/imports.rb', line 323

def generate; raise NotImplementedError end

#generate_build_systemObject

Task library objects represent an import, and as such they cannot be generated. This method raises NotImplementedError

Raises:

  • (NotImplementedError)


326
# File 'lib/orogen/gen/imports.rb', line 326

def generate_build_system; raise NotImplementedError end

#import_types_from(name, *args) ⇒ Object



264
265
266
267
268
269
# File 'lib/orogen/gen/imports.rb', line 264

def import_types_from(name, *args)
    if main_project && main_project.has_typekit?(name)
        using_typekit name
    else typekit
    end
end

#imported?Boolean

Returns:

  • (Boolean)


193
194
195
# File 'lib/orogen/gen/imports.rb', line 193

def imported?
    true
end

#include_dirsObject



213
214
215
216
217
218
# File 'lib/orogen/gen/imports.rb', line 213

def include_dirs
    if pkg
        pkg.include_dirs
    else Set.new
    end
end

#load(*args, &block) ⇒ Object



240
241
242
243
244
# File 'lib/orogen/gen/imports.rb', line 240

def load(*args, &block)
    result = super
    validate_max_sizes_spec
    result
end

#load_orogen_project(name, options = Hash.new) ⇒ Object



220
221
222
223
224
225
# File 'lib/orogen/gen/imports.rb', line 220

def load_orogen_project(name, options = Hash.new)
    if main_project
        main_project.load_orogen_project(name, options)
    else super
    end
end

#load_task_library(name) ⇒ Object



227
228
229
230
231
232
# File 'lib/orogen/gen/imports.rb', line 227

def load_task_library(name)
    if main_project
        main_project.load_task_library(name)
    else super
    end
end

#task_context(name, **options, &block) ⇒ Object

:nodoc:



281
282
283
284
285
286
287
288
289
# File 'lib/orogen/gen/imports.rb', line 281

def task_context(name, **options, &block) # :nodoc:
    task = super
    if !task
        #Task might not be created because it's namespace is disabled
        return
    end
    task.external_definition = true
    task
end

#tasklib_pkgObject



189
190
191
# File 'lib/orogen/gen/imports.rb', line 189

def tasklib_pkg
    @tasklib_pkg ||= Utilrb::PkgConfig.new(tasklib_pkg_name)
end

#tasklib_pkg_nameObject

The pkg-config file for the task library of this oroGen project



185
186
187
# File 'lib/orogen/gen/imports.rb', line 185

def tasklib_pkg_name
    "#{name}-tasks-#{RTT_CPP.orocos_target}"
end

#to_sObject



328
329
330
# File 'lib/orogen/gen/imports.rb', line 328

def to_s
    "#<OroGen::Gen::RTT_CPP::ImportedProject: #{name} on #{main_project.name}>"
end

#type_export_policy(*args) ⇒ Object



293
# File 'lib/orogen/gen/imports.rb', line 293

def type_export_policy(*args); self end

#typekit(create = nil, &block) ⇒ Object

:nodoc:



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/orogen/gen/imports.rb', line 295

def typekit(create = nil, &block) # :nodoc:
    if @typekit.nil? && @has_typekit.nil?
        @has_typekit =
            if main_project && main_project.has_typekit?(name)
                true
            elsif !name
                # This is a workaround about the fucked up reloading
                # of orogen files. The issue at hand is that
                # #typekit is called here and there in Project,
                # while name is not set. if has_typekit was set to
                # false, the typekit would never be loaded again
                nil
            else
                false
            end

        if @has_typekit
            @typekit = using_typekit(name)
        end
    end
    if !@typekit && create
        @typekit = Typekit.new(self)
    end
    @typekit
end

#using_library(*args) ⇒ Object



271
272
# File 'lib/orogen/gen/imports.rb', line 271

def using_library(*args)
end

#using_task_library(name) ⇒ Object



274
275
276
277
278
279
# File 'lib/orogen/gen/imports.rb', line 274

def using_task_library(name)
    if main_project
        super(main_project.using_task_library(name))
    else super
    end
end

#using_typekit(name) ⇒ Object



257
258
259
260
261
262
# File 'lib/orogen/gen/imports.rb', line 257

def using_typekit(name)
    if main_project
        super(main_project.using_typekit(name))
    else super
    end
end