Browse Prior Art Database

Using Static Time Stamps in Persistent Objects to Validate Pointers

IP.com Disclosure Number: IPCOM000116858D
Original Publication Date: 1995-Nov-01
Included in the Prior Art Database: 2005-Mar-31
Document File: 2 page(s) / 49K

Publishing Venue

IBM

Related People

Dennison, CM: AUTHOR

Abstract

A method for validating persistent pointers in C++* objects using a time stamp. A static data member is set to the system time at process startup. The time stamp saved on disk is compared with the in-memory data member to determine if the pointer that was saved to disk is still valid. class PersistentClass { public: . . //other member functions . save(); //writes object to disk restore(); //reads object from disk private: void* pointer; //pointer to be saved and restored static time_t timestamp; //timestamp for validating pointer }; Fig. 1. Definition of a persistent class with a time stamp

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 54% of the total text.

Using Static Time Stamps in Persistent Objects to Validate Pointers

      A method for validating persistent pointers in C++* objects
using a time stamp.  A static data member is set to the system time
at process startup.  The time stamp saved on disk is compared with
the in-memory data member to determine if the pointer that was saved
to disk is still valid.
  class PersistentClass
  {
    public:
        .
        .                           //other member functions
        .
        save();                     //writes object to disk
        restore();                  //reads object from disk
    private:
        void* pointer;              //pointer to be saved and
restored
        static time_t timestamp;    //timestamp for validating
pointer
  };
  Fig. 1.  Definition of a persistent class with a time stamp

      A C++ program may save an object to disk by writing out the
contents of its data members.  This object can be restored by reading
the data from disk and storing the information back into the data
members.  This allows an object to be persistent from one invocation
of the program to the next.  However, problems arise when the data
being saved is a pointer value; the value of the pointer is only
valid for the duration of the process.  If the program reads and
tries to use a pointer value that was written by an earlier process,
the program will fail.

      To solve this problem, the program need...