00001 // 00002 // See license.txt for license information. 00003 // 00004 // object.hpp 00005 // 00006 // 15-jul-2003 phamilton Created 00007 // 00008 00009 #ifndef incCOMMON_OBJECT 00010 #define incCOMMON_OBJECT 00011 00012 // forwards 00013 #include <string> 00014 00015 namespace ph { 00016 namespace common { 00017 00018 // forwards 00019 class outerable_object_base; 00020 class composition_object_base; 00021 class deletable_object_base; 00022 class comparable_object_base; 00023 class visitable_object_base; 00024 class persistable_object_base; 00025 class cloneable_object_base; 00026 class pretendable_object_base; 00027 class importable_object_base; 00028 class nameable_object_base; 00029 00030 class object_base 00031 /** 00032 Abstract class representing an object which contains various 00033 interfaces used in persistance, reflection, and patterns. 00034 00035 None of these interfaces are mandatory, so it is up to the systems 00036 using them to test for the interface before using it, 00037 and gracefully fail if not found. 00038 */ 00039 { 00040 public: 00041 virtual ~object_base() {} 00042 00043 virtual outerable_object_base *outerable() 00044 { return 0; } 00045 //!< Outerable objects contain some type of pointer to 00046 //! the parent object. 00047 virtual const outerable_object_base *outerable() const 00048 { return 0; } 00049 //!< Outerable objects contain some type of pointer to 00050 //! the parent object. This interface is used in circumstances 00051 //! where the class won't be modified. 00052 00053 virtual composition_object_base *composition() 00054 { return 0; } 00055 //!< Composition objects follow the Composition pattern. 00056 //! 00057 virtual const composition_object_base *composition() const 00058 { return 0; } 00059 //!< Composition objects follow the Composition pattern. 00060 //! This interface is used in circumstances 00061 //! where the class won't be modified. 00062 00063 virtual deletable_object_base *deletable() 00064 { return 0; } 00065 //!< Deletable objects use a member to delete the object rather 00066 //! than a destructor. 00067 virtual const comparable_object_base *comparable() const 00068 { return 0; } 00069 //!< Deletable objects use a member to delete the object rather 00070 //! than a destructor. This interface is used in circumstances 00071 //! where the class won't be modified. 00072 00073 virtual visitable_object_base *visitable() 00074 { return 0; } 00075 //!< Visitable objects follow the Visitor pattern. 00076 virtual const visitable_object_base *visitable() const 00077 { return 0; } 00078 //!< Visitable objects follow the Visitor pattern. This interface is used in circumstances 00079 //! where the class won't be modified. 00080 00081 virtual persistable_object_base *persistable() 00082 { return 0; } 00083 //!< Persistable objects can be written and read to some type of 00084 //! external storage. 00085 virtual const persistable_object_base *persistable() const 00086 { return 0; } 00087 //!< Persistable objects can be written and read to some type of 00088 //! external storage. This interface is used in circumstances 00089 //! where the class won't be modified. 00090 00091 virtual cloneable_object_base *cloneable() 00092 { return 0; } 00093 //!< Cloneable objects allow objects to be used in the abstract 00094 //! factory pattern. 00095 virtual const cloneable_object_base *cloneable() const 00096 { return 0; } 00097 //!< Cloneable objects allow objects to be used in the abstract 00098 //! factory pattern. This interface is used in circumstances 00099 //! where the class won't be modified. 00100 00101 virtual pretendable_object_base *pretendable() 00102 { return 0; } 00103 //!< Pretendable objects can pretend to be other objects. 00104 virtual const pretendable_object_base *pretendable() const 00105 { return 0; } 00106 //!< Pretendable objects can pretend to be other objects. 00107 //! This interface is used in circumstances 00108 //! where the class won't be modified. 00109 00110 virtual importable_object_base *importable() 00111 { return 0; } 00112 //!< Importable objects can be imported. 00113 virtual const importable_object_base *importable() const 00114 { return 0; } 00115 //!< Importable objects can be imported. 00116 //! This interface is used in circumstances 00117 //! where the class won't be modified. 00118 00119 virtual nameable_object_base *nameable() 00120 { return 0; } 00121 //!< Nameable objects can be named. 00122 virtual const nameable_object_base *nameable() const 00123 { return 0; } 00124 //!< Nameable objects can be named. 00125 //! This interface is used in circumstances 00126 //! where the class won't be modified. 00127 }; 00128 00129 }; // common 00130 }; // ph 00131 00132 #endif // incCOMMON_OBJECT