00001
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 #ifndef INC_MI32_DBSCHEMA_H
00036 #define INC_MI32_DBSCHEMA_H
00037
00038 #ifndef INC_MI32_ELEMTYPE_H
00039 #include <mi32/elemtype.h>
00040 #endif
00041
00042 #ifndef INC_MI32_MILIST_H
00043 #include <mi32/milist.h>
00044 #endif
00045
00046 #ifndef INC_MI32_ENUMSET_H
00047 #include <mi32/enumset.h>
00048 #endif
00049
00050 #ifndef INC_MI32_SIMPLEAR_H
00051 #include <mi32/simplear.h>
00052 #endif
00053
00054 #ifndef INC_RVC_DESCRIPTOR_H
00055 #include <rvc/descriptor.h>
00056 #endif
00057
00058
00059 #ifndef GENERATING_DOXYGEN_OUTPUT
00060 class FILEPATH;
00061 class XMLDOC;
00062 #endif
00063
00064
00065 namespace DBSCHEMA {
00066 class CATALOG;
00067 class OBJECT;
00068
00069
00070 struct ATTRIBUTE_ENUMVAL {
00071 int m_num;
00072 int m_unitid;
00073 bool m_bObsolete;
00074 MISTRING m_text;
00075 MISTRING m_desc;
00076 };
00077
00078
00079
00080
00081 class ATTRIBUTE {
00082 public:
00083 enum TYPE {
00084 TYPE_Enum = 'E',
00085 TYPE_Float = 'F',
00086 TYPE_List = 'L',
00087 TYPE_ListUnique = 'U',
00088 TYPE_Int = 'I',
00089 TYPE_CodedString = 'A',
00090 TYPE_FreeText = 'S',
00091 };
00092
00093
00094 enum CLASS {
00095 CLASS_F = 'F',
00096 CLASS_N = 'N',
00097 CLASS_S = 'S',
00098 CLASS_Dollar = '$',
00099 };
00100
00101 ATTRIBUTE (
00102 const MISTRINGLIST& parts
00103 );
00104
00105 ATTRIBUTE (
00106 );
00107
00108 ~ATTRIBUTE (
00109 );
00110
00111 CLASS GetClass (
00112 ) const { return m_Class; }
00113
00114 const RVC::DESCRIPTOR& GetDescriptor (
00115 ) const { return m_Descriptor; }
00116
00117 const MILIST<ATTRIBUTE_ENUMVAL>& GetEnumValues (
00118 ) const { return m_EnumValues; }
00119
00120 int GetIDNum (
00121 ) const { return m_num; }
00122
00123 double GetMaxVal (
00124 ) const { return m_MaxVal; }
00125
00126 double GetMinVal (
00127 ) const { return m_MinVal; }
00128
00129 TYPE GetType (
00130 ) const { return m_Type; }
00131
00132 const MISTRING& GetFormat (
00133 ) const { return m_format; }
00134
00135 int GetMeasureID (
00136 ) const { return m_MeasureNum; }
00137
00138 int GetUnitID (
00139 ) const { return m_UnitNum; }
00140
00141 const MISTRING& GetUnitName (
00142 ) const { return m_UnitName; }
00143
00144 private:
00145 int m_num;
00146 RVC::DESCRIPTOR m_Descriptor;
00147 char m_acronym[8];
00148 MISTRING m_format;
00149 int m_MeasureNum;
00150 int m_UnitNum;
00151 CLASS m_Class;
00152 TYPE m_Type;
00153 double m_MinVal;
00154 double m_MaxVal;
00155 MILIST<ATTRIBUTE_ENUMVAL> m_EnumValues;
00156 MISTRING m_UnitName;
00157 friend class CATALOG;
00158 };
00159
00160
00161
00162
00163 class OBJECT_CLASS {
00164 public:
00165 OBJECT_CLASS();
00166 ~OBJECT_CLASS();
00167
00168 bool IsRestrictedByElemType (
00169 ) const { return m_bIsRestrictedByElemType; }
00170
00171 const RVC::DESCRIPTOR& GetDescriptor (
00172 ) const { return m_Descriptor; }
00173
00174 private:
00175 RVC::DESCRIPTOR m_Descriptor;
00176 bool m_bIsRestrictedByElemType;
00177
00178 friend class CATALOG;
00179 };
00180
00181
00182 class OBJECT {
00183 public:
00184
00185 OBJECT (
00186 const CATALOG*
00187 );
00188
00189 ~OBJECT (
00190 );
00191
00194 const SIMPLE_ARRAY<const ATTRIBUTE*>& GetAttributeGroup (
00195 int num
00196 ) const { return m_AttributeGroup[num]; }
00197
00199 const CATALOG* GetCatalog (
00200 ) const { return m_Catalog; }
00201
00203 const OBJECT_CLASS& GetClass (
00204 ) const { return *m_Class; }
00205
00207 const RVC::DESCRIPTOR& GetDescriptor (
00208 ) const { return m_Descriptor; }
00209
00210 int GetIDNum (
00211 ) const { return m_num; }
00212
00214 bool IsForElementType (
00215 ELEMTYPE ElemType
00216 ) const { return m_ElemTypes.Contains(ElemType); }
00217
00218 private:
00219 char m_acronym[8];
00220 int m_num;
00221 const OBJECT_CLASS* m_Class;
00222 RVC::DESCRIPTOR m_Descriptor;
00223 ENUMSET<ELEMTYPE, ELEMTYPE_NumTypes> m_ElemTypes;
00224 SIMPLE_ARRAY<const ATTRIBUTE*> m_AttributeGroup[3];
00225 const CATALOG* m_Catalog;
00226
00227 friend class CATALOG;
00228 };
00229
00230
00231 class CATALOG {
00232 public:
00233 CATALOG();
00234 ~CATALOG();
00235
00236 const ATTRIBUTE* FindAttribute (
00237 const char* acronym
00238 ) const;
00239
00240 const ATTRIBUTE* FindAttribute (
00241 int num
00242 ) const;
00243
00244 const OBJECT* FindObject (
00245 const char* acronym
00246 ) const;
00247
00248 const OBJECT* FindObject (
00249 int num
00250 ) const;
00251
00252 const RVC::DESCRIPTOR& GetDescriptor (
00253 ) const { return m_Descriptor; }
00254
00255 const SIMPLE_ARRAY<OBJECT_CLASS*>& GetObjectClasses (
00256 ) const { return m_ObjectClasses; }
00257
00258 const SIMPLE_ARRAY<OBJECT*>& GetObjects (
00259 ) const { return m_ObjectTypes; }
00260
00261 ERRVALUE GetXML (
00262 XMLDOC& doc
00263 );
00264
00265 ERRVALUE ReadFromReferenceFiles();
00266
00267 ERRVALUE Read (
00268 const XMLDOC& doc
00269 );
00270
00271 ERRVALUE Read (
00272 const FILEPATH& filepath
00273 );
00274
00275 private:
00276 SIMPLE_ARRAY<OBJECT_CLASS*> m_ObjectClasses;
00277 SIMPLE_ARRAY<ATTRIBUTE*> m_AttributeTypes;
00278 SIMPLE_ARRAY<OBJECT*> m_ObjectTypes;
00279 RVC::DESCRIPTOR m_Descriptor;
00280
00281 ATTRIBUTE* FindAttribute (
00282 const MISTRING& code
00283 );
00284
00285 OBJECT* FindObject (
00286 const MISTRING& code
00287 );
00288
00289
00290 void SetAttributes (
00291 SIMPLE_ARRAY<const ATTRIBUTE*>& AttributeGroup,
00292 const MISTRING&mistr
00293 );
00294
00295 };
00296
00297
00298 }
00299
00300 #endif // INC_MI32_DBSCHEMA_H