[Rock-dev] Questions Regarding Typelib

Sylvain Joyeux bir.sylvain at gmail.com
Sat Jun 7 16:29:03 CEST 2014


On Thu, Jun 5, 2014 at 1:05 PM, Janosch Machowinski <
Janosch.Machowinski at dfki.de> wrote:

> It loads a type description, either from the installed TLB files,
> or from a log stream. From this a Typelib::Type is generated.
>
Not exactly. TLB files represent a registry, i.e. a self-consistent set of
types (Pocolog streams simply embed a XML document that is in the same
format than the .tlb files). What you therefore get from the XML
description is a Typelib::Registry object out of which you can query for
the Typelib::Type object(s) that describe your type.


> To store or load a type, one needs to create a Typelib::Value
> A typlib value is a unpacked version of the Type, plus the type description
>
You store and load a value, not a type. Types describe values.

A value is a typed pointer, i.e. a pointer to memory with the Typelib::Type
object that describes the binary layout of said memory.


> Here is my first question, how can I load non POD types. I suppose,
> I must supply a preinitialized type as target Pointer ?
>
> Is there a way of doing this anonymously ?
>
Yes. You must create a big enough buffer (use type.size() to know how big)
and initialize it with Typelib::init()

How do I check (in c++) if the local type and the stream type are the same ?
> I suppose I load the system tlb and check it against the stream tlb, is
> there
> already a function for this ?
>
For you application; type.isSame(*other_type) will do the trick. Do NOT use
== unless you know the two types are within the same registry. Another way
is to merge the two registries. It will fail if some types are found with
same name and different definitions (thus ensuring that all the types are
the same)

Warning: there is no such thing as a 'system tlb'. TLBs are saved
per-orogen component to make sure that it indeed describes the types that
the component uses (very important in case of partial rebuilds after a type
change)

Given the stream of commits in pocolog_cpp and your questions, you are
obviously reimplementing in C++ big chunks of what is already done in Ruby.
Care to share your plans with the group ?

Sylvain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.dfki.de/pipermail/rock-dev/attachments/20140607/f8ad2d78/attachment.htm 


More information about the Rock-dev mailing list