Simple Persistence
Simple persistence is the storage and retrieval of an object to and from a stream.
Table 16 lists the classes in the Essential Tools Module that use simple persistence.
Table 16 – Classes with simple persistence
Category | Description |
---|
C++ fundamental types | int , char , float , ... |
Rogue Wave date and time classes | |
Rogue Wave string classes | |
Miscellaneous Rogue Wave classes | |
Because it is straightforward, simple persistence is a quick and easy way to save and restore objects that have neither pointers to other objects nor virtual member functions.
However, when objects that refer to each other are saved and then restored with simple persistence, the pointer relationships, or morphology, among the objects can change. This is because simple persistence assumes that every pointer reference to an object in memory refers to a unique object. Thus, when an object is saved with simple persistence, two references to the same memory location will cause two copies of the contents of that memory location to be saved. Not only does this use extra space in the stream, but it also causes the restored object to point to two distinct copies of the referenced object.