-
Notifications
You must be signed in to change notification settings - Fork 7
/
TypelibTransportPlugin.cpp
46 lines (40 loc) · 1.42 KB
/
TypelibTransportPlugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "TypelibTransportPlugin.hpp"
#include <typelib/pluginmanager.hh>
#include <rtt/Logger.hpp>
#include <typelib/registry.hh>
#ifdef HAS_ROSLIB
#include <ros/package.h>
#endif
using namespace orogen_transports;
using namespace RTT;
TypelibTransportPlugin::TypelibTransportPlugin(std::string const& basename)
: m_basename(basename), m_registry(0) {}
TypelibTransportPlugin::~TypelibTransportPlugin()
{
delete m_registry;
}
bool TypelibTransportPlugin::loadRegistry()
{
std::string path = getTlbPath();
try
{
m_registry = Typelib::PluginManager::load("tlb", path);
return true;
}
catch(std::exception const& e) {
log(Error) << "cannot load the typekit's Typelib registry from" << endlog();
log(Error) << " " << path << endlog();
#ifndef HAS_ROSLIB
log(Error) << "remember to do 'make install' before you use the oroGen-generated libraries ?" << endlog();
#endif
log(Error) << endlog();
log(Error) << "the Typelib transport will not be available for types defined in this typekit" << endlog();
}
return false;
}
std::string orogen_transports::TypelibTransportPlugin::getTransportName() const
{ return "Typelib"; }
std::string orogen_transports::TypelibTransportPlugin::getTypekitName() const
{ return "/orogen/" + m_basename; }
std::string orogen_transports::TypelibTransportPlugin::getName() const
{ return "/orogen/" + m_basename + "/TYPELIB"; }