$search
00001 /* Generated from orogen/lib/orogen/templates/typekit/corba/Type.cpp */ 00002 00003 #include "Types.hpp" 00004 #include "transports/corba/Registration.hpp" 00005 #include "transports/corba/Convertions.hpp" 00006 #include <rtt/transports/corba/CorbaTemplateProtocol.hpp> 00007 00008 namespace RTT 00009 { 00010 namespace corba 00011 { 00012 template<> 00013 struct AnyConversion< <%= type.cxx_name %> > 00014 { 00015 typedef <%= target_type.corba_name %> CorbaType; 00016 typedef <%= type.cxx_name %> BaseType; 00017 00018 static bool update(const CORBA::Any& any, BaseType& tp) 00019 { 00020 <% if type.inlines_code? || type <= Typelib::EnumType %> 00021 CorbaType corba; 00022 if (!(any >>= corba)) 00023 return false; 00024 return orogen_typekits::fromCORBA(tp, corba); 00025 <% else %> 00026 CorbaType* corba; 00027 if (!(any >>= corba)) 00028 return false; 00029 bool ret = orogen_typekits::fromCORBA(tp, *corba); 00030 return ret; 00031 <% end %> 00032 } 00033 00034 static CORBA::Any_ptr createAny( BaseType const& tp ) 00035 { 00036 std::auto_ptr< CORBA::Any > ret( new CORBA::Any() ); 00037 if (!updateAny(tp, *ret)) 00038 return 0; 00039 return ret.release(); 00040 } 00041 00042 static bool updateAny( BaseType const& value, CORBA::Any& any ) 00043 { 00044 <% if type.inlines_code? || type <= Typelib::EnumType %> 00045 CorbaType corba; 00046 if (!orogen_typekits::toCORBA(corba, value)) 00047 return false; 00048 any <<= corba; 00049 <% else %> 00050 std::auto_ptr<CorbaType> corba( new CorbaType ); 00051 if (!orogen_typekits::toCORBA(*corba, value)) 00052 return false; 00053 any <<= corba.release(); 00054 <% end %> 00055 return true; 00056 } 00057 }; 00058 } 00059 } 00060 00061 namespace orogen_typekits { 00062 RTT::corba::CorbaTypeTransporter* <%= type.method_name %>_CorbaTransport() 00063 { 00064 return new RTT::corba::CorbaTemplateProtocol< <%= type.cxx_name %> >(); 00065 } 00066 } 00067