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

cDatabaseObject.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_DATABASEOBJECT_H__
00016 #define __C_DATABASEOBJECT_H__
00017 
00018 // Parent Header(s)
00019 #include <cImmutableObject.h>
00020 
00021 class DLL_External DatabaseObject : public ImmutableObject
00022 {
00023 #ifdef POLITE_TEST_FRIEND
00024         friend POLITE_TEST_FRIEND;
00025 #endif // POLITE_TEST_FRIEND
00026 
00027 protected:
00028         bool _DirtyFlag;
00029         //Whether the object is or is not dirty.
00030 
00031 public:
00032         DatabaseObject();         // constructor
00033 
00034         DatabaseObject(                 // constructor
00035                 enum LockingStrategy a_LockingStrategy,
00036                 enum UpdatingStrategy an_UpdatingStrategy,
00037                 enum WaitingStrategy a_WaitingStrategy,
00038                 enum ReadingStrategy a_ReadingStrategy
00039                 );
00040 
00041         ~DatabaseObject();              // destructor
00042 
00043         static const char* BaseClassName() {return "DatabaseObject";};
00044         ABSTRACT_CLASS(DatabaseObject);
00045         //PARENTS(NULL);
00046         //SELECT("");
00047         //FROM("");
00048         //WHERE("");
00049         //GROUP_BY("");
00050         //HAVING("");
00051         //ORDER_BY("");
00052         //PRIMARY_KEY("");
00053 
00054 public:
00055         virtual bool IsDirty() const
00056         //Returns True, if an object is marked as dirty
00057         //(e.g. the object was changed in the memory).
00058         {
00059                 return _DirtyFlag;
00060         };
00061 
00062         virtual bool MarkAsDirty()
00063         //Marks a persistent object as Dirty. Only Dirty (changed)
00064         //objects are written to the database when flushing the buffer.
00065         {
00066                 return (_DirtyFlag = true);
00067         };
00068 
00069 protected:
00070         virtual bool _MarkAsClean()
00071         //Marks a persistent object as Clean. Only Dirty (changed)
00072         //objects are written to the database when flushing the buffer.
00073         {
00074                 return !(_DirtyFlag = false);
00075         };
00076 
00077 public:
00078         virtual class RefBase BePersistent(class Connection *DbCon);
00079         //Causes an object to be persistent.
00080         //Persistent objects are  created as transient (they exist only
00081         //in memory) and when it is needed (all attributes are set to
00082         //appropriate values), then they  can be converted to true
00083         //persistent objects. An advantage is that transient objects do
00084         //not propagate into a database while persistent objects are
00085         //written (in spite of buffering mechanism) to the database
00086         //often.
00087 };
00088 
00089 //ABSTRACT_CLASS_PROTOTYPE(DatabaseObject);
00090 extern DLL_External Proto<DatabaseObject> DatabaseObject_class;
00091 
00092 #endif //__C_DATABASEOBJECT_H__

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