DictObjCont.h
Go to the documentation of this file.
/*$$FILE$$*/
/*$$VERSION$$*/
/*$$DATE$$*/
/*$$LICENSE$$*/
#ifndef DICTOBJCONT_H
#define DICTOBJCONT_H
#include <rcsb/mapped_ptr_vector.h>
#include <rcsb/mapped_ptr_vector.C>
#include <rcsb/DictObjContInfo.h>
#include <rcsb/DicFile.h>
class ObjCont
{
public:
ObjCont(Serializer& ser, DicFile& dicFile, const string& blockName,
const string& id, const ObjContInfo& objContInfo);
virtual ~ObjCont();
void Init();
const string& GetName() const;
virtual void Read(UInt32 which, unsigned int Index = 0);
virtual UInt32 Write();
const vector<string>& GetAttribute(const string& catName,
const string& itemName) const;
void Print() const;
void SetVerbose(bool verbose);
virtual void Build();
protected:
Serializer& _ser;
DicFile& _dicFile;
const ObjContInfo& _objContInfo;
string _blockName;
string _id;
bool _verbose;
vector<UInt32> _index;
vector<vector<vector<string> > > _itemsStore;
virtual void BuildItems(vector<vector<string> >& combo,
const unsigned int configIndex);
void BuildItems(vector<vector<string> >& combo,
const unsigned int configIndex, const string& value);
private:
void ReadItem(const pair<unsigned int, unsigned int>& indexPair,
unsigned int Index);
};
class ItemObjCont : public ObjCont
{
public:
ItemObjCont(Serializer& ser, DicFile& dicFile,
const string& blockName, const string& itemName);
~ItemObjCont();
void Build();
private:
vector<string> _decendency;
void GetItemDecendency();
void BuildItems(vector<vector<string> >& combo,
const unsigned int configIndex);
};
class DictObjCont : public ObjCont
{
public:
DictObjCont(Serializer& ser, DicFile& dicFile,
const string& blockName);
~DictObjCont();
void Build();
UInt32 Write();
void Read(UInt32 which, unsigned int Index = 0);
const ObjCont& GetObjCont(const string& contName,
const ObjContInfo& objContInfo) const;
void Print();
private:
mutable mapped_ptr_vector<ObjCont> _items;
mutable mapped_ptr_vector<ObjCont> _subcategories;
mutable mapped_ptr_vector<ObjCont> _categories;
DictObjCont(const DictObjCont& dictObjCont);
DictObjCont& operator=(const DictObjCont& inDictObjCont);
UInt32 WriteContLocations(const vector<UInt32>& indices);
void BuildContainers(unsigned int index, const string& catName,
const string& itemName, mapped_ptr_vector<ObjCont>& containers);
void BuildItems(vector<vector<string> >& combo,
const unsigned int configIndex);
ObjCont& GetContainers(const string& contName,
mapped_ptr_vector<ObjCont>& containers, const ObjContInfo& objContInfo)
const;
void PrintContainers(const string& catName,
const string& itemName, const ObjContInfo& objContInfo);
};
#endif // DICTOBJCONT_H