librcsb-core-wrapper  1.000
ParentChild.h
Go to the documentation of this file.
1 //$$FILE$$
2 //$$VERSION$$
3 //$$DATE$$
4 //$$LICENSE$$
5 
6 
14 #ifndef PARENTCHILD_H
15 #define PARENTCHILD_H
16 
17 
18 #include <string>
19 #include <vector>
20 #include <map>
21 
22 #include <rcsb/ISTable.h>
23 
24 
26 {
27  public:
28  ParentChild();
29  virtual ~ParentChild();
30 
31  const std::vector<std::vector<std::string> >&
32  GetComboKeys(const std::string& catName);
33 
34  std::vector<std::vector<std::vector<std::string> > >&
35  GetChildrenKeys(const std::vector<std::string>& parComboKey);
36 
37  void GetParents(std::vector<std::vector<std::string> >& parParKeys,
38  std::vector<std::vector<std::string> >& comboComboKeys,
39  const std::string& childCat);
40 
41  void GetLinkGroupIdLabel(std::string& linkGroupIdLabel,
42  const std::vector<std::string>& parKeys,
43  const std::vector<std::string>& childKeys);
44 
45  bool IsParKeyPresent(const std::vector<std::string>& parKey,
46  const std::string& childCatName);
47 
48  bool IsInParentComboKeys(const std::string& itemName);
49 
52 
53  protected:
54  // Maps parent category name to its combo keys.
55  std::map<std::string, std::vector<std::vector<std::string> > >
57 
58  // Maps parent combo keys to children combo keys.
59  std::map<std::vector<std::string>,
60  std::vector<std::vector<std::vector<std::string> > > > _relations;
61 
62  void GetComboKeys(const std::string& parCatName,
63  const unsigned int maxKeyGroup, ISTable& keysTable,
64  std::vector<std::vector<std::string> >& comboKeys,
65  std::vector<std::string>& parKeys);
66 
67  virtual void GetParentCifItems(std::vector<std::string>& parCifItems,
68  const std::string& cifItemName) = 0;
69 
70  void AddParentCategoryToItemLinkedGroup(ISTable& itemLinkedGroup,
71  ISTable& itemLinkedGroupList);
72 
73  void CreateAllRelations(ISTable& itemLinkedGroup,
74  ISTable& itemLinkedGroupList);
75 
76  void ISTableFindPairs(std::map<std::string,
77  std::vector<std::vector<std::string> > >& childrenKeys,
78  const std::vector<std::string>& parKeys, ISTable& itemLinkedGroupList);
79 
80  void UpdateMap(std::map<std::string,
81  std::vector<std::vector<std::string> > >& childrenKeys,
82  const std::string& childCat, std::vector<std::string>& childKeys);
83 
84  void UpdateParComboKeys(const std::string& parName,
85  std::vector<std::string>& parKeys);
86 
87  void UpdateRelations(std::vector<std::string>& parKeys,
88  std::vector<std::vector<std::string> >& comboKeys);
89 
90  bool KeysMatch(const std::vector<std::string>& firstKey,
91  const std::vector<std::string>& secondKey);
92 };
93 
94 
95 #endif
96