Class: OroGen::Gen::RTT_CPP::Deployment
- Inherits:
-
Spec::Deployment
- Object
- Spec::Deployment
- OroGen::Gen::RTT_CPP::Deployment
- Defined in:
- lib/orogen/gen/deployment.rb
Constant Summary
Constants inherited from Spec::Deployment
Spec::Deployment::KNOWN_LOG_LEVELS
Instance Attribute Summary
Attributes inherited from Spec::Deployment
#connections, #name, #peers, #project, #task_activities
Instance Method Summary collapse
- #dependencies ⇒ Object
-
#generate ⇒ Object
Generates the code associated with this deployment setup.
- #task(name, klass) ⇒ Object
- #to_deployer_xml ⇒ Object
- #used_task_libraries ⇒ Object
Methods inherited from Spec::Deployment
#activity_ordered_tasks, #add_default_logger, #add_peers, #connect, #corba_enabled?, #disable_corba, #disable_transport, #do_not_install, #each_task, #enable_corba, #enable_transport, #find_task_by_name, #get_lock_timeout_no_period, #get_lock_timeout_period_factor, #initialize, #initialize_copy, #inspect, #install?, #linux?, #load_type, #lock_timeout_no_period, #lock_timeout_period_factor, #pretty_print, #rtt_transports, #set_master_slave_activity, #to_s, #transports, #used_typekits, #uses_qt?, #xenomai?
Constructor Details
This class inherits a constructor from OroGen::Spec::Deployment
Instance Method Details
#dependencies ⇒ Object
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/orogen/gen/deployment.rb', line 68 def dependencies result = [] result << BuildDependency.new( "OrocosRTT", "orocos-rtt-#{Generation.orocos_target}"). in_context('core', 'include'). in_context('core', 'link') if browse result << BuildDependency.new( "OrocosOCL", "orocos-ocl-#{Generation.orocos_target}"). in_context('core', 'include'). in_context('core', 'link') end if corba_enabled? result << BuildDependency.new( "OrocosCORBA", "orocos-rtt-corba-#{Generation.orocos_target}"). in_context('corba', 'include'). in_context('corba', 'link') end if transports.include? 'ros' result << BuildDependency.new( "ROSLIB", "roslib"). in_context('core', 'include'). in_context('core', 'link') result << BuildDependency.new( "ROSCPP", "roscpp"). in_context('core', 'include'). in_context('core', 'link') end if transports.include? 'typelib' result << BuildDependency.new( "RTT_TYPELIB", "rtt_typelib-#{Generation.orocos_target}"). in_context('core', 'include'). in_context('core', 'link') end used_typekits.each do |tk| next if tk.virtual? result << BuildDependency.new( "#{tk.name}_TYPEKIT", tk.pkg_name). in_context('core', 'include'). in_context('core', 'link') transports.each do |transport_name| result << BuildDependency.new( "#{tk.name}_TRANSPORT_#{transport_name.upcase}", tk.pkg_transport_name(transport_name)). in_context('core', 'include'). in_context('core', 'link') end end project.used_libraries.each do |pkg| result << BuildDependency.new( "#{pkg.name}", "#{pkg.name}"). in_context('core', 'include'). in_context('core', 'link') end used_task_libraries.each do |pkg| next if pkg.name == project.name result << BuildDependency.new( "#{pkg.name}_TASKLIB", "#{pkg.name}-tasks-#{Generation.orocos_target}"). in_context('core', 'include'). in_context('core', 'link') end # Task files could be using headers from external libraries, so add the relevant # directory in our include path project.tasklib_dependencies. find_all { |builddep| builddep.in_context?('core', 'include') }. each do |builddep| builddep = BuildDependency.new(builddep.var_name, builddep.pkg_name) builddep.in_context('core', 'include') result << builddep end result.to_a.sort_by { |dep| dep.var_name } end |
#generate ⇒ Object
Generates the code associated with this deployment setup
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/orogen/gen/deployment.rb', line 200 def generate deployer = self if !corba_enabled? && !@browse OroGen.warn "the deployment #{name} will do nothing. Either generate with --transports=corba or use the 'browse' statement" end main = Generation.render_template 'main.cpp', binding Generation.save_automatic "main-#{name}.cpp", main pkg = if install? Generation.render_template 'deployment.pc', binding else Generation.render_template 'local_deployment.pc', binding end Generation.save_automatic "#{name}.pc.in", pkg cmake = Generation.render_template 'config/Deployment.cmake', binding Generation.save_automatic "config/#{name}Deployment.cmake", cmake end |
#task(name, klass) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/orogen/gen/deployment.rb', line 55 def task(name, klass) name = OroGen.verify_valid_identifier(name) if klass.respond_to?(:to_str) task_context = project.task_model_from_name(klass) else task_context = klass end if task_context.abstract? raise ArgumentError, "cannot create a deployment for #{task_context.name}, as it is abstract" end super(name, task_context) end |
#to_deployer_xml ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/orogen/gen/deployment.rb', line 177 def to_deployer_xml result = [] result << <<-EOHEADER <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "cpf.dtd"> <properties> EOHEADER used_typekits.each do |tk| next if tk.virtual? result << "<simple name=\"Import\" type=\"string\"><value>#{tk.name}</value></simple>" end used_task_libraries.each do |pkg| result << "<simple name=\"Import\" type=\"string\"><value>#{pkg.name}</value></simple>" end task_activities.each do |task| result << task.to_deployer_xml end result << "</properties>" result.join("\n") end |
#used_task_libraries ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/orogen/gen/deployment.rb', line 155 def used_task_libraries task_models = Set.new task_activities.each do |task| task_models |= task.task_model.ancestors.to_set end task_models.delete_if do |task| !task.project.orogen_project? end dependencies = Hash.new task_models.each do |model| if p = dependencies[model.project.name] if p != model.project raise InternalError, "found two Project objects that seem to refer to the same project: #{p.name}" end else dependencies[model.project.name] = model.project end end dependencies.values end |