![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: Type.h 00008 // Contents: Type class, the type descriptor 00009 // Author: Anthony J H Simons 00010 // Revised: 28 September 2005 00011 00012 // This software is distributed free in the hope that others will 00013 // find it useful. However, it comes WITHOUT ANY WARRANTY. No 00014 // liability can be accepted for software failure, merchantability 00015 // or fitness for a particular purpose. You can redistribute this 00016 // software in its original form, or in a modified form, provided 00017 // that this disclaimer is retained in the file banner. 00018 00019 #ifndef SCL_TYPE 00020 #define SCL_TYPE 00021 00022 #include "Object.h" // Include the superclass type 00023 #include "TypeID.h" // Include the pointer type 00024 #include "StringID.h" // Depends on the pointer type 00025 #include "MapID.h" // Depends on the pointer type 00026 00039 00040 class Type : public Object { 00041 private: 00042 static MapID typeMap; 00043 StringID typeName; 00044 Type(const Type&); 00045 public: 00046 Type(); 00047 virtual ~Type(); 00048 Type(StringID); 00049 virtual ObjectID clone() const; 00050 virtual Natural hash() const; 00051 virtual Order compare(ObjectID) const; 00052 Order compare(TypeID) const; 00053 StringID name() const; 00054 ObjectID create() const; 00055 00056 static MapID registry(); 00057 static Void notify(ObjectID); 00058 static ObjectID create(StringID); 00059 }; 00060 00062 00065 inline TypeID::TypeID() {} 00066 00068 inline TypeID::~TypeID() {} 00069 00073 inline TypeID::TypeID(const Null* null) : 00074 ObjectID(null) {} 00075 00079 inline TypeID::TypeID(const Type* type) : 00080 ObjectID(type) {} 00081 00085 inline TypeID::TypeID(const TypeID& pointer) : 00086 ObjectID(pointer) {} 00087 00091 inline TypeID& TypeID::operator=(const Type* type) { 00092 assign(type); 00093 return *this; 00094 } 00095 00100 inline TypeID& TypeID::operator=(const TypeID& pointer) { 00101 assign(pointer); 00102 return *this; 00103 } 00104 00105 00106 #endif 00107