Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

cPersistentObject.h

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /*                                                                            */
00003 /* POLiTe - Persistent Object Library Test                                    */
00004 /*                                        Ph.D. Thesis by Mgr. Michal Kopecky */
00005 /*                                                                            */
00006 /* Charles University Prague                                                  */
00007 /*                                                                            */
00008 /******************************************************************************/
00009 /*                                                                            */
00010 /* File name: ...                                                             */
00011 /* Module: ......                                                             */
00012 /*                                                                            */
00013 /******************************************************************************/
00014 
00015 #ifndef __C_PERSISTENTOBJECT_H__
00016 #define __C_PERSISTENTOBJECT_H__
00017 
00018 // INCLUDE PARENT CLASS(ES) HEADER(S)
00019 #include <cDatabaseObject.h>
00020 
00021 class DLL_External PersistentObject : public DatabaseObject
00022 {
00023 #ifdef POLITE_TEST_FRIEND
00024         friend POLITE_TEST_FRIEND;
00025 #endif // POLITE_TEST_FRIEND
00026 
00027 friend class ResultBase;
00028 friend class ProtoBase;
00029 
00030 protected:
00031 
00032 
00034         // Checks, if version of object in memory is the same as the version in the database
00035         // Applicable on PersistentObject class, predecessors return true
00036         virtual bool _VersionsMatch();
00037 
00038 public:
00039 
00040         virtual bool Update();
00041 
00042         PersistentObject();                     // constructor
00043 
00044         ~PersistentObject();                    // destructor
00045 
00046         static const char* RootClassName() {return "PersistentObject";};
00047         static const char* BaseClassName() {return "PersistentObject";};
00048         ABSTRACT_CLASS(PersistentObject);
00049         //PARENTS(NULL);
00050         FROM(PERSISTENT_OBJECT_TABLE);
00051         dbLongRO(OID);
00052         //This private attribute is added to an instance of the
00053         //class  in the time the instance is made persistent by
00054         //calling BePersistent() method.
00055         //Method OID() Returns OID of an instance, or zero, if the object is
00056         //not a really persistent object (before calling BePersistent()
00057         //method on it).
00058         dbLongRO(SerialNumber);
00059         //The number of version of object. It can help to keep consistent data
00060         //in memory and thus amount of retrieved data can be decreased. When
00061         //object must be accessed it is possible to check if serial number
00062         //of object in database is the same as serial number of object in
00063         //memory. If yes data in memory are valid and can be used. If not,
00064         //content of object in memory must be refreshed.
00065         MAPKEY_BEGIN
00066                 mapLong(OID, PERSISTENT_OBJECT_TABLE ".OID")
00067         MAPKEY_END;
00068         MAP_BEGIN
00069                 mapLong(SerialNumber, PERSISTENT_OBJECT_TABLE ".VERSION")
00070         MAP_END;
00071 
00072         virtual RefBase BePersistent(
00073                 class Connection *DbCon
00074                 );
00075 };
00076 
00077 // my own prototype / instance of this class
00078 //ABSTRACT_CLASS_PROTOTYPE(PersistentObject);
00079 extern DLL_External Proto<PersistentObject> PersistentObject_class;
00080 
00081 #endif // __C_PERSISTENTOBJECT_H__

Generated on Sun Jul 14 20:51:14 2002 for POLiTe by doxygen1.2.16