TransportPlugin.cpp
Go to the documentation of this file.
00001 /* Generated from orogen/lib/orogen/templates/typekit/mqueue/TransportPlugin.cpp */
00002 
00003 // First load all RTT interfaces so that we get all "extern template"
00004 // declarations in the TypekitImpl files
00005 #include "transports/mqueue/Registration.hpp"
00006 #include "transports/mqueue/TransportPlugin.hpp"
00007 #include <rtt/transports/mqueue/MQLib.hpp>
00008 #include <rtt/types/TypekitPlugin.hpp>
00009 using namespace RTT;
00010 
00011 #include "transports/typelib/TransportPlugin.hpp"
00012 #include <typelib/pluginmanager.hh>
00013 #include <typelib/registry.hh>
00014 #include <rtt/Logger.hpp>
00015 
00016 orogen_typekits::<%= typekit.name %>MQueueTransportPlugin::<%= typekit.name %>MQueueTransportPlugin()
00017     : m_registry(0)
00018 {
00019     std::string path = <%= typekit.name %>TypelibTransportPlugin::getTypelibRegistryPath();
00020     try
00021     {
00022         m_registry = Typelib::PluginManager::load("tlb", path);
00023     }
00024     catch(std::exception const& e) {
00025         log(Error) << "cannot load the typekit's Typelib registry from" << endlog();
00026         log(Error) << "  " << path << endlog();
00027 #ifndef HAS_ROSLIB
00028         log(Error) << "remember to do 'make install' before you use the oroGen-generated libraries ?" << endlog();
00029 #endif
00030         log(Error) << endlog();
00031         log(Error) << "the MQueue transport will not be available for types defined in this typekit" << endlog();
00032     }
00033 }
00034 
00035 orogen_typekits::<%= typekit.name %>MQueueTransportPlugin::~<%= typekit.name %>MQueueTransportPlugin()
00036 {
00037     delete m_registry;
00038 }
00039 
00040 bool orogen_typekits::<%= typekit.name %>MQueueTransportPlugin::registerTransport(std::string type_name, RTT::types::TypeInfo* ti)
00041 {
00042     if (!m_registry)
00043         return false;
00044 
00045     <% first_type = true;
00046        typesets.interface_types.each do |type|
00047            names = [type.name]
00048            if aliases = typesets.aliases[type]
00049                names.concat(aliases)
00050            end
00051            if_cond = names.map { |n| "\"#{n}\" == type_name" }.join(" || ")
00052         %>
00053     <%= 'else ' unless first_type %>if (<%= if_cond %>)
00054     {
00055         ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID,
00056             <%= type.method_name %>_MQueueTransport(*m_registry));
00057         return true;
00058     }
00059     <% first_type = false
00060     end %>
00061     return false;
00062 }
00063 std::string orogen_typekits::<%= typekit.name %>MQueueTransportPlugin::getTransportName() const
00064 { return "MQueue"; }
00065 std::string orogen_typekits::<%= typekit.name %>MQueueTransportPlugin::getTypekitName() const
00066 { return "/orogen/<%= typekit.name %>"; }
00067 std::string orogen_typekits::<%= typekit.name %>MQueueTransportPlugin::getName() const
00068 { return "/orogen/<%= typekit.name %>/MQueue"; }
00069 
00070 ORO_TYPEKIT_PLUGIN(orogen_typekits::<%= typekit.name %>MQueueTransportPlugin);
00071 


orogen
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:29