| Polaris: Definition.h Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
Definition.hGo to the documentation of this file.00001 /// 00002 /// 00003 /// file Definition.h 00004 /// 00005 #ifndef _DEFINITION_H 00006 #define _DEFINITION_H 00007 /// 00008 /// \class Definition 00009 /// \brief Contributes information required for Dictionary 00010 /// \defgroup C 00011 /// \ingroup C++ CVDL 00012 /// Polaris 00013 /// \see base/Definition.h 00014 /// \see Definition.h 00015 /// 00016 /// \endcode 00017 /// \section Description Description 00018 /// The Definition is a class which is meant to be used as a base class 00019 /// for classes which need to be stored in Dictionary structures. In 00020 /// order for a class to be stored in a Dictionary, it must have the 00021 /// data contributed by Definition. 00022 /// 00023 #ifdef POLARIS_GNU_PRAGMAS 00024 #pragma interface 00025 #endif 00026 /// 00027 #include "ClassNames.h" 00028 #include <stream.h> 00029 /// 00030 #include "Listable.h" 00031 #include "String.h" 00032 /// 00033 #include "p-assert.h" 00034 /// 00035 class BaseMap; 00036 00037 class Definition : public Listable { 00038 friend class BaseMap; 00039 friend inline ostream & operator << (ostream & o, const Definition & h); 00040 00041 protected: 00042 String _tag; 00043 00044 public: 00045 inline Definition(const char *tag); 00046 00047 virtual inline ~Definition(); 00048 00049 inline const char *tag_ref() const; 00050 00051 inline void rename(const char *tag); 00052 00053 virtual void print(ostream & o) const = 0; 00054 00055 virtual Definition *definition_clone() const = 0; 00056 00057 virtual int hash_value() const; 00058 00059 virtual Listable *listable_clone() const; 00060 ///< Return a base pointer to a new clone of this definition object 00061 00062 virtual int structures_OK() const = 0; 00063 ///< Check the structure of the data for errors or inconsistency 00064 ///< Return 0 and print error message if problems found, otherwise 00065 ///< return 1 without message. 00066 }; 00067 00068 inline ostream & 00069 operator << (ostream & o, const Definition & h) 00070 { 00071 h.print(o); return o; 00072 } 00073 00074 inline 00075 Definition::Definition(const char *tag) 00076 { 00077 #ifdef CLASS_INSTANCE_REGISTRY 00078 register_instance(DEFINITION, sizeof(Definition), this); 00079 #endif 00080 00081 _tag = tag; 00082 } 00083 00084 inline 00085 Definition::~Definition() 00086 { 00087 #ifdef CLASS_INSTANCE_REGISTRY 00088 unregister_instance(DEFINITION, this); 00089 #endif 00090 } 00091 00092 inline const char * 00093 Definition::tag_ref() const 00094 { 00095 return _tag; 00096 } 00097 00098 inline void 00099 Definition::rename(const char *tag) 00100 { 00101 assert_free(); _tag = tag; 00102 } 00103 00104 #endif |
||
|