serialization: efficient binary archive

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, 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. 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, 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. 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. 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. 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::mapstd::string,boost::any thanks

__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::mapstd::string,boost::any
That's what it sounds like to me. What's holding you up?
thanks
Your welcome. Robert Ramey
participants (2)
-
__PPS__
-
Robert Ramey