librcsb-core-wrapper  1.000
DictObjCont.h
Go to the documentation of this file.
1 /*$$FILE$$*/
2 /*$$VERSION$$*/
3 /*$$DATE$$*/
4 /*$$LICENSE$$*/
5 
6 
14 #ifndef DICTOBJCONT_H
15 #define DICTOBJCONT_H
16 
17 
18 #include <rcsb/mapped_ptr_vector.h>
19 #include <rcsb/mapped_ptr_vector.C>
20 
21 #include <rcsb/DictObjContInfo.h>
22 #include <rcsb/DicFile.h>
23 
24 
35 class ObjCont
36 {
37  public:
42  ObjCont(Serializer& ser, DicFile& dicFile, const string& blockName,
43  const string& id, const ObjContInfo& objContInfo);
44 
49  virtual ~ObjCont();
50 
55  void Init();
56 
60  const string& GetName() const;
61 
66  virtual void Read(UInt32 which, unsigned int Index = 0);
67 
72  virtual UInt32 Write();
73 
92  const vector<string>& GetAttribute(const string& catName,
93  const string& itemName) const;
94 
108  void Print() const;
109 
114  void SetVerbose(bool verbose);
115 
120  virtual void Build();
121 
122  protected:
124 
126 
128 
129  string _blockName;
130  string _id;
131 
132  bool _verbose;
133 
134  vector<UInt32> _index;
135 
136  vector<vector<vector<string> > > _itemsStore;
137 
138  virtual void BuildItems(vector<vector<string> >& combo,
139  const unsigned int configIndex);
140  void BuildItems(vector<vector<string> >& combo,
141  const unsigned int configIndex, const string& value);
142 
143  private:
144  void ReadItem(const pair<unsigned int, unsigned int>& indexPair,
145  unsigned int Index);
146 };
147 
148 
158 class ItemObjCont : public ObjCont
159 {
160  public:
165  ItemObjCont(Serializer& ser, DicFile& dicFile,
166  const string& blockName, const string& itemName);
167 
172  ~ItemObjCont();
173 
178  void Build();
179 
180  private:
181  vector<string> _decendency;
182 
183  void GetItemDecendency();
184 
185  void BuildItems(vector<vector<string> >& combo,
186  const unsigned int configIndex);
187 };
188 
189 
201 class DictObjCont : public ObjCont
202 {
203  public:
208  DictObjCont(Serializer& ser, DicFile& dicFile,
209  const string& blockName);
210 
215  ~DictObjCont();
216 
221  void Build();
222 
227  UInt32 Write();
228 
233  void Read(UInt32 which, unsigned int Index = 0);
234 
257  const ObjCont& GetObjCont(const string& contName,
258  const ObjContInfo& objContInfo) const;
259 
275  void Print();
276 
277  private:
278  mutable mapped_ptr_vector<ObjCont> _items;
279  mutable mapped_ptr_vector<ObjCont> _subcategories;
280  mutable mapped_ptr_vector<ObjCont> _categories;
281 
282  DictObjCont(const DictObjCont& dictObjCont);
283  DictObjCont& operator=(const DictObjCont& inDictObjCont);
284 
285  UInt32 WriteContLocations(const vector<UInt32>& indices);
286 
287  void BuildContainers(unsigned int index, const string& catName,
288  const string& itemName, mapped_ptr_vector<ObjCont>& containers);
289 
290  void BuildItems(vector<vector<string> >& combo,
291  const unsigned int configIndex);
292 
293  ObjCont& GetContainers(const string& contName,
294  mapped_ptr_vector<ObjCont>& containers, const ObjContInfo& objContInfo)
295  const;
296 
297  void PrintContainers(const string& catName,
298  const string& itemName, const ObjContInfo& objContInfo);
299 };
300 
301 
302 #endif // DICTOBJCONT_H
303