<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I'm really puzzled about this one..<br>
      I already took a look into the rtt_typelib package.<br>
      The correct thing seems to be to call<br>
      handle.transport-&gt;setTypelibSample(handle.transportHandle,
      sample.data.data(), false);<br>
      but the it gives me a std:bad_alloc when it tries to<br>
      allocate the 'typlib' type (in this case base::samples::Frame) in<br>
      orogen_transports::OpaqueTypelibMarshaller&lt;base::samples::frame::Frame,
      RTT::extras::ReadOnlyPointer&lt;base::samples::frame::Frame&gt;,
      0&gt;::setTypelibSample(orogen_transports::TypelibMarshallerBase::Handle*,
      unsigned char*, bool)<br>
      Any Ideas ?<br>
          Janosch<br>
      <br>
      <br>
      Am 01.09.2015 um 15:16 schrieb Sylvain Joyeux:<br>
    </div>
    <blockquote
      cite="mid:20150901131607.05149C7E63_5E5A517B@sea-mail.dfki.de"
      type="cite">
      <div dir="ltr">Have a look at opaque handling in the mqueue
        transport, that should show you how to do it.
        <div><br>
        </div>
        <div>Sylvain</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Sep 1, 2015 at 9:16 AM, Janosch
          Machowinski <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:Janosch.Machowinski@dfki.de" target="_blank">Janosch.Machowinski@dfki.de</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey,<br>
            we are using the typelib marshaler to implement a<br>
            second network transport. For Mashaling we use this code :<br>
                     while (static_cast&lt;RTT::base::InputPortInterface<br>
            *&gt;(handle.port)-&gt;read(handle.sample, false) ==
            RTT::NewData)<br>
                         gotNewData = true;<br>
            <br>
                     if (gotNewData) {<br>
                         Communication::DataContainer data;<br>
            <br>
handle.transport-&gt;refreshTypelibSample(handle.transportHandle);<br>
                         handle.transport-&gt;marshal(data.buffer,
            handle.transportHandle);<br>
            which works fine.<br>
            <br>
            In case that the port contains a
            RoPtr&lt;base::samples::Frame&gt; we get an<br>
            std::bad_alloc on<br>
            unmashaling using this code :<br>
            <br>
                     handle.transport-&gt;unmarshal(data.buffer,
            handle.transportHandle);<br>
            <br>
            The Handle here looks like this :<br>
                 class PortHandle<br>
                 {<br>
                 public:<br>
                     std::string name;<br>
                     orogen_transports::TypelibMarshallerBase
            *transport;<br>
                     RTT::base::DataSourceBase::shared_ptr sample;<br>
                     orogen_transports::TypelibMarshallerBase::Handle
            *transportHandle;<br>
                     RTT::base::PortInterface *port;<br>
                 };<br>
            And is set up using this code :<br>
                     RTT::types::TypeInfo const *type =
            port-&gt;getTypeInfo();<br>
                     curHandle.transport =<br>
            dynamic_cast&lt;orogen_transports::TypelibMarshallerBase<br>
*&gt;(type-&gt;getProtocol(orogen_transports::TYPELIB_MARSHALLER_ID));<br>
                     if (! curHandle.transport) {<br>
                         return false;<br>
                     }<br>
            <br>
                     curHandle.transportHandle =
            curHandle.transport-&gt;createSample();<br>
                     curHandle.sample =<br>
curHandle.transport-&gt;getDataSource(curHandle.transportHandle);<br>
            <br>
            Any ideas what is wrong ? I suspect, that I need to
            initialize the<br>
            orocos sample somehow on the<br>
            receiving end, before unmarhsaling the data...<br>
            Greetings<br>
                 Janosch<br>
            <br>
            --<br>
              Dipl. Inf. Janosch Machowinski<br>
              SAR- &amp; Sicherheitsrobotik<br>
            <br>
              Universität Bremen<br>
              FB 3 - Mathematik und Informatik<br>
              AG Robotik<br>
              Robert-Hooke-Straße 1<br>
              28359 Bremen, Germany<br>
            <br>
              Zentrale: <a moz-do-not-send="true"
              href="tel:%2B49%20421%20178%2045-6611"
              value="+49421178456611">+49 421 178 45-6611</a><br>
            <br>
              Besuchsadresse der Nebengeschäftstelle:<br>
              Robert-Hooke-Straße 5<br>
              28359 Bremen, Germany<br>
            <br>
              Tel.:    <a moz-do-not-send="true"
              href="tel:%2B49%20421%20178%2045-6614"
              value="+49421178456614">+49 421 178 45-6614</a><br>
              Empfang: <a moz-do-not-send="true"
              href="tel:%2B49%20421%20178%2045-6600"
              value="+49421178456600">+49 421 178 45-6600</a><br>
              Fax:     <a moz-do-not-send="true"
              href="tel:%2B49%20421%20178%2045-4150"
              value="+49421178454150">+49 421 178 45-4150</a><br>
              E-Mail:  <a moz-do-not-send="true"
              href="mailto:jmachowinski@informatik.uni-bremen.de">jmachowinski@informatik.uni-bremen.de</a><br>
            <br>
              Weitere Informationen: <a moz-do-not-send="true"
              href="http://www.informatik.uni-bremen.de/robotik"
              rel="noreferrer" target="_blank">http://www.informatik.uni-bremen.de/robotik</a><br>
            <br>
            _______________________________________________<br>
            Rock-dev mailing list<br>
            <a moz-do-not-send="true" href="mailto:Rock-dev@dfki.de">Rock-dev@dfki.de</a><br>
            <a moz-do-not-send="true"
              href="http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev"
              rel="noreferrer" target="_blank">http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
 Dipl. Inf. Janosch Machowinski
 SAR- &amp; Sicherheitsrobotik

 Universität Bremen
 FB 3 - Mathematik und Informatik
 AG Robotik
 Robert-Hooke-Straße 1
 28359 Bremen, Germany
 
 Zentrale: +49 421 178 45-6611
 
 Besuchsadresse der Nebengeschäftstelle: 
 Robert-Hooke-Straße 5
 28359 Bremen, Germany
 
 Tel.:    +49 421 178 45-6614
 Empfang: +49 421 178 45-6600
 Fax:     +49 421 178 45-4150
 E-Mail:  <a class="moz-txt-link-abbreviated" href="mailto:jmachowinski@informatik.uni-bremen.de">jmachowinski@informatik.uni-bremen.de</a>

 Weitere Informationen: <a class="moz-txt-link-freetext" href="http://www.informatik.uni-bremen.de/robotik">http://www.informatik.uni-bremen.de/robotik</a>
</pre>
  </body>
</html>