Type.cpp
Go to the documentation of this file.
00001 /* Generated from orogen/lib/orogen/templates/typekit/corba/Type.cpp */
00002 
00003 #include "<%= typekit.name %>/transports/corba/<%= typekit.name %>TypesC.h"
00004 <%= typekit.cxx_gen_includes(*typekit.include_for_type(type)) %>
00005 #include "transports/corba/Registration.hpp"
00006 #include <rtt/transports/corba/CorbaTemplateProtocol.hpp>
00007 
00008 namespace orogen_typekits
00009 {
00010     <%= type.to_corba_signature(typekit) %>;
00011     <%= type.from_corba_signature(typekit) %>;
00012 }
00013 
00014 namespace RTT
00015 {
00016     namespace corba
00017     {
00018         template<>
00019         struct AnyConversion< <%= type.cxx_name %> >
00020         {
00021             typedef <%= target_type.corba_name %> CorbaType;
00022             typedef <%= type.cxx_name %>   BaseType;
00023 
00024             static bool update(const CORBA::Any& any, BaseType& tp)
00025             {
00026                 <% if type.inlines_code? %>
00027                 CorbaType  corba;
00028                 <%= type.inline_fromAny("any", "corba", " " * 16) %>;
00029                 <%= type.inline_fromCorba("tp", "corba", " " * 16) %>;
00030                 return true;
00031                 <% elsif type <= Typelib::EnumType %>
00032                 CorbaType  corba;
00033                 if (!(any >>= corba))
00034                     return false;
00035                 return orogen_typekits::fromCORBA(tp, corba);
00036                 <% else %>
00037                 CorbaType*  corba;
00038                 if (!(any >>= corba))
00039                     return false;
00040                 return orogen_typekits::fromCORBA(tp, *corba);
00041                 <% end %>
00042             }
00043 
00044             static CORBA::Any_ptr createAny( BaseType const& tp )
00045             {
00046                 std::auto_ptr< CORBA::Any > ret( new CORBA::Any() );
00047                 if (!updateAny(tp, *ret))
00048                     return 0;
00049                 return ret.release();
00050             }
00051 
00052             static bool updateAny( BaseType const& value, CORBA::Any& any )
00053             {
00054                 <% if type.inlines_code? %>
00055                 CorbaType corba;
00056                 <%= type.inline_toCorba("corba", "value", " " * 16) %>;
00057                 <%= type.inline_toAny("any", "corba", " " * 16) %>;
00058                 <% elsif type <= Typelib::EnumType %>
00059                 CorbaType corba;
00060                 if (!orogen_typekits::toCORBA(corba, value))
00061                     return false;
00062                 any <<= corba;
00063                 <% else %>
00064                 std::auto_ptr<CorbaType> corba( new CorbaType );
00065                 if (!orogen_typekits::toCORBA(*corba, value))
00066                     return false;
00067                 any <<= corba.release();
00068                 <% end %>
00069                 return true;
00070             }
00071         };
00072     }
00073 }
00074 
00075 namespace orogen_typekits {
00076     RTT::corba::CorbaTypeTransporter*  <%= type.method_name %>_CorbaTransport()
00077     {
00078         return new RTT::corba::CorbaTemplateProtocol< <%= type.cxx_name %> >();
00079     }
00080 }
00081 


orogen
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Sat Jun 8 2019 19:52:17