From cf6f4880070283ba3323c54ff4192dc349b68fbb Mon Sep 17 00:00:00 2001
From: Peter Soetens <peter@thesourceworks.com>
Date: Wed, 1 Jun 2011 23:05:56 +0200
Subject: [PATCH] rtt-typelib: move out to a separate package

Signed-off-by: Peter Soetens <peter@thesourceworks.com>
---
 Manifest.txt                                       |    9 -
 Rakefile                                           |   21 +--
 lib/orogen/templates/typekit/manifest.xml          |    1 +
 lib/orogen/templates/typekit/mqueue/CMakeLists.txt |    2 +-
 .../templates/typekit/typelib/CMakeLists.txt       |    2 +-
 manifest.xml                                       |    1 +
 rtt-typelib/.gitignore                             |    1 -
 rtt-typelib/CMakeLists.txt                         |   49 ----
 rtt-typelib/MQTypelibMarshaller.cpp                |   51 -----
 rtt-typelib/MQTypelibMarshaller.hpp                |   42 ----
 rtt-typelib/OpaqueTypelibMarshaller.hpp            |  232 --------------------
 rtt-typelib/TypelibMarshaller.hpp                  |   91 --------
 rtt-typelib/TypelibMarshallerBase.cpp              |   82 -------
 rtt-typelib/TypelibMarshallerBase.hpp              |  181 ---------------
 rtt-typelib/TypelibMarshallerHandle.hpp            |   65 ------
 rtt-typelib/rtt-typelib.pc.in                      |   12 -
 16 files changed, 6 insertions(+), 836 deletions(-)
 delete mode 100644 rtt-typelib/.gitignore
 delete mode 100644 rtt-typelib/CMakeLists.txt
 delete mode 100644 rtt-typelib/MQTypelibMarshaller.cpp
 delete mode 100644 rtt-typelib/MQTypelibMarshaller.hpp
 delete mode 100644 rtt-typelib/OpaqueTypelibMarshaller.hpp
 delete mode 100644 rtt-typelib/TypelibMarshaller.hpp
 delete mode 100644 rtt-typelib/TypelibMarshallerBase.cpp
 delete mode 100644 rtt-typelib/TypelibMarshallerBase.hpp
 delete mode 100644 rtt-typelib/TypelibMarshallerHandle.hpp
 delete mode 100644 rtt-typelib/rtt-typelib.pc.in

diff --git a/Manifest.txt b/Manifest.txt
index 910ba40..0cb6972 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -97,15 +97,6 @@ lib/orogen/templates/typekit/typelib/Type.cpp
 lib/orogen/templates/typekit/typelib/transport-typelib.pc
 lib/orogen/test.rb
 lib/orogen/version.rb
-rtt-typelib/CMakeLists.txt
-rtt-typelib/MQTypelibMarshaller.cpp
-rtt-typelib/MQTypelibMarshaller.hpp
-rtt-typelib/OpaqueTypelibMarshaller.hpp
-rtt-typelib/TypelibMarshaller.hpp
-rtt-typelib/TypelibMarshallerBase.cpp
-rtt-typelib/TypelibMarshallerBase.hpp
-rtt-typelib/TypelibMarshallerHandle.hpp
-rtt-typelib/rtt-typelib.pc.in
 test/data/build_regen_library/include/regen_lib.h
 test/data/empty_component.orogen
 test/data/exists
diff --git a/Rakefile b/Rakefile
index aa08d07..9d0f987 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,25 +1,8 @@
 require './lib/orogen/version'
 require 'shellwords'
 
-task :setup, :cmake_args do |t, args|
-    args.with_defaults(:cmake_args => "")
+task :setup
     begin
-        cmake_args = Shellwords.split(args[:cmake_args])
-        if cmake_args.grep(/-DOROCOS_TARGET=/).empty? && ENV['OROCOS_TARGET']
-            cmake_args << "-DOROCOS_TARGET=#{ENV['OROCOS_TARGET']}"
-        end
-
-        FileUtils.mkdir_p File.join('rtt-typelib', 'build')
-        Dir.chdir(File.join('rtt-typelib', 'build')) do
-            puts "running cmake with #{cmake_args.join(" ")}"
-            if !system('cmake', '..', *cmake_args)
-                raise "cannot configure the rtt-typelib's build system"
-            end
-            if !system('make', 'install')
-                raise "cannot build or install the rtt-typelib support library"
-            end
-        end
-
         require 'typelib'
         require 'orogen'
         STDERR.puts "oroGen is ready to use"
@@ -33,7 +16,7 @@ task :setup, :cmake_args do |t, args|
         end
         exit(1)
     end
-end
+
 task :default => :setup
 
 begin
diff --git a/lib/orogen/templates/typekit/manifest.xml b/lib/orogen/templates/typekit/manifest.xml
index e7dbe26..3b965c7 100644
--- a/lib/orogen/templates/typekit/manifest.xml
+++ b/lib/orogen/templates/typekit/manifest.xml
@@ -9,5 +9,6 @@
   <review status="unreviewed" notes=""/>
   <url>http://ros.org/wiki/<%=typekit.name %>-typekit</url>
   <depend package="rtt"/>
+  <depend package="rtt_typelib"/>
 
 </package>
diff --git a/lib/orogen/templates/typekit/mqueue/CMakeLists.txt b/lib/orogen/templates/typekit/mqueue/CMakeLists.txt
index 69e2d64..3742c30 100644
--- a/lib/orogen/templates/typekit/mqueue/CMakeLists.txt
+++ b/lib/orogen/templates/typekit/mqueue/CMakeLists.txt
@@ -3,7 +3,7 @@
 # OrocosRTT_PREFIX has been set by the pkg-config find modules:
 find_package(Orocos-RTT REQUIRED rtt-transport-mqueue HINTS ${OrocosRTT_PREFIX}/lib/cmake/orocos-rtt)
 
