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_OBJECTIDENTIFICATION_H__ 00016 #define __C_OBJECTIDENTIFICATION_H__ 00017 00018 // Common POLiTe Header(s) 00019 #include <lDefs.h> 00020 #include <lTrace.h> 00021 #include <lTypes.h> 00022 #include <lStr.h> // String class header 00023 00024 class DLL_External ObjectIdentification 00025 { 00026 #ifdef POLITE_TEST_FRIEND 00027 friend POLITE_TEST_FRIEND; 00028 #endif // POLITE_TEST_FRIEND 00029 00030 friend class RefBase; 00031 friend class ResultBase; 00032 friend class Object; 00033 friend class ProtoBase; 00034 friend class ObjectBuffer; 00035 00036 protected: 00037 union { 00038 class ProtoBase *_prototype; 00039 const class Object *_object; 00040 }; 00041 char *_SelectKeyValues; 00042 00043 public: 00044 ObjectIdentification(); 00045 // Construct empty identification (IDNULL) 00046 00047 ObjectIdentification( 00048 class ProtoBase *aPrototype, 00049 char * const aSelectKeyValues 00050 ); 00051 // Construct non-empty identification 00052 // thet identifies object stored in the database 00053 00054 ObjectIdentification( 00055 const class Object *anObject 00056 ); 00057 // Construct non-empty identification 00058 // that identifies object in the memory only 00059 00060 ObjectIdentification( 00061 const long anOid, 00062 class ProtoBase *aPrototype 00063 ); 00064 // Construct non-empty identification 00065 // thet identifies object stored in the database 00066 00067 ObjectIdentification( 00068 const ObjectIdentification &X 00069 ); 00070 // Construct copy of an identification X 00071 00072 virtual ~ObjectIdentification(); 00073 00074 protected: 00075 virtual bool _Init( 00076 class ProtoBase *aPrototype, 00077 char * const aSelectKeyValues 00078 ); 00079 // Re-initializes already existing identification 00080 00081 virtual bool _Init( 00082 const class Object *anObject 00083 ); 00084 // Re-initializes already existing identification 00085 00086 public: 00087 virtual class ProtoBase *Prototype() const; 00088 // Returns pointer to prototype instance of the target class 00089 00090 virtual bool operator ==( 00091 const ObjectIdentification &X 00092 ) const; 00093 00094 virtual bool operator !=( 00095 const ObjectIdentification &X 00096 ) const; 00097 00098 virtual ObjectIdentification &operator =( 00099 const ObjectIdentification &X 00100 ); 00101 }; 00102 00103 extern const ObjectIdentification IDNULL; 00104 //NULL identification - identifies nothing 00105 00106 #endif //__C_OBJECTIDENTIFICATION_H__