00001 #ifndef _LCORE_ClassTypes_H_ // -*- c++ -*-
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifdef __GNUG__
00036 # pragma interface
00037 #endif
00038
00039 #ifndef _LCORE_Object_H_
00040 # include <LCore/Object.h>
00041 #else // Already included LCore/Object.h
00042
00043 #define _LCORE_ClassTypes_H_
00044
00045 #ifndef _LCORE_GenTypes_H_
00046 # include <LCore/GenTypes.h>
00047 #endif
00048
00049 #include <iosfwd>
00050
00051 namespace strmod {
00052 namespace lcore {
00053
00054 class ClassIdent;
00055
00056 class ProgrammerNum : public Object
00057 {
00058 public:
00059 static const ClassIdent identifier;
00060
00061 inline virtual int AreYouA(const ClassIdent &cid) const;
00062
00063 U4Byte GetPrNum() const { return(num); }
00064 friend inline bool operator ==(const ProgrammerNum &a,
00065 const ProgrammerNum &b);
00066
00067 ProgrammerNum(U4Byte n) : num(n) {}
00068
00069 protected:
00070 inline virtual int IsEqual(const Object &b) const;
00071 inline virtual const ClassIdent *i_GetIdent() const;
00072
00073 private:
00074 U4Byte num;
00075 };
00076
00077 class ClassNum : public Object {
00078 U4Byte num;
00079
00080 protected:
00081 inline virtual int IsEqual(const Object &b) const;
00082 inline virtual const ClassIdent *i_GetIdent() const;
00083
00084 public:
00085 static const ClassIdent identifier;
00086
00087 inline virtual int AreYouA(const ClassIdent &cid) const;
00088
00089 U4Byte GetClNum() const { return(num); }
00090 friend inline bool operator ==(const ClassNum &a, const ClassNum &b);
00091
00092 ClassNum(U4Byte n) : num(n) {}
00093 };
00094
00095
00096 class ClassIdent : public Object {
00097 ProgrammerNum prnum;
00098 ClassNum clnum;
00099
00100 protected:
00101 virtual void PrintOn(std::ostream &os) const;
00102 virtual void PrintOn(std::ostream &os) { Object::PrintOn(os); }
00103 inline virtual int IsEqual(const Object &b) const;
00104 inline virtual const ClassIdent *i_GetIdent() const;
00105
00106 public:
00107 static const ClassIdent identifier;
00108
00109 inline virtual int AreYouA(const ClassIdent &cid) const;
00110
00111 const ProgrammerNum &GetProgrammer() const { return(prnum); }
00112 const ClassNum &GetClass() const { return(clnum); }
00113 friend inline bool operator ==(const ClassIdent &a, const ClassIdent &b);
00114
00115 inline ClassIdent(const ProgrammerNum &pn, const ClassNum &cn);
00116 };
00117
00118
00119
00120 inline bool operator ==(const ProgrammerNum &a, const ProgrammerNum &b)
00121 {
00122 return(a.num == b.num);
00123 }
00124
00125 inline int ProgrammerNum::IsEqual(const Object &b) const
00126 {
00127 const ProgrammerNum *pnp = (const ProgrammerNum *)(&b);
00128
00129 return(*this == *pnp);
00130 }
00131
00132 inline const ClassIdent *ProgrammerNum::i_GetIdent() const
00133 {
00134 return(&identifier);
00135 }
00136
00137 inline int ProgrammerNum::AreYouA(const ClassIdent &cid) const
00138 {
00139 return ((identifier == cid) || Object::AreYouA(cid));
00140 }
00141
00142
00143
00144 inline bool operator ==(const ClassNum &a, const ClassNum &b)
00145 {
00146 return(a.num == b.num);
00147 }
00148
00149 inline int ClassNum::IsEqual(const Object &b) const
00150 {
00151 const ClassNum *pnp = (const ClassNum *)(&b);
00152
00153 return(*this == *pnp);
00154 }
00155
00156 inline const ClassIdent *ClassNum::i_GetIdent() const
00157 {
00158 return(&identifier);
00159 }
00160
00161 inline int ClassNum::AreYouA(const ClassIdent &cid) const
00162 {
00163 return ((identifier == cid) || Object::AreYouA(cid));
00164 }
00165
00166
00167
00168 inline bool operator ==(const ClassIdent &a, const ClassIdent &b)
00169 {
00170 return((&a == &b) || ((a.clnum == b.clnum) && (a.prnum == b.prnum)));
00171 }
00172
00173 inline int ClassIdent::IsEqual(const Object &b) const
00174 {
00175 const ClassIdent *pnp = (const ClassIdent *)(&b);
00176
00177 return(*this == *pnp);
00178 }
00179
00180 inline const ClassIdent *ClassIdent::i_GetIdent() const
00181 {
00182 return(&identifier);
00183 }
00184
00185 inline ClassIdent::ClassIdent(const ProgrammerNum &pn, const ClassNum &cn) :
00186 prnum(pn), clnum(cn)
00187 {
00188 }
00189
00190 inline int ClassIdent::AreYouA(const ClassIdent &cid) const
00191 {
00192 return ((identifier == cid) || Object::AreYouA(cid));
00193 }
00194
00195 }
00196 }
00197
00198 #endif // End of include check for LCore/Object.h
00199 #endif // End double inclusion guard ifdef