-pkg_check_modules(RTT_Typelib REQUIRED rtt-typelib)
+pkg_check_modules(RTT_Typelib REQUIRED rtt_typelib)
 include_directories(${RTT_Typelib_INCLUDE_DIRS})
 link_directories(${RTT_Typelib_LIBRARY_DIRS})
 
diff --git a/lib/orogen/templates/typekit/typelib/CMakeLists.txt b/lib/orogen/templates/typekit/typelib/CMakeLists.txt
index bd2f78b..9569c5d 100644
--- a/lib/orogen/templates/typekit/typelib/CMakeLists.txt
+++ b/lib/orogen/templates/typekit/typelib/CMakeLists.txt
@@ -7,7 +7,7 @@ pkg_check_modules(TYPELIB REQUIRED typelib)
 include_directories(${TYPELIB_INCLUDE_DIRS})
 link_directories(${TYPELIB_LIBRARY_DIRS})
 
-pkg_check_modules(RTT_Typelib REQUIRED rtt-typelib)
+pkg_check_modules(RTT_Typelib REQUIRED rtt_typelib)
 include_directories(${RTT_Typelib_INCLUDE_DIRS})
 link_directories(${RTT_Typelib_LIBRARY_DIRS})
 
diff --git a/manifest.xml b/manifest.xml
index 1967e3e..7aff3c5 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -14,6 +14,7 @@
 
     <depend package="rtt" />
     <depend package="typelib" />
+    <depend package="rtt_typelib" />
     <rosdep name="nokogiri" />
     <rosdep name="hoe" />
     <!--
