Actually that code has a premature end of message error the following has 
the memory alignment issue:

auto bufferVector = static_cast<std::vector<uint8_t>*>(buffer);
kj::ArrayPtr<capnp::word> words(reinterpret_cast<capnp::word*>(buffer), 
bufferSize / sizeof(capnp::word));

// const auto words = kj::heapArray<capnp::word>(bufferSize);
// memcpy((void*)words.begin(), buffer, words.asBytes().size() / 
sizeof(capnp::word));

capnp::FlatArrayMessageReader input(words);

crl::sensors::IMUSample deserialized;

const auto reader = input.getRoot<IMUData>();





On Sunday, January 12, 2020 at 12:00:47 PM UTC-5, Erich Foster wrote:
>
> I'm really close but I am having memory alignment issues. What I have so 
> far:
>
> const auto words = kj::heapArray<capnp::word>(bufferSize);
> memcpy((void*)words.begin(), buffer, words.asBytes().size() / 
> sizeof(capnp::word));
>
> capnp::FlatArrayMessageReader input(words);
>
> crl::sensors::IMUSample deserialized;
>
> const auto reader = input.getRoot<IMUData>();
>
>
>
>
> On Sunday, January 12, 2020 at 8:14:04 AM UTC-5, Erich Foster wrote:
>>
>> It looks as though the link below covers the portion where I was stuck. 
>> If there are any caveats or extra details to get to the 
>> kj::VectorOutputStream I would be happy to hear about that.
>>
>>
>> https://stackoverflow.com/questions/49722870/capn-proto-de-serialize-struct-to-from-stdstring-for-storing-in-leveldb
>>
>

-- 
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 capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/d54cd60c-235d-411e-84e7-ed525bc81cc6%40googlegroups.com.

Reply via email to