serializing an arbitrary data structure into a flat buffer (raw contiguousmemory block)

Discussion in 'C++' started by Alfonso Morra, Oct 3, 2005.

  1. Hi,

    I am writing a messaging library which will allow me to send a generic
    message structure with custom "payloads".

    In many cases, a message must store a non-linear data structure (i.e.
    "payload") using pointers. Examples of these are binary trees, hash
    tables etc. Thus, the message itself contains only a pointer to the
    actual data. When the message is sent to the same processor, these
    pointers point to the original locations, which are within the address
    space of the same processor. However, when such a message is sent to
    other processors, these pointers will point to invalid locations.

    I need a way to ``serialize'' (or pack) my message structures into a
    contiguous raw memory block (and then be able to de-serialize or
    "unpack" them at the other end.

    I just need a simple example, using a simple structure that contains
    pointers (say a ptr to another struct, or a char*) so that I can build
    on from that.

    Searches on Google over the last few days have yielded nothing useful.

    Thanks
    Alfonso Morra, Oct 3, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ksenia Marasanova

    convert flat structure into hierarchical one

    Ksenia Marasanova, Sep 26, 2004, in forum: Python
    Replies:
    3
    Views:
    542
    Ksenia Marasanova
    Sep 27, 2004
  2. Alfonso Morra

    serialization of structure into a raw memory block

    Alfonso Morra, Oct 1, 2005, in forum: C Programming
    Replies:
    5
    Views:
    498
    Michael Wojcik
    Oct 2, 2005
  3. Alfonso Morra
    Replies:
    5
    Views:
    389
    Michael Wojcik
    Oct 4, 2005
  4. Alfonso Morra
    Replies:
    9
    Views:
    342
  5. Gavin Kistner
    Replies:
    6
    Views:
    112
    Ezra Zygmuntowicz
    Nov 17, 2005
Loading...

Share This Page