diff --git a/rtt-typelib/.gitignore b/rtt-typelib/.gitignore
deleted file mode 100644
index 567609b..0000000
--- a/rtt-typelib/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-build/
diff --git a/rtt-typelib/CMakeLists.txt b/rtt-typelib/CMakeLists.txt
deleted file mode 100644
index b8bae10..0000000
--- a/rtt-typelib/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-cmake_minimum_required(VERSION 2.6)
-project(rtt_typelib)
-
-include(FindPkgConfig)
-
-pkg_check_modules(OrocosRTT REQUIRED orocos-rtt-${OROCOS_TARGET})
-include_directories(${OrocosRTT_INCLUDE_DIRS})
-link_directories(${OrocosRTT_LIBRARY_DIRS})
-add_definitions(${OrocosRTT_CFLAGS})
-
-pkg_check_modules(OrocosRTT_MQUEUE orocos-rtt-mqueue-${OROCOS_TARGET})
-if (OrocosRTT_MQUEUE_FOUND)
-    message(STATUS "MQ transport found, MQ typelib marshaller enabled")
-    include_directories(${OrocosRTT_MQUEUE_INCLUDE_DIRS})
-    link_directories(${OrocosRTT_MQUEUE_LIBRARY_DIRS})
-    add_definitions(${OrocosRTT_MQUEUE_CFLAGS})
-    set(mqsupport_sources MQTypelibMarshaller.cpp)
-else()
-    message(STATUS "MQ transport not found, MQ typelib marshaller disabled")
-endif()
-
-pkg_check_modules(Typelib REQUIRED typelib)
-include_directories(${Typelib_INCLUDE_DIRS})
-link_directories(${Typelib_LIBRARY_DIRS})
-add_definitions(${Typelib_CFLAGS})
-
-add_library(rtt-typelib SHARED
-    TypelibMarshallerBase.cpp ${mqsupport_sources})
-
-target_link_libraries(rtt-typelib
-    ${OrocosRTT_LIBRARIES}
-    ${Typelib_LIBRARIES})
-if (OrocosRTT_MQUEUE_FOUND)
-    target_link_libraries(rtt-typelib
-        ${OrocosRTT_MQUEUE_LIBRARIES})
-endif()
-
-install(TARGETS rtt-typelib
-    LIBRARY DESTINATION lib)
-install(FILES TypelibMarshallerBase.hpp TypelibMarshaller.hpp
-    TypelibMarshallerHandle.hpp
-    MQTypelibMarshaller.hpp OpaqueTypelibMarshaller.hpp
-    DESTINATION include/rtt/typelib)
-
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rtt-typelib.pc.in
-    ${CMAKE_CURRENT_BINARY_DIR}/rtt-typelib.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rtt-typelib.pc
-    DESTINATION lib/pkgconfig)
-
diff --git a/rtt-typelib/MQTypelibMarshaller.cpp b/rtt-typelib/MQTypelibMarshaller.cpp
deleted file mode 100644
index 28f0384..0000000
--- a/rtt-typelib/MQTypelibMarshaller.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "TypelibMarshallerBase.hpp"
-#include "MQTypelibMarshaller.hpp"
-
-using namespace orogen_transports;
-
-typedef TypelibMarshallerBase::Handle TypelibHandle;
-
-MQTypelibMarshallerBase::MQTypelibMarshallerBase(orogen_transports::TypelibMarshallerBase* marshaller)
-    : marshaller(marshaller) {}
-
-MQTypelibMarshallerBase::~MQTypelibMarshallerBase()
-{
-    delete marshaller;
-}
-
-void* MQTypelibMarshallerBase::createCookie() const
-{
-    return marshaller->createHandle();
-}
-
-void MQTypelibMarshallerBase::deleteCookie(void* cookie) const
-{
-    marshaller->deleteHandle(static_cast<TypelibHandle*>(cookie));
-}
-
-std::pair<void const*,int> MQTypelibMarshallerBase::fillBlob( RTT::base::DataSourceBase::shared_ptr source, void* blob, int size, void* cookie) const
-{
-    TypelibHandle* handle = static_cast<TypelibHandle*>(cookie);
-    marshaller->setOrocosSample(handle, const_cast<void*>(source->getRawConstPointer()));
-    int marshalled_size = marshaller->marshal(blob, size, handle);
-    if (marshalled_size == 0)
-        return std::make_pair(static_cast<void const*>(0), 0);
-    else
-        return std::make_pair(static_cast<void const*>(blob), marshalled_size);
-}
-
-bool MQTypelibMarshallerBase::updateFromBlob(const void* blob, int size, RTT::base::DataSourceBase::shared_ptr target, void* cookie) const
-{
-    TypelibHandle* handle = static_cast<TypelibHandle*>(cookie);
-    marshaller->setOrocosSample(handle, target->getRawPointer(), false);
-    marshaller->unmarshal(blob, size, handle);
-    return true;
-}
-
-unsigned int MQTypelibMarshallerBase::getSampleSize( RTT::base::DataSourceBase::shared_ptr sample, void* cookie) const
-{
-    TypelibHandle* handle = static_cast<TypelibHandle*>(cookie);
-    marshaller->setOrocosSample(handle, const_cast<void*>(sample->getRawConstPointer()));
-    return marshaller->getMarshallingSize(handle);
-}
-
diff --git a/rtt-typelib/MQTypelibMarshaller.hpp b/rtt-typelib/MQTypelibMarshaller.hpp
deleted file mode 100644
index 5c9c4ef..0000000
--- a/rtt-typelib/MQTypelibMarshaller.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef OROGEN_MQ_TYPELIB_MARSHALLER_HPP
-#define OROGEN_MQ_TYPELIB_MARSHALLER_HPP
-
-#include <rtt/transports/mqueue/MQTemplateProtocol.hpp>
-
-namespace orogen_transports {
-    class TypelibMarshallerBase;
-
-    class MQTypelibMarshallerBase
-    {
-        orogen_transports::TypelibMarshallerBase* marshaller;
-
-    public:
-        MQTypelibMarshallerBase(orogen_transports::TypelibMarshallerBase* marshaller);
-        virtual ~MQTypelibMarshallerBase();
-        void* createCookie() const;
-        void deleteCookie(void* cookie) const;
-        std::pair<void const*,int> fillBlob( RTT::base::DataSourceBase::shared_ptr source, void* blob, int size, void* cookie) const;
-        bool updateFromBlob(const void* blob, int size, RTT::base::DataSourceBase::shared_ptr target, void* cookie) const;
-        unsigned int getSampleSize( RTT::base::DataSourceBase::shared_ptr sample, void* cookie) const;
-    };
-
-    template<typename T>
-    class MQTypelibMarshaller : public RTT::mqueue::MQTemplateProtocol<T>, public MQTypelibMarshallerBase {
-    public:
-        MQTypelibMarshaller(orogen_transports::TypelibMarshallerBase* marshaller)
-            : MQTypelibMarshallerBase(marshaller) {}
-
-        void* createCookie() const
-        { return MQTypelibMarshallerBase::createCookie(); }
-        void deleteCookie(void* cookie) const
-        { return MQTypelibMarshallerBase::deleteCookie(cookie); }
-        std::pair<void const*,int> fillBlob( RTT::base::DataSourceBase::shared_ptr source, void* blob, int size, void* cookie) const
-        { return MQTypelibMarshallerBase::fillBlob(source, blob, size, cookie); }
-        bool updateFromBlob(const void* blob, int size, RTT::base::DataSourceBase::shared_ptr target, void* cookie) const
-        { return MQTypelibMarshallerBase::updateFromBlob(blob, size, target, cookie); }
-        unsigned int getSampleSize( RTT::base::DataSourceBase::shared_ptr sample, void* cookie) const
-        { return MQTypelibMarshallerBase::getSampleSize(sample, cookie); }
-    };
-}
-
-#endif
diff --git a/rtt-typelib/OpaqueTypelibMarshaller.hpp b/rtt-typelib/OpaqueTypelibMarshaller.hpp
deleted file mode 100644
index 09e3749..0000000
--- a/rtt-typelib/OpaqueTypelibMarshaller.hpp
+++ /dev/null
@@ -1,232 +0,0 @@
-#ifndef OPAQUE_TYPELIB_MARRSHALLER_HPP
-#define OPAQUE_TYPELIB_MARRSHALLER_HPP
-
-#include <rtt/typelib/TypelibMarshallerBase.hpp>
-#include <rtt/typelib/TypelibMarshallerHandle.hpp>
-#include <rtt/internal/DataSources.hpp>
-
-namespace orogen_transports {
-
-template<typename TypelibType, typename OpaqueType>
-struct OpaqueTypelibMarshallerBase : public orogen_transports::TypelibMarshallerBase
-{
-    typedef orogen_transports::TypelibMarshallerBase::Handle MarshallingHandle;
-    typedef OpaqueType  opaque_t;
-    typedef TypelibType typelib_t;
-
-    OpaqueTypelibMarshallerBase(std::string const& typelib_name, std::string const& opaque_name, Typelib::Registry const& registry)
-        : orogen_transports::TypelibMarshallerBase(false, typelib_name, opaque_name, registry) { }
-
-    RTT::base::DataSourceBase::shared_ptr getDataSource(Handle* handle)
-    {
-        ensureOrocosSamplePresent(handle);
-        return new RTT::internal::ReferenceDataSource< opaque_t >(*reinterpret_cast< opaque_t* >(handle->orocos_sample));
-    }
-
-    void deleteOrocosSample(MarshallingHandle* data)
-    { delete reinterpret_cast<opaque_t*>(data->orocos_sample); }
-    void deleteTypelibSample(MarshallingHandle* data)
-    { delete reinterpret_cast<typelib_t*>(data->typelib_sample); }
-
-    uint8_t* releaseOrocosSample(Handle* handle)
-    {
-        if (!handle->orocos_sample)
-            return 0;
-
-        if (handle->owns_orocos)
-        {
-            return reinterpret_cast<uint8_t*>(new opaque_t(*reinterpret_cast<opaque_t*>(handle->orocos_sample)));
-        }
-        else
-        {
-            handle->owns_orocos = false;
-            uint8_t* result = handle->orocos_sample;
-            handle->orocos_sample = 0;
-            return result;
-        }
-    }
-
-    void ensureOrocosSamplePresent(MarshallingHandle* handle)
-    {
-        if (!handle->orocos_sample)
-        {
-            handle->orocos_sample = reinterpret_cast<uint8_t*>(new opaque_t);
-            handle->owns_orocos  = true;
-        }
-    }
-
-    void ensureTypelibSamplePresent(MarshallingHandle* handle)
-    {
-        if (!handle->typelib_sample)
-        {
-            handle->typelib_sample = reinterpret_cast<uint8_t*>(new typelib_t);
-            handle->owns_typelib  = true;
-        }
-    }
-
-    void setOrocosSample(MarshallingHandle* handle, void* data, bool refresh_typelib = true)
-    {
-        if (handle->owns_orocos)
-            deleteOrocosSample(handle);
-        handle->orocos_sample = reinterpret_cast<uint8_t*>(data);
-        handle->owns_orocos = false;
-
-        if (refresh_typelib)
-            refreshTypelibSample(handle);
-    }
-
-    bool readDataSource(RTT::base::DataSourceBase& source_base, MarshallingHandle* handle)
-    {
-        RTT::internal::DataSource<opaque_t>& source = dynamic_cast<RTT::internal::DataSource<opaque_t>&>(source_base);
-        if (source.evaluate())
-        {
-            ensureOrocosSamplePresent(handle);
-            opaque_t& opaque_sample =
-                *reinterpret_cast<opaque_t*>(handle->orocos_sample);
-            opaque_sample = source.value();
-            refreshTypelibSample(handle);
-            return true;
-        }
-        return false;
-    }
-    void writeDataSource(RTT::base::DataSourceBase& source, MarshallingHandle const* handle)
-    {
-        opaque_t const& data = *reinterpret_cast<opaque_t const*>(handle->orocos_sample);
-        dynamic_cast<RTT::internal::AssignableDataSource<opaque_t>&>(source).set(data);
-    }
-
-    void unmarshal(void const* buffer, int size, Handle* handle)
-    {
-        ensureTypelibSamplePresent(handle);
-        TypelibMarshallerBase::unmarshal(buffer, size, handle);
-        refreshOrocosSample(handle);
-    }
-
-    void unmarshal(std::vector<uint8_t>& buffer, Handle* handle)
-    {
-        ensureTypelibSamplePresent(handle);
-        TypelibMarshallerBase::unmarshal(buffer, handle);
-        refreshOrocosSample(handle);
-    }
-};
-
-template<typename TypelibType, typename OpaqueType, int needs_copy>
-class OpaqueTypelibMarshaller;
-
-template<typename TypelibType, typename OpaqueType>
-struct OpaqueTypelibMarshaller<TypelibType, OpaqueType, 0> : public OpaqueTypelibMarshallerBase<TypelibType, OpaqueType>
-{
-    typedef orogen_transports::TypelibMarshallerBase::Handle MarshallingHandle;
-    typedef OpaqueType  opaque_t;
-    typedef TypelibType typelib_t;
-
-    OpaqueTypelibMarshaller(std::string const& typelib_name, std::string const& opaque_name, Typelib::Registry const& registry)
-        : OpaqueTypelibMarshallerBase<TypelibType, OpaqueType>(typelib_name, opaque_name, registry) {}
-
-    MarshallingHandle* createSample()
-    {
-        return new MarshallingHandle(this, (typelib_t*)0, new opaque_t);
-    }
-
-    void refreshTypelibSample(MarshallingHandle* handle)
-    {
-        this->ensureOrocosSamplePresent(handle);
-        opaque_t& opaque_sample =
-            *reinterpret_cast<opaque_t*>(handle->orocos_sample);
-
-        if (handle->typelib_sample && handle->owns_typelib)
-            this->deleteTypelibSample(handle);
-
-        handle->typelib_sample = const_cast<uint8_t*>(
-                reinterpret_cast<uint8_t const*>(
-                    &orogen_typekits::toIntermediate(opaque_sample) ));
-        handle->owns_typelib = false;
-    }
-
-    void refreshOrocosSample(MarshallingHandle* handle)
-    { 
-        this->ensureOrocosSamplePresent(handle);
-
-        opaque_t& opaque_sample =
-            *reinterpret_cast<opaque_t*>(handle->orocos_sample);
-        typelib_t& typelib_sample =
-            *reinterpret_cast<typelib_t*>(handle->typelib_sample);
-        handle->owns_typelib =
-            !orogen_typekits::fromIntermediate(opaque_sample, &typelib_sample);
-    }
-
-    void setTypelibSample(MarshallingHandle* handle, uint8_t* typelib_data, bool refresh_orocos = true)
-    {
-        // The orocos sample might take ownership of the typelib sample
-        // To avoid too complicated ownership logic for the users of this class,
-        // we do a copy first.
-        if (!handle->typelib_sample || !handle->owns_typelib)
-        {
-            handle->typelib_sample = reinterpret_cast<uint8_t*>(new typelib_t);
-            handle->owns_typelib = true;
-        }
-        typelib_t& new_value =
-            *reinterpret_cast<typelib_t*>(typelib_data);
-        typelib_t& intermediate_sample =
-            *reinterpret_cast<typelib_t*>(handle->typelib_sample);
-        intermediate_sample = new_value;
-
-        if (refresh_orocos)
-            refreshOrocosSample(handle);
-    }
-};
-
-template<typename TypelibType, typename OpaqueType>
-struct OpaqueTypelibMarshaller<TypelibType, OpaqueType, 1> : public OpaqueTypelibMarshallerBase<TypelibType, OpaqueType>
-{
-    typedef orogen_transports::TypelibMarshallerBase::Handle MarshallingHandle;
-    typedef OpaqueType  opaque_t;
-    typedef TypelibType typelib_t;
-
-    OpaqueTypelibMarshaller(std::string const& typelib_name, std::string const& opaque_name, Typelib::Registry const& registry)
-        : OpaqueTypelibMarshallerBase<TypelibType, OpaqueType>(typelib_name, opaque_name, registry) {}
-
-    MarshallingHandle* createSample()
-    {
-        return new MarshallingHandle(this, new typelib_t, new opaque_t);
-    }
-
-    void refreshTypelibSample(MarshallingHandle* handle)
-    {
-        this->ensureOrocosSamplePresent(handle);
-        opaque_t& opaque_sample =
-            *reinterpret_cast<opaque_t*>(handle->orocos_sample);
-
-        this->ensureTypelibSamplePresent(handle);
-        typelib_t& intermediate_sample =
-            *reinterpret_cast<typelib_t*>(handle->typelib_sample);
-        orogen_typekits::toIntermediate(intermediate_sample, opaque_sample);
-    }
-
-    void refreshOrocosSample(MarshallingHandle* handle)
-    { 
-        this->ensureOrocosSamplePresent(handle);
-
-        opaque_t& opaque_sample =
-            *reinterpret_cast<opaque_t*>(handle->orocos_sample);
-        typelib_t& typelib_sample =
-            *reinterpret_cast<typelib_t*>(handle->typelib_sample);
-        orogen_typekits::fromIntermediate(opaque_sample, typelib_sample);
-    }
-
-    void setTypelibSample(MarshallingHandle* handle, uint8_t* typelib_data, bool refresh_orocos = true)
-    {
-        if (handle->owns_typelib)
-            this->deleteTypelibSample(handle);
-        handle->typelib_sample = typelib_data;
-        handle->owns_typelib   = false;
-
-        if (refresh_orocos)
-            refreshOrocosSample(handle);
-    }
-};
-
-}
-
-#endif
-
diff --git a/rtt-typelib/TypelibMarshaller.hpp b/rtt-typelib/TypelibMarshaller.hpp
deleted file mode 100644
index 922b114..0000000
--- a/rtt-typelib/TypelibMarshaller.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef OROGEN_TYPELIB_MARSHALLER_HPP
-#define OROGEN_TYPELIB_MARSHALLER_HPP
-
-#include <rtt/typelib/TypelibMarshallerBase.hpp>
-#include <rtt/typelib/TypelibMarshallerHandle.hpp>
-#include <rtt/internal/DataSources.hpp>
-
-namespace orogen_transports
-{
-    template<typename T>
-    struct TypelibMarshaller : public orogen_transports::TypelibMarshallerBase
-    {
-        typedef TypelibMarshallerBase::Handle Handle;
-
-        TypelibMarshaller(std::string const& orocos_name, Typelib::Registry const& registry)
-            : orogen_transports::TypelibMarshallerBase(true, orocos_name, orocos_name, registry) { }
-
-        TypelibMarshallerBase::Handle* createSample() { return new Handle(this, new T); }
-        void deleteOrocosSample(Handle* data)  { deleteSamples(data); }
-        void deleteTypelibSample(Handle* data) { deleteSamples(data); }
-        void deleteSamples(Handle* data)
-        {
-            delete reinterpret_cast<T*>(data->orocos_sample);
-            data->reset();
-        }
-
-        void setTypelibSample(Handle* handle, uint8_t* data, bool refresh_orocos = true)
-        {
-            handle->orocos_sample = handle->typelib_sample = reinterpret_cast<uint8_t*>(data);
-            handle->owns_orocos = handle->owns_typelib = false;
-        }
-
-        void setOrocosSample(Handle* handle, void* data, bool refresh_typelib = true)
-        {
-            handle->orocos_sample = handle->typelib_sample = reinterpret_cast<uint8_t*>(data);
-            handle->owns_orocos = handle->owns_typelib = false;
-        }
-
-        uint8_t* releaseOrocosSample(Handle* handle)
-        {
-            if (!handle->orocos_sample)
-                return 0;
-
-            if (handle->owns_orocos)
-            {
-                return reinterpret_cast<uint8_t*>(new T(*reinterpret_cast<T*>(handle->orocos_sample)));
-            }
-            else
-            {
-                handle->owns_orocos = false;
-                handle->owns_typelib = false;
-                return handle->orocos_sample;
-            }
-        }
-
-        void refreshTypelibSample(Handle* handle)
-        {
-            // Nothing to do
-        }
-
-        void refreshOrocosSample(Handle* handle)
-        {
-            // Nothing to do
-        }
-
-        RTT::base::DataSourceBase::shared_ptr getDataSource(Handle* handle)
-        {
-            return new RTT::internal::ReferenceDataSource<T>(*reinterpret_cast<T*>(handle->orocos_sample));
-        }
-
-        bool readDataSource(RTT::base::DataSourceBase& source_base, Handle* handle)
-        {
-            RTT::internal::DataSource<T>& source = dynamic_cast<RTT::internal::DataSource<T>&>(source_base);
-            if (source.evaluate())
-            {
-                T& data = *reinterpret_cast<T*>(handle->orocos_sample);
-                data = dynamic_cast<RTT::internal::DataSource<T>&>(source_base).get();
-                return true;
-            }
-            return false;
-        }
-        void writeDataSource(RTT::base::DataSourceBase& source, Handle const* handle)
-        {
-            T const& data = *reinterpret_cast<T const*>(handle->orocos_sample);
-            dynamic_cast<RTT::internal::AssignableDataSource<T>&>(source).set(data);
-        }
-    };
-}
-
-#endif
-
diff --git a/rtt-typelib/TypelibMarshallerBase.cpp b/rtt-typelib/TypelibMarshallerBase.cpp
deleted file mode 100644
index c7fc643..0000000
--- a/rtt-typelib/TypelibMarshallerBase.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "TypelibMarshallerBase.hpp"
-#include "TypelibMarshallerHandle.hpp"
-
-#include <rtt/types/TypeInfoRepository.hpp>
-
-using namespace orogen_transports;
-
-typedef TypelibMarshallerBase::Handle Handle;
-
-TypelibMarshallerBase::TypelibMarshallerBase(bool plain,
-        std::string const& typelib_typename,
-        std::string const& orocos_typename,
-        Typelib::Registry const& registry)
-    : m_plain(plain)
-    , type_def(registry.get(typelib_typename))
-    , m_typename_typelib(typelib_typename)
-    , m_typename_orocos(orocos_typename)
-{
-    if (!type_def)
-        throw std::runtime_error(typelib_typename + " is not present in the typekit registry");
-
-    layout    = Typelib::layout_of(*type_def, false, false);
-}
-
-bool TypelibMarshallerBase::isPlainTypelibType() const
-{ return m_plain; }
-
-Handle* TypelibMarshallerBase::createHandle() { return new Handle(this); }
-void TypelibMarshallerBase::deleteHandle(Handle* handle) { delete handle; }
-uint8_t* TypelibMarshallerBase::getTypelibSample(Handle* handle)
-{
-    return handle->typelib_sample;
-}
-char const* TypelibMarshallerBase::getMarshallingType() const
-{ return m_typename_typelib.c_str(); }
-size_t TypelibMarshallerBase::getMarshallingSize(Handle const* handle) const
-{ return Typelib::getDumpSize(handle->typelib_sample, layout); }
-void TypelibMarshallerBase::marshal(int fd, Handle* handle)
-{ Typelib::dump(handle->typelib_sample, fd, layout); }
-void TypelibMarshallerBase::marshal(std::ostream& stream, Handle* handle)
-{ Typelib::dump(handle->typelib_sample, stream, layout); }
-void TypelibMarshallerBase::marshal(std::vector<uint8_t>& buffer, Handle* handle)
-{ Typelib::dump(handle->typelib_sample, buffer, layout); }
-int TypelibMarshallerBase::marshal(void* buffer, int buffer_size, Handle* handle)
-{ return Typelib::dump(handle->typelib_sample, static_cast<uint8_t*>(buffer), buffer_size, layout); }
-void TypelibMarshallerBase::unmarshal(void const* buffer, int buffer_size, Handle* handle)
-{
-    Typelib::load(handle->typelib_sample, *type_def, static_cast<uint8_t const*>(buffer), buffer_size, layout);
-    refreshOrocosSample(handle);
-}
-void TypelibMarshallerBase::unmarshal(std::vector<uint8_t>& buffer, Handle* handle)
-{
-    Typelib::load(handle->typelib_sample, *type_def, buffer, layout);
-    refreshOrocosSample(handle);
-}
-void TypelibMarshallerBase::setTypelibSample(Handle* data, Typelib::Value typelib_data, bool refresh_orocos)
-{ return setTypelibSample(data, reinterpret_cast<uint8_t*>(typelib_data.getData()), refresh_orocos); }
-
-void* orogen_transports::getOpaqueValue(std::string const& expected_type, Typelib::Value value)
-{
-    RTT::types::TypeInfoRepository::shared_ptr type_registry =
-        RTT::types::TypeInfoRepository::Instance();
-    RTT::types::TypeInfo* ti = type_registry->type(expected_type);
-    if (!ti)
-        throw std::runtime_error("type " + expected_type + " is not registered in the RTT type system");
-
-    if (!ti->hasProtocol(orogen_transports::TYPELIB_MARSHALLER_ID))
-        throw std::runtime_error("type " + expected_type + " is registered in the RTT type system, but does not have a typelib transport");
-
-    orogen_transports::TypelibMarshallerBase* typelib_marshaller =
-        dynamic_cast<orogen_transports::TypelibMarshallerBase*>(ti->getProtocol(orogen_transports::TYPELIB_MARSHALLER_ID));
-    if (!typelib_marshaller)
-        throw std::runtime_error("the transport object registered as typelib transport for type " + expected_type + " is not a TypelibMarshallerBase");
-
-    orogen_transports::TypelibMarshallerBase::Handle* handle =
-        typelib_marshaller->createHandle();
-    typelib_marshaller->setTypelibSample(handle, reinterpret_cast<uint8_t*>(value.getData()), true);
-    void* opaque_sample = typelib_marshaller->releaseOrocosSample(handle);
-    typelib_marshaller->deleteHandle(handle);
-    return opaque_sample;
-}
-
diff --git a/rtt-typelib/TypelibMarshallerBase.hpp b/rtt-typelib/TypelibMarshallerBase.hpp
deleted file mode 100644
index 7dae9ba..0000000
--- a/rtt-typelib/TypelibMarshallerBase.hpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Generated from orogen/lib/orogen/templates/typekit/typelib/TypelibMarshallerBase.hpp */
-
-#ifndef OROGEN_TYPELIB_MARSHALLER_BASE_HPP
-#define OROGEN_TYPELIB_MARSHALLER_BASE_HPP
-
-#include <rtt/types/TypeTransporter.hpp>
-#include <typelib/value_ops.hh>
-
-namespace orogen_transports
-{
-    static const int TYPELIB_MARSHALLER_ID = 42;
-
-    class TypelibMarshallerBase : public RTT::types::TypeTransporter
-    {
-        bool m_plain;
-        Typelib::Type const*  type_def;
-        Typelib::MemoryLayout layout;
-        std::string m_typename_typelib;
-        std::string m_typename_orocos;
-
-    public:
-        struct Handle;
-
-        TypelibMarshallerBase(bool plain_type,
-                std::string const& typelib_typename,
-                std::string const& orocos_typename,
-                Typelib::Registry const& registry);
-
-        /** Returns true if the underlying orocos type can be manipulated by
-         * typelib directly and false otherwise
-         */
-        bool isPlainTypelibType() const;
-
-        /** Returns the Typelib-friendly type name for this marshaller. I.e. the
-         * type name for the pointer returned by getTypelibData.
-         *
-         * I.e. if the type is opaque, it is the name of the intermediate type.
-         * Otherwise, it is the type name itself.
-         */
-        char const* getMarshallingType() const;
-
-        /** \overload
-         */
-        void setTypelibSample(Handle* data, Typelib::Value typelib_data, bool refresh_orocos = true);
-
-        /** Updates the sample handler by using a data sample that Typelib
-         * understands. +typelib_data+ must be pointing to an object whose type
-         * is the one returned by getMarshallingType.
-         *
-         * The handle will then point directly to the given data sample, i.e.
-         * calls to \c read might modify that sample directly.
-         *
-         * The ownership of \c typelib_data is retained by the caller. I.e. it
-         * has to delete it.
-         */
-        virtual void setTypelibSample(Handle* data, uint8_t* typelib_data, bool refresh_orocos = true) = 0;
-
-        /** Updates the sample handler by using a data sample that Typelib
-         * understands. +typelib_data+ must be pointing to an object whose type
-         * is the one returned by getMarshallingType.
-         *
-         * The handle will then point directly to the given data sample, i.e.
-         * calls to \c read might modify that sample directly.
-         *
-         * The ownership of \c typelib_data is retained by the caller. I.e. it
-         * has to delete it.
-         */
-        virtual void setOrocosSample(Handle* data, void* sample, bool refresh_typelib = true) = 0;
-
-        /** Updates the value of data->orocos_sample based on the data in
-         * data->typelib_sample
-         */
-        virtual void refreshOrocosSample(Handle* data) = 0;
-
-        /** Updates the value of data->typelib_sample based on the data in
-         * data->orocos_sample
-         */
-        virtual void refreshTypelibSample(Handle* handle) = 0;
-
-        /** Returns a type-pruned pointer to an object that Typelib understands.
-         * This object is of the type returned by getMarshallingType
-         */
-        uint8_t* getTypelibSample(Handle* sample);
-
-        /** Returns a type-pruned pointer to the C++ object, and passes
-         * ownership along
-         */
-        virtual uint8_t* releaseOrocosSample(Handle* sample) = 0;
-
-        /** Creates a sample handler, which is an opaque type used to
-         * read/write/marshal data. Unlike createHandle(), the handle returned
-         * by this method already contains a preallocated data sample. It can
-         * therefore be used as-is for readPort.
-         */
-        virtual Handle* createSample() = 0;
-
-        /** Creates a sample handler, which is an opaque type used to
-         * read/write/marshal data. Unlike createSample(), the handle returned
-         * by this method does not contain any preallocated data sample. Using
-         * it in readPort will cause memory allocation.
-         */
-        Handle* createHandle();
-
-        /** Destroys the orocos-related data sample that is stored in \c data.
-         *
-         * For non-opaque types, this is the same than destroyOrocosSample and
-         * destroyData. It is different only for opaque types.
-         */
-        virtual void deleteOrocosSample(Handle* data) = 0;
-
-        /** Destroys the typelib-related data sample that is stored in \c data.
-         *
-         * For non-opaque types, this is the same than destroyTypelibSample and
-         * destroyData. It is different only for opaque types.
-         */
-        virtual void deleteTypelibSample(Handle* data) = 0;
-
-        /** Destroys the sample handle and the data it owns.
-         *
-         * What is actually deleted depends on how the handle has been used. For
-         * instance, if setTypelibSample has been used, then the sample will not
-         * be deleted.
-         */
-        void deleteHandle(Handle* data);
-
-        /** Returns a data source that can be used to modify the Orocos sample
-         * stored in this handle
-         */
-        virtual RTT::base::DataSourceBase::shared_ptr getDataSource(Handle* handle) = 0;
-
-        /** Writes the data from from the handle into the data source
-         */
-        virtual void writeDataSource(RTT::base::DataSourceBase& source, Handle const* handle) = 0;
-
-        /** Reads the data from a data source a handle
-         */
-        virtual bool readDataSource(RTT::base::DataSourceBase& source, Handle* handle) = 0;
-
-        /** Returns the marshalled size for the given data sample
-         */
-        size_t getMarshallingSize(Handle const* sample) const;
-        /** Marshals the given sample directly on to a file
-         */
-        void marshal(int fd, Handle* sample);
-        /** Marshals the given sample directly on to a C++ stream
-         */
-        void marshal(std::ostream& stream, Handle* sample);
-        /** Marshals the given sample into a memory buffer
-         */
-        void marshal(std::vector<uint8_t>& buffer, Handle* sample);
-        /** Marshals the given sample into a memory buffer
-         */
-        int marshal(void* buffer, int buffer_size, Handle* sample);
-        /** Update the sample in +sample+ from the marshalled data in +buffer+
-         */
-        virtual void unmarshal(std::vector<uint8_t>& buffer, Handle* sample);
-        /** Update the sample in +sample+ from the marshalled data in +buffer+
-         */
-        virtual void unmarshal(void const* buffer, int buffer_size, Handle* sample);
-
-        virtual RTT::base::ChannelElementBase::shared_ptr createStream(RTT::base::PortInterface* port, const RTT::ConnPolicy& policy, bool is_sender) const
-        { return RTT::base::ChannelElementBase::shared_ptr(); }
-    };
-
-    /** Given a typelib value, returns the corresponding opaque value
-     *
-     * The caller is the owner of the memory. He is responsible to cast it to
-     * the right type, and delete it. The string is the type name of the opaque
-     * value.
-     *
-     * Note that for values that are typelib-compatible, a copy of the input is
-     * returned so that the ownership constraint outlined above is met.
-     *
-     * It relies on using the RTT type system to find the right
-     * TypelibMarshallerBase object.
-     */
-    void* getOpaqueValue(std::string const& expected_type, Typelib::Value value);
-}
-
-#endif
-
diff --git a/rtt-typelib/TypelibMarshallerHandle.hpp b/rtt-typelib/TypelibMarshallerHandle.hpp
deleted file mode 100644
index 44dce38..0000000
--- a/rtt-typelib/TypelibMarshallerHandle.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef TYPELIB_MARSHALLER_HANDLE_HPP
-#define TYPELIB_MARSHALLER_HANDLE_HPP
-
-namespace orogen_transports
-{
-    struct TypelibMarshallerBase::Handle
-    {
-        /** The TypelibMarshallerBase that created us
-         */
-        TypelibMarshallerBase* marshaller;
-        /** Type-pruned pointer of the sample that Typelib can understand. It may be
-         * the same as orocos_sample
-         */
-        uint8_t* typelib_sample;
-        /** If true, the handle owns the memory addressed by \c typelib_sample, and
-         * will therefore destroy it when it gets deleted.
-         */
-        bool owns_typelib;
-        /** Type-pruned pointer of the sample that Orocos can understand. It may be
-         * the same as typelib_sample
-         */
-        uint8_t* orocos_sample;
-        /** If true, the handle owns the memory addressed by \c orocos_sample, and
-         * will therefore destroy it when it gets deleted.
-         */
-        bool owns_orocos;
-
-        void reset()
-        {
-            typelib_sample = 0;
-            orocos_sample  = 0;
-        }
-
-        Handle(TypelibMarshallerBase* marshaller)
-            : marshaller(marshaller)
-            , typelib_sample(0), owns_typelib(true)
-            , orocos_sample(0), owns_orocos(true) {}
-
-        template<typename Type>
-        Handle(TypelibMarshallerBase* marshaller, Type* data)
-            : marshaller(marshaller)
-            , typelib_sample(reinterpret_cast<uint8_t*>(data))
-            , owns_typelib(true)
-            , orocos_sample(typelib_sample)
-            , owns_orocos(true) {}
-
-        template<typename TypelibType, typename OrocosType>
-        Handle(TypelibMarshallerBase* marshaller, TypelibType* typelib_data, OrocosType* orocos_data)
-            : marshaller(marshaller)
-            , typelib_sample(reinterpret_cast<uint8_t*>(typelib_data))
-            , owns_typelib(true)
-            , orocos_sample(reinterpret_cast<uint8_t*>(orocos_data))
-            , owns_orocos(true) {}
-
-        ~Handle()
-        {
-            if (owns_typelib && typelib_sample)
-                marshaller->deleteTypelibSample(this);
-            if (owns_orocos && orocos_sample)
-                marshaller->deleteOrocosSample(this);
-        }
-    };
-}
-#endif
-
diff --git a/rtt-typelib/rtt-typelib.pc.in b/rtt-typelib/rtt-typelib.pc.in
deleted file mode 100644
index 35e8fa2..0000000
--- a/rtt-typelib/rtt-typelib.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=${prefix}/lib
-includedir=${prefix}/include
-
-Name: hokuyo
-Description: RTT-Typelib support code
-Version: 0.1
-Requires: orocos-rtt-@OROCOS_TARGET@ typelib
-Cflags: -I${includedir}
-Libs: -L${libdir} -lrtt-typelib
-
-- 
1.7.1

