|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2005-11-22 02:18:45
__PPS__ wrote:
> Hello,
> I want to write simple binary searialization class.
> the serialized data should be as compact as possible, e.g. I don't
> want to have "serialization::archive" string etc,
header is optional - see no_header in archive documentation.
> since most of the
> time I need really basic serialization performed into many separate
> archives: something like hunrdreds of archives that contain simple
> int, or string. I also don't need any versioning.
primitives are not versioned by default - see documenation
under serializaiton traits.
These data
> serializations are for a short period of time (automatically removed
> after a few minutes), to share data between multiple processes on the
> same machine.
> Basicly, I need to serialize many key-value pairs, and then to be able
> to extract values by their keys. Keys are simple strings, values can
> be anything.
> Since I cannot use boost::any for value part,
You could make your own version of boost::any which
supports serializaiton. Then you could upload to the vault so
the rest of use could use it.
then I decided to go a
> way around. I'll have a map that maps string keys to the serialized
> binary string of value, and then this big map is serialized. The
> other process then deserializes this map and if it accesses some
> value it also needs to deserialize the value. I really need simple
> searialization, something like
> i:1234,s[5]:Hello
> for int(1234) and string("Hello") with all the numbers serialized in
> binary etc, without any BE/LE code - always the same machine used.
> I think it would be really enough for me to have serialization of
> numbers, strings and binary data, but I want to use
> boost::serialization to allow users to insert objects of their own
> classes in that key-value pairs.
I don't see any problem. Just user std::map and serialize the map.
> basicly, my goal is to create such class that maps string keys to any
> data, then all this map is serialized and some other process
> deserializes this map and accesses values by keys.
see above - sounds easy.
> Is there's something in serialization library you could suggest me to
> look at. I viewed demo_fast_archive, but I cannot find good info on
> creating my own archive classes.
seems to me you might want to look at test_map
The documentation on creating your own archive will probrably be
improved - but it will take a while. Maybe demo_portable_archive
might help as well.
But, its sounds to me that you want to either make a new version
of boost::any which supports serialization or uses an std:::map.
> It seems that my problem would be completely solved if there were some
> way to serialize boost::any, in this case I would only needed to
> serialize std::map<std::string,boost::any>
That's what it sounds like to me. What's holding you up?
>
> thanks
Your welcome.
Robert Ramey
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net