00001 #include "TypelibTransportPlugin.hpp" 00002 #include <typelib/pluginmanager.hh> 00003 #include <rtt/Logger.hpp> 00004 #include <typelib/registry.hh> 00005 00006 #ifdef HAS_ROSLIB 00007 #include <ros/package.h> 00008 #endif 00009 00010 using namespace orogen_transports; 00011 using namespace RTT; 00012 00013 TypelibTransportPlugin::TypelibTransportPlugin(std::string const& basename) 00014 : m_basename(basename), m_registry(0) {} 00015 TypelibTransportPlugin::~TypelibTransportPlugin() 00016 { 00017 delete m_registry; 00018 } 00019 00020 bool TypelibTransportPlugin::loadRegistry() 00021 { 00022 std::string path = getTlbPath(); 00023 try 00024 { 00025 m_registry = Typelib::PluginManager::load("tlb", path); 00026 return true; 00027 } 00028 catch(std::exception const& e) { 00029 log(Error) << "cannot load the typekit's Typelib registry from" << endlog(); 00030 log(Error) << " " << path << endlog(); 00031 #ifndef HAS_ROSLIB 00032 log(Error) << "remember to do 'make install' before you use the oroGen-generated libraries ?" << endlog(); 00033 #endif 00034 log(Error) << endlog(); 00035 log(Error) << "the Typelib transport will not be available for types defined in this typekit" << endlog(); 00036 } 00037 return false; 00038 } 00039 00040 std::string orogen_transports::TypelibTransportPlugin::getTransportName() const 00041 { return "Typelib"; } 00042 std::string orogen_transports::TypelibTransportPlugin::getTypekitName() const 00043 { return "/orogen/" + m_basename; } 00044 std::string orogen_transports::TypelibTransportPlugin::getName() const 00045 { return "/orogen/" + m_basename + "/TYPELIB"; } 00046