Search code examples
c++objectpersistence

what is the concept of Object-Persistence?


what does Object persistence mean in c++?
Can you explain it with an example or provide links to where i could find the answer? Thank you.


Solution

  • Most objects cease to exist when they go out of scope. This may be when the function in which they were created terminates. It may be when the container in which they reside is deleted. At any rate, they can be expected to disappear when the program exits. Persistent objects are those which survive between successive invocations of the program. A classic example of such an object is a database record.

    check out the following links:

    C++ object persistence library similar to eternity

    http://sourceforge.net/projects/litesql/

    http://www.codesynthesis.com/products/odb/doc/manual.xhtml

    http://en.wikipedia.org/wiki/ODB_(C%2B%2B)

    http://drdobbs.com/cpp/184408893

    http://tools.devshed.com/c/a/Web-Development/C-Programming-Persistence/

    C++ doesn't support persistence directly (there are proposals for adding persistence and reflection to C++ in the future). Persistence support is not as trivial as it may seem at first. The size and memory layout of the same object may vary from one platform to another. Different byte ordering, or endian-ness, complicate matters even further. To make an object persistent, we have to reserve its state in a non-volatile storage device. ie: Write a persistent object to retain its state outside the scope of the program in which it was created.