Hi Jacek,

If you wanted to create a MesasgeReader that reads from a message created
by some MessageBuilder, you could use SegmentArrayMessageReader, like:

    capnp::SegmentArrayMessageReader reader(builder.getSegmentsForOutput());
    MyType::Reader root = reader.getRoot<MyType>();

This is a little bit of a funny thing to do. The performance will be almost
identical to if you had done:

    MyType::Reader root = builder.getRoot<MyType>().asReader();

If you want to test packing/unpacking, then you will need to write the
packed data to a kj::OutputStream and then read it back from a
kj::InputStream. You could use kj::ArrayOutputStream and
kj::ArrayInputStream with a suitably-sized backing array to do this
in-memory.

-Kenton

On Thu, Feb 2, 2017 at 6:51 AM, <[email protected]> wrote:

> Hi
> I write simple app. And I want to test efficiency random access Capnpro
> structures. This is because you claim it is very fast. But I don't know how
> to create ::capnp::PackedMessageReader mMessageReader;  with  ::capnp::
> MallocMessageBuilder as input. Can you give me some advices how to do
> that?
>
> best regards
> Jacek
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to