$search
00001 /* Generated from orogen/lib/orogen/templates/typekit/OpaqueConvertions.cpp */ 00002 00003 #include "OpaqueConvertions.hpp" 00004 #include <memory> 00005 00006 <% typekit.used_typekits.each do |tk| %> 00007 <% next if tk.virtual? %> 00008 <% next if !tk.has_opaques? %> 00009 #include <<%= tk.name %>/typekit/OpaqueConvertions.hpp> 00010 <% end %> 00011 00012 <% # We first handle the definitions that declare convertions functions 00013 # (i.e. the ones for which we don't need to generate anything) 00014 type_sets.opaque_types. 00015 find_all(&:code_generator). 00016 each do |opdef| 00017 type = opdef.type 00018 target_type = typekit.intermediate_type_for(type) 00019 %> 00020 <%= opdef.code_generator.call(type, target_type) %> 00021 <% end %> 00022 00023 00024 <% 00025 # Generate the body of the const-function for from_intermediate, 00026 # if the type does not need a copy. 00027 # See the Opaques.hpp template for more information 00028 type_sets.opaque_types. 00029 find_all { |opdef| !opdef.needs_copy? }. 00030 each do |opdef| 00031 type = opdef.type 00032 target_type = typekit.intermediate_type_for(type) 00033 %> 00034 void orogen_typekits::fromIntermediate(<%= type.ref_type %> value, <%= target_type.arg_type %> _intermediate) 00035 { 00036 std::auto_ptr< <%= target_type.cxx_name %> > intermediate(new <%= target_type.cxx_name %>(_intermediate)); 00037 <%= typekit.code_fromIntermediate(target_type, false, " ") %> 00038 } 00039 <% 00040 end 00041 %> 00042 00043 <% 00044 # Then create the functions that convert a type that contains 00045 # opaques (but is not opaque itself) into its corresponding _m type 00046 type_sets.types. 00047 find_all { |t| t.contains_opaques? && !t.opaque? }. 00048 each do |type| 00049 m_type = intermediate_type_for(type) %> 00050 void orogen_typekits::toIntermediate(<%= m_type.ref_type %> intermediate, <%= type.arg_type %> value<%= ", int length" if type < Typelib::ArrayType %>) 00051 { 00052 <%= 00053 result = "" 00054 type.to_intermediate(typekit, result, " ") 00055 result %> 00056 } 00057 void orogen_typekits::fromIntermediate(<%= type.ref_type %> value<%= ", int length" if type < Typelib::ArrayType %>, <%= m_type.arg_type %> intermediate) 00058 { 00059 <%= 00060 result = "" 00061 type.from_intermediate(typekit, result, " ") 00062 result %> 00063 } 00064 <% end %> 00065