partial serialize/deserialize a structure

Hello everyone,

I have a large number of strcture instances, the I can not have all of them in memory. So I have the idea of serialize/deserialize partial of them to/from disk. The operation I need on these structure instances is to enumerate elements one by one, and I want to provide applications which use this interface to enumerate elements be transparent to how and which parts of structure instances is written/read to/from disk -- and the application only will feel read from memory.

I am wondering whether there are any samples/tutorials to make a reference?

thanks in advance,
George

[603 byte] By [George2] at [2007-12-24]
# 1
Enumerating elements won't be possible, unless you're using C++/CLI and reflection. For native C++, see http://www.boost.org/libs/serialization/doc/index.html.
einaros at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2

(I think this is called "Transparent C++ Persistence". I know that a solution is provided by http://www.objectstore.com and www.progress.com; maybe they have some documentation or download.)

Viorel. at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 3

Out of memory caching can be a complex matter, and not necessarily covered by all solutions which provide database persistent storage. The easiest (less expensive in terms of $'s) route to take, is to use a combination of variable getters and setters, boost serialize or a similar (free) library which provides effective storage of a number of types.

The key to a well working system isn't really the storage mechanism, though, but rather the mechanism which controls the lifetime of the objects. The obvious model: If an object is left dorment for a period of time, it should be serialized, and whenever it's accessed it should be deserialized. To take it one step further, you could try to anticipate the use of objects, and deserialize them prior to access -- eliminating latency when a getter or setter is called. Optimistic object responsibility chaining can help solve this -- indicating to the cache mechanism that class B is likely to be accessed upon a call to class A.

Techniques such as this is often used in game programming, so literature on that field is likely to yield some clues.

einaros at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 4

Thank you einaros!

Any simple samples? Boost is a good stuff, but it is too big. I only need a simple sample with at most several hundreds of lines.

regards,

George

George2 at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 5
einaros wrote:

Out of memory caching can be a complex matter, and not necessarily covered by all solutions which provide database persistent storage. The easiest (less expensive in terms of $'s) route to take, is to use a combination of variable getters and setters, boost serialize or a similar (free) library which provides effective storage of a number of types.

The key to a well working system isn't really the storage mechanism, though, but rather the mechanism which controls the lifetime of the objects. The obvious model: If an object is left dorment for a period of time, it should be serialized, and whenever it's accessed it should be deserialized. To take it one step further, you could try to anticipate the use of objects, and deserialize them prior to access -- eliminating latency when a getter or setter is called. Optimistic object responsibility chaining can help solve this -- indicating to the cache mechanism that class B is likely to be accessed upon a call to class A.

Techniques such as this is often used in game programming, so literature on that field is likely to yield some clues.

I think your description is practical/feasible. Any good code samples or tutorials?

regards,

George

George2 at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 6

Thank you Viorel!

Viorel. wrote:

(I think this is called "Transparent C++ Persistence". I know that a solution is provided by http://www.objectstore.com and www.progress.com; maybe they have some documentation or download.)

I have checked the URLs and I find that they are commercial products. I am looking for some code snippet to do such things in a simple and easy way ...

regards,

George

George2 at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...