00001
00002
00003
00004
00005
00006
00014 #ifndef DICTOBJCONT_H
00015 #define DICTOBJCONT_H
00016
00017
00018 #include "mapped_ptr_vector.h"
00019 #include "mapped_ptr_vector.C"
00020
00021 #include "DictObjContInfo.h"
00022 #include "DdlFile.h"
00023 #include "DicFile.h"
00024
00025
00036 class ObjCont
00037 {
00038 public:
00043 ObjCont(Serializer& ser, DicFile& dicFile, const string& blockName,
00044 const string& id, const ObjContInfo& objContInfo);
00045
00050 virtual ~ObjCont();
00051
00056 void Init();
00057
00062 string GetName();
00063
00068 virtual void Read(UInt32 which, unsigned int Index = 0);
00069
00074 virtual UInt32 Write();
00075
00094 const vector<string>& GetAttribute(const string& catName,
00095 const string& itemName) const;
00096
00110 void Print() const;
00111
00116 void SetVerbose(bool verbose);
00117
00122 virtual void Build();
00123
00124 protected:
00125 Serializer& _ser;
00126
00127 DicFile& _dicFile;
00128
00129 const ObjContInfo& _objContInfo;
00130
00131 string _blockName;
00132 string _id;
00133
00134 bool _verbose;
00135
00136 vector<UInt32> _index;
00137
00138 vector<vector<vector<string> > > _itemsStore;
00139
00140 virtual void BuildItems(vector<vector<string> >& combo,
00141 const unsigned int configIndex);
00142 void BuildItems(vector<vector<string> >& combo,
00143 const unsigned int configIndex, const string& value);
00144
00145 private:
00146 void ReadItem(const pair<unsigned int, unsigned int>& indexPair,
00147 unsigned int Index);
00148 };
00149
00150
00160 class ItemObjCont : public ObjCont
00161 {
00162 public:
00167 ItemObjCont(Serializer& ser, DicFile& dicFile,
00168 const string& blockName, const string& itemName);
00169
00174 ~ItemObjCont();
00175
00180 void Build();
00181
00182 private:
00188 typedef struct
00189 {
00190 string name;
00191 int generation;
00192 } family_member;
00193
00194
00195 vector<family_member> _decendency;
00196
00197 void GetItemDecendency(vector<family_member>& decendency);
00198
00199 void BuildItems(vector<vector<string> >& combo,
00200 const unsigned int configIndex);
00201 };
00202
00203
00215 class DictObjCont : public ObjCont
00216 {
00217 public:
00222 DictObjCont(Serializer& ser, const string& blockName);
00223
00228 DictObjCont(Serializer& ser, DicFile& dicFile,
00229 const string& blockName);
00230
00235 ~DictObjCont();
00236
00241 void Build();
00242
00247 UInt32 Write();
00248
00253 void Read(UInt32 which, unsigned int Index = 0);
00254
00277 const ObjCont& GetObjCont(const string& contName,
00278 const ObjContInfo& objContInfo);
00279
00295 void Print();
00296
00297 private:
00298 mapped_ptr_vector<ObjCont> _items;
00299 mapped_ptr_vector<ObjCont> _subcategories;
00300 mapped_ptr_vector<ObjCont> _categories;
00301
00302 DictObjCont(const DictObjCont& dictObjCont);
00303 DictObjCont& operator=(const DictObjCont& inDictObjCont);
00304
00305 void Init();
00306
00307 UInt32 WriteContLocations(const vector<UInt32>& indices);
00308
00309 void BuildContainers(unsigned int index, const string& catName,
00310 const string& itemName, mapped_ptr_vector<ObjCont>& containers);
00311
00312 void BuildItems(vector<vector<string> >& combo,
00313 const unsigned int configIndex);
00314
00315 ObjCont& GetContainers(const string& contName,
00316 mapped_ptr_vector<ObjCont>& containers, const ObjContInfo& objContInfo);
00317
00318 void PrintContainers(const string& catName,
00319 const string& itemName, const ObjContInfo& objContInfo);
00320 };
00321
00322
00323 #endif // DICTOBJCONT_H
00324