Class: Orocos::DefaultLoader

Inherits:
OroGen::Loaders::Aggregate
  • Object
show all
Defined in:
lib/orocos/default_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDefaultLoader

Returns a new instance of DefaultLoader.


13
14
15
16
17
18
19
# File 'lib/orocos/default_loader.rb', line 13

def initialize
    @type_export_namespace = ::Types
    # We need recursive access lock
    @load_access_lock = Monitor.new
    super
    self.export_types = true
end

Instance Attribute Details

#type_export_namespaceModule (readonly)

The namespace in which the types should be exported if #export_types? returns true. It defaults to Types

Returns:

  • (Module)

11
12
13
# File 'lib/orocos/default_loader.rb', line 11

def type_export_namespace
  @type_export_namespace
end

Instance Method Details

#clearObject


39
40
41
42
43
44
45
# File 'lib/orocos/default_loader.rb', line 39

def clear
    if export_types? && registry
        type_export_namespace.disable_registry_export
    end
    super
    OroGen::Loaders::RTT.setup_loader(self)
end

#export_types=(flag) ⇒ Object


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/orocos/default_loader.rb', line 21

def export_types=(flag)
    if !export_types? && flag
        registry.export_to_ruby(type_export_namespace) do |type, exported_type|
            if type.name =~ /orogen_typekits/ # just ignore those
            elsif type <= Typelib::NumericType # using numeric is transparent in Typelib/Ruby
            elsif type.contains_opaques? # register the intermediate instead
                intermediate_type_for(type)
            elsif m_type?(type) # just ignore, they are registered as the opaque
            else exported_type
            end
        end
        @export_types = true
    elsif export_types? && !flag
        type_export_namespace.disable_registry_export
        @export_types = false
    end
end

#export_types?Boolean

Returns whether the types that get registered on Orocos.registry should be exported as Ruby constants.

Returns:

  • (Boolean)

    whether the types that get registered on Orocos.registry should be exported as Ruby constants


5
# File 'lib/orocos/default_loader.rb', line 5

attr_predicate :export_types?

#register_project_model(project) ⇒ Object


47
48
49
50
51
52
53
54
# File 'lib/orocos/default_loader.rb', line 47

def register_project_model(project)
    super
    project.self_tasks.each_value do |task|
        task.each_extension do |ext|
            Orocos.load_extension_runtime_library(ext.name)
        end
    end
end

#task_model_from_name(name) ⇒ Object


56
57
58
59
60
# File 'lib/orocos/default_loader.rb', line 56

def task_model_from_name(name)
    @load_access_lock.synchronize do
        super
    end
end