marshalling_types.hpp
Go to the documentation of this file.
00001 /* Generated from orogen/lib/orogen/templates/typekit/marshalling_types.hpp */
00002 
00003 <% namespace = '/'
00004    did_something = false %>
00005 
00006 <% typekit.loads.each do |path| %>
00007 #include "<%= path %>"
00008 <% end %>
00009 <% typekit.local_headers(false).each do |path, dest_path| %>
00010 #include "<%= File.join(typekit.name, dest_path) %>"
00011 <% end %>
00012 <% typekit.used_typekits.each do |tk| %>
00013 <% next if tk.virtual? %>
00014 #include <<%= tk.name %>/Types.hpp>
00015 <% end %>
00016 
00017 <% needed_types.each do |type|
00018     target_typename = typekit.intermediate_type_name_for(type)
00019     current_def = begin
00020                       typekit.find_type(target_typename)
00021                   rescue Typelib::NotFound
00022                   end
00023 
00024     if !generate_all_marshalling_types && current_def
00025         expected_type = type
00026         while current_def.respond_to?(:deference)
00027             current_def = current_def.deference
00028             if !expected_type.respond_to?(:deference)
00029                 raise "#{current_def.name} is already defined, but does not match the expected definition. Did you define it yourself ?"
00030             end
00031             expected_type = expected_type.deference
00032         end
00033 
00034         if current_def < Typelib::CompoundType
00035             if expected_type.opaque?
00036                 # nothing to do
00037             elsif !(expected_type < Typelib::CompoundType)
00038                 raise "#{current_def.name} is already defined, but does not match the expected definition. Did you define it yourself ?"
00039             elsif current_def.fields.size != expected_type.fields.size
00040                 raise "#{current_def.name} is already defined, but does not match the expected definition. Did you define it yourself ?"
00041             else
00042                 type_fields    = expected_type.fields.dup
00043                 current_fields = current_def.fields.dup
00044 
00045                 while !type_fields.empty?
00046                     expected = type_fields.first
00047                     current  = current_fields.first
00048 
00049                     if expected[0] != current[0] ||
00050                         !expected[1].opaque? && expected[1] != current[1]
00051                         raise "#{current_def.name} is already defined, but does not match the expected definition. Did you define it yourself ?"
00052                     elsif expected[1].opaque?
00053                         if typekit.intermediate_type_for(expected[1]) != current[1]
00054                             raise "#{current_def.name} is already defined, but does not match the expected definition. Did you define it yourself ?"
00055                         end
00056                     end
00057 
00058                     type_fields.pop
00059                     current_fields.pop
00060                 end
00061             end
00062         end
00063         next
00064     end %>
00065 
00066     <% target_namespace = Typelib.namespace(target_typename)
00067        target_basename  = Typelib.basename(target_typename)
00068         target_basename.gsub!('/', '::')
00069     did_something = true %>
00070     <%= Generation.adapt_namespace('/', target_namespace) %>
00071     <%= type.to_m_type(target_basename, typekit) %>
00072     <%= Generation.adapt_namespace(target_namespace, '/') %>
00073 <% end %>
00074 
00075 <% if !did_something
00076      throw :nothing_to_define
00077    end %>
00078 


orogen
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:57