Module: OroGen
- Includes:
- Gen::RTT_CPP::SelfTest
- Defined in:
- lib/orogen.rb,
lib/orogen/base.rb,
lib/orogen/gen.rb,
lib/orogen/gen/deployment.rb,
lib/orogen/gen/imports.rb,
lib/orogen/gen/project.rb,
lib/orogen/gen/tasks.rb,
lib/orogen/gen/typekit.rb,
lib/orogen/html/task_context.rb,
lib/orogen/html/type.rb,
lib/orogen/marshallers/corba.rb,
lib/orogen/marshallers/mqueue.rb,
lib/orogen/marshallers/ros.rb,
lib/orogen/marshallers/type_info.rb,
lib/orogen/marshallers/typelib.rb,
lib/orogen/spec.rb,
lib/orogen/spec/attribute.rb,
lib/orogen/spec/configuration_object.rb,
lib/orogen/spec/deployment.rb,
lib/orogen/spec/doc.rb,
lib/orogen/spec/dynamic_ports.rb,
lib/orogen/spec/input_port.rb,
lib/orogen/spec/operation.rb,
lib/orogen/spec/output_port.rb,
lib/orogen/spec/port.rb,
lib/orogen/spec/property.rb,
lib/orogen/spec/task_context.rb,
lib/orogen/test.rb,
lib/orogen/version.rb,
lib/orogen/ros.rb,
lib/orogen/loaders.rb,
lib/orogen/plugins.rb,
lib/orogen/gen/base.rb,
lib/orogen/gen/test.rb,
lib/orogen/ros/base.rb,
lib/orogen/exceptions.rb,
lib/orogen/gen/enable.rb,
lib/orogen/ros/loader.rb,
lib/orogen/loaders/rtt.rb,
lib/orogen/loaders/base.rb,
lib/orogen/spec/project.rb,
lib/orogen/spec/typekit.rb,
lib/orogen/gen/templates.rb,
lib/orogen/loaders/files.rb,
lib/orogen/ros/spec/node.rb,
lib/orogen/loaders/project.rb,
lib/orogen/warn_deprecated.rb,
lib/orogen/ros/spec/package.rb,
lib/orogen/loaders/aggregate.rb,
lib/orogen/ros/spec/launcher.rb,
lib/orogen/loaders/pkg_config.rb,
lib/orogen/ros/default_loader.rb,
lib/orogen/check_for_stray_dots.rb,
lib/orogen/ros/spec/input_topic.rb,
lib/orogen/ros/spec/output_topic.rb,
lib/orogen/spec/opaque_definition.rb
Defined Under Namespace
Modules: Gen, HTML, Loaders, ROS, SelfTest, Spec, TypekitMarshallers
Classes: AlreadyRegistered, AmbiguousName, ConfigError, DefinitionTypekitNotFound, DeployedTaskModelNotFound, DeploymentModelNotFound, InternalError, InvalidInterfaceType, LibraryNotFound, NotExportedType, NotFound, NotTypekitType, ProjectNotFound, TaskLibraryNotFound, TaskModelNotFound, TransportNotFound, TypeNotFound, TypekitNotFound
Constant Summary
collapse
- OROGEN_LIB_DIR =
File.expand_path('orogen', File.dirname(__FILE__))
- Generation =
Gen::RTT_CPP
- VERSION =
"1.1"
Gen::RTT_CPP::AUTOMATIC_AREA_NAME, Gen::RTT_CPP::Attribute, Gen::RTT_CPP::ConfigError, Gen::RTT_CPP::ConfigurationObject, Gen::RTT_CPP::DynamicInputPort, Gen::RTT_CPP::DynamicOutputPort, Gen::RTT_CPP::InputPort, Gen::RTT_CPP::Operation, Gen::RTT_CPP::OutputPort, Gen::RTT_CPP::Port, Gen::RTT_CPP::Property, Gen::RTT_CPP::TaskContext
Instance Attribute Summary
#subdir, #working_directory
Class Method Summary
collapse
#build_test_project, #build_typegen, #call_make, #clear_wc, #compile_and_test, #compile_wc, #copy_in_wc, #create_wc, #in_prefix, #in_wc, #install, #logfile, #prefix_directory, #redirect_to_logfile, #setup, #teardown
adapt_namespace, base_dir, clean, cleanup_dir, cmake_pkgconfig_link, cmake_pkgconfig_link_corba, cmake_pkgconfig_link_noncorba, cmake_pkgconfig_require, create_or_update_symlink, default_deployment_name, define_default_deployments=, define_default_deployments_enabled?, enable, extended_states=, extended_states_enabled?, load_template, multiline_string_to_cxx, really_clean, render_template, save_automatic, save_generated, save_public_automatic, save_user, template_path, touch
#generate_activity_setup, #method_missing, #rtt_priority, #rtt_scheduler, #to_deployer_xml
Class Method Details
.beautify_loading_errors(filename) ⇒ Object
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
|
# File 'lib/orogen/base.rb', line 66
def self.beautify_loading_errors(filename)
yield
rescue Exception => e
file_pattern = /#{Regexp.quote(File.basename(filename))}/
if e.backtrace.first =~ file_pattern
if e.kind_of?(NoMethodError) || e.kind_of?(NameError)
e.message =~ /undefined (?:local variable or )?method `([^']+)'/
method_name = $1
raise Generation::ConfigError, "unknown statement '#{method_name}'", e.backtrace
else
raise Generation::ConfigError, e.message, e.backtrace
end
elsif (e.backtrace[1] =~ file_pattern) || e.kind_of?(ArgumentError)
raise Generation::ConfigError, e.message, e.backtrace
end
raise
end
|
.check_for_stray_dots(filename, name, args) ⇒ Object
Check for the case when there is an superfluous dot at the end of a task
statement
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/orogen/check_for_stray_dots.rb', line 4
def self.check_for_stray_dots(filename, name, args)
regexp_expression = "#{name}.*"
args.each do |element|
regexp_expression << "#{element}.*"
end
regexp = Regexp.new(regexp_expression)
File.open(filename) do |file|
begin
line_counter = 0
previous_non_empty_line_number = 0
previous_non_empty_line = nil
while true
line = file.readline
line_counter += 1
if regexp.match(line)
if previous_non_empty_line =~ /\.$/
raise ArgumentError, "stray dot in statement: #{previous_non_empty_line.strip} (line #{previous_non_empty_line_number})"
end
end
if line =~ /.+/
previous_non_empty_line = line
previous_non_empty_line_number = line_counter
end
end
rescue EOFError
end
end
end
|
.each_orogen_plugin_dir ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/orogen/plugins.rb', line 6
def self.each_orogen_plugin_dir
each_orogen_plugin_path do |p|
if File.directory?(p)
yield(p)
end
end
end
|
.each_orogen_plugin_file(type) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/orogen/plugins.rb', line 14
def self.each_orogen_plugin_file(type)
each_orogen_plugin_path do |path|
if File.file?(path)
yield(path)
else
Dir.glob(File.join(path, type, '*.rb')).each do |file|
yield(file)
end
end
end
end
|
.each_orogen_plugin_path(&block) ⇒ Object
2
3
4
|
# File 'lib/orogen/plugins.rb', line 2
def self.each_orogen_plugin_path(&block)
(ENV['OROGEN_PLUGIN_PATH'] || "").split(':').each(&block)
end
|
.load_orogen_plugin(*path) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/orogen/plugins.rb', line 26
def self.load_orogen_plugin(*path)
original_load_path = $LOAD_PATH.dup
each_orogen_plugin_dir do |dir|
$LOAD_PATH << dir
end
path = File.join(*path)
if File.extname(path) != ".rb"
path = "#{path}.rb"
end
each_orogen_plugin_dir do |dir|
path = File.join(dir, path)
if File.file?(path)
info "loading plugin #{path}"
require path
return
end
end
raise ArgumentError, "cannot load plugin #{path}: not found in #{ENV['OROGEN_PLUGIN_PATH']}"
ensure
if original_load_path
$LOAD_PATH.clear
$LOAD_PATH.concat(original_load_path)
end
end
|
.load_orogen_plugins(*type) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/orogen/plugins.rb', line 54
def self.load_orogen_plugins(*type)
original_load_path = $LOAD_PATH.dup
type = File.join(*type)
each_orogen_plugin_dir do |dir|
$LOAD_PATH << dir
end
each_orogen_plugin_file(type) do |file|
info "loading plugin #{file}"
begin
require file
rescue Exception => e
warn "could not load plugin #{file}: #{e.message}"
e.backtrace.each do |line|
warn " #{line}"
end
end
end
ensure
if original_load_path
$LOAD_PATH.clear
$LOAD_PATH.concat(original_load_path)
end
end
|
.orocos_target ⇒ Object
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/orogen/base.rb', line 120
def self.orocos_target
user_target = ENV['OROCOS_TARGET']
if @orocos_target
@orocos_target.dup
elsif user_target && !user_target.empty?
user_target
else
'gnulinux'
end
end
|
.orocos_target=(target) ⇒ Object
115
116
117
|
# File 'lib/orogen/base.rb', line 115
def self.orocos_target=(target)
@orocos_target = target.to_s
end
|
.registry_of(typekit_name) ⇒ Object
Load a separate typelib registry containing the types defined by the given
oroGen project
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/orogen/plugins.rb', line 80
def self.registry_of(typekit_name)
registry = Typelib::Registry.new
typekit_pkg =
Utilrb::PkgConfig.new("#{typekit_name}-typekit-#{Gen::RTT_CPP.orocos_target}")
tlb = typekit_pkg.type_registry
if tlb
registry.import(tlb)
end
registry
end
|
.unqualified_cxx_type(type_name) ⇒ Object
Returns the unqualified version of type_name
108
109
110
111
112
113
|
# File 'lib/orogen/base.rb', line 108
def self.unqualified_cxx_type(type_name)
type_name.
gsub(/(^|[^\w])const($|[^\w])/, '').
gsub(/&/, '').
strip
end
|
.validate_toplevel_type(type) ⇒ Object
101
102
103
104
105
|
# File 'lib/orogen/base.rb', line 101
def self.validate_toplevel_type(type)
if type < Typelib::ArrayType
raise Generation::ConfigError, "array types can be used only in a structure"
end
end
|
.verify_valid_identifier(name) ⇒ Object
92
93
94
95
96
97
98
99
|
# File 'lib/orogen/base.rb', line 92
def self.verify_valid_identifier(name)
name = name.to_s if name.respond_to?(:to_sym)
name = name.to_str
if name !~ /^[a-zA-Z0-9_:][a-zA-Z0-9_:]*$/
raise ArgumentError, "task name '#{name}' invalid: it can contain only alphanumeric characters and '_', and cannot start with a number"
end
name
end
|
.warn_deprecated(method_name, msg) ⇒ Object
2
3
4
|
# File 'lib/orogen/warn_deprecated.rb', line 2
def self.warn_deprecated(method_name, msg)
OroGen.warn "#{method_name} is deprecated: #{msg}"
end
|