MQTypelibMarshaller.cpp
Go to the documentation of this file.
00001 #include "TypelibMarshallerBase.hpp"
00002 #include "MQTypelibMarshaller.hpp"
00003 
00004 using namespace orogen_transports;
00005 
00006 typedef TypelibMarshallerBase::Handle TypelibHandle;
00007 
00008 MQTypelibMarshallerBase::MQTypelibMarshallerBase(orogen_transports::TypelibMarshallerBase* marshaller)
00009     : marshaller(marshaller) {}
00010 
00011 MQTypelibMarshallerBase::~MQTypelibMarshallerBase()
00012 {
00013     delete marshaller;
00014 }
00015 
00016 void* MQTypelibMarshallerBase::createCookie() const
00017 {
00018     return marshaller->createHandle();
00019 }
00020 
00021 void MQTypelibMarshallerBase::deleteCookie(void* cookie) const
00022 {
00023     marshaller->deleteHandle(static_cast<TypelibHandle*>(cookie));
00024 }
00025 
00026 std::pair<void const*,int> MQTypelibMarshallerBase::fillBlob( RTT::base::DataSourceBase::shared_ptr source, void* blob, int size, void* cookie) const
00027 {
00028     TypelibHandle* handle = static_cast<TypelibHandle*>(cookie);
00029     marshaller->setOrocosSample(handle, const_cast<void*>(source->getRawConstPointer()));
00030     int marshalled_size = marshaller->marshal(blob, size, handle);
00031     if (marshalled_size == 0)
00032         return std::make_pair(static_cast<void const*>(0), 0);
00033     else
00034         return std::make_pair(static_cast<void const*>(blob), marshalled_size);
00035 }
00036 
00037 bool MQTypelibMarshallerBase::updateFromBlob(const void* blob, int size, RTT::base::DataSourceBase::shared_ptr target, void* cookie) const
00038 {
00039     TypelibHandle* handle = static_cast<TypelibHandle*>(cookie);
00040     marshaller->setOrocosSample(handle, target->getRawPointer(), false);
00041     marshaller->unmarshal(blob, size, handle);
00042     return true;
00043 }
00044 
00045 unsigned int MQTypelibMarshallerBase::getSampleSize( RTT::base::DataSourceBase::shared_ptr sample, void* cookie) const
00046 {
00047     TypelibHandle* handle = static_cast<TypelibHandle*>(cookie);
00048     marshaller->setOrocosSample(handle, const_cast<void*>(sample->getRawConstPointer()));
00049     return marshaller->getMarshallingSize(handle);
00050 }
00051 


rtt_typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Sat Jun 8 2019 18:49:39