Go to the documentation of this file.00001
00002
00003 #include "<%= typekit.name %>/transports/corba/<%= typekit.name %>TypesC.h"
00004 #include <memory>
00005 // for error-messages in enum-converters "toCORBA()" and "fromCORBA()"
00006 #include <rtt/Logger.hpp>
00007
00008 <% if typekit.has_opaques? %>
00009 #include <<%= typekit.name %>/typekit/OpaqueConvertions.hpp>
00010 <% end %>
00011
00012 <%
00013 # First handle the plain types
00014 needed_convertions = (typesets.converted_types | typesets.array_types).
00015 inject(Set.new) do |result, type|
00016 intermediate_type = typekit.intermediate_type_for(type)
00017 result << type << intermediate_type
00018 result | type.direct_dependencies.to_set | intermediate_type.direct_dependencies.to_set
00019 end
00020 needed_convertions.delete_if { |t| t <= Typelib::NumericType }
00021 # Plain types might depend on array types, split the two
00022 needed_array_convertions, needed_convertions = needed_convertions.
00023 partition { |t| t <= Typelib::ArrayType }
00024 # And add the root array types to the result
00025 needed_array_convertions |= typesets.array_types
00026
00027 # We cannot assume that the headers the user provide do include boost/cstdint.hpp
00028 # So, can't assume that all numeric types are already defined
00029 #
00030 # The only place where it matters, though, is when the int type appears in a
00031 # signature, e.g. when it is the element of a container
00032 needed_numeric_types = needed_convertions.map do |t|
00033 if t.respond_to?(:deference) && t.deference <= Typelib::NumericType
00034 t.deference
00035 end
00036 end.compact
00037 %>
00038
00039 <% all_includes = (needed_numeric_types.to_set | typesets.converted_types | typesets.array_types).flat_map do |type| %>
00040 <% typekit.include_for_type(type) %>
00041 <% end %>
00042 <%= typekit.cxx_gen_includes(*all_includes) %>
00043
00044 namespace orogen_typekits {
00045 <% needed_convertions.sort_by(&:name).each do |t| %>
00046 <%= t.to_corba_signature(typekit) %>;
00047 <%= t.from_corba_signature(typekit) %>;
00048 <% end %>
00049 <% needed_array_convertions.sort_by(&:name).each do |t| %>
00050 <%= t.to_corba_array_signature(typekit) %>;
00051 <%= t.from_corba_array_signature(typekit) %>;
00052 <% end %>
00053 }
00054
00055 <% typesets.converted_types.each do |type| %>
00056 <%= type.to_corba_signature(typekit, namespace: "orogen_typekits::") %>
00057 {
00058 <%= result = ""
00059 type.to_corba(typekit, result, " " * 4)
00060 result
00061 %>
00062 return true;
00063 }
00064
00065 <%= type.from_corba_signature(typekit, namespace: "orogen_typekits::") %>
00066 {
00067 <%= result = ""
00068 type.from_corba(typekit, result, " " * 4)
00069 result
00070 %>
00071 return true;
00072 }
00073 <% end %>
00074
00075 <% typesets.array_types.each do |type| %>
00076 <%= type.to_corba_array_signature(typekit, namespace: "orogen_typekits::") %>
00077 {
00078 <%= result = ""
00079 type.to_corba(typekit, result, " " * 4)
00080 result
00081 %>
00082 return true;
00083 }
00084 <%= type.from_corba_array_signature(typekit, namespace: "orogen_typekits::") %>
00085 {
00086 <%= result = ""
00087 type.from_corba(typekit, result, " " * 4)
00088 result
00089 %>
00090 return true;
00091 }
00092 <% end %>
00093