File: ParentChild.h

package info (click to toggle)
librcsb-core-wrapper 1.005-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,576 kB
  • sloc: xml: 122,915; cpp: 25,250; ansic: 3,736; makefile: 1,033; sh: 772; lex: 294; yacc: 235; perl: 213; python: 121; csh: 30
file content (96 lines) | stat: -rw-r--r-- 2,670 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//$$FILE$$
//$$VERSION$$
//$$DATE$$
//$$LICENSE$$


/*!
** \file ParentChild.h
**
** \brief Header file for ParentChild class.
*/


#ifndef PARENTCHILD_H
#define PARENTCHILD_H


#include <string>
#include <vector>
#include <map>

#include "ISTable.h"


class ParentChild
{
  public:
    ParentChild();
    virtual ~ParentChild();

    const std::vector<std::vector<std::string> >&
      GetComboKeys(const std::string& catName);

    std::vector<std::vector<std::vector<std::string> > >&
      GetChildrenKeys(const std::vector<std::string>& parComboKey);

    void GetParents(std::vector<std::vector<std::string> >& parParKeys,
      std::vector<std::vector<std::string> >& comboComboKeys,
      const std::string& childCat);

    void GetLinkGroupIdLabel(std::string& linkGroupIdLabel,
      const std::vector<std::string>& parKeys,
      const std::vector<std::string>& childKeys);

    bool IsParKeyPresent(const std::vector<std::string>& parKey,
      const std::string& childCatName);

    bool IsInParentComboKeys(const std::string& itemName);

    ISTable* _groupTableP;
    ISTable* _groupListTableP;

  protected:
    // Maps parent category name to its combo keys.
    std::map<std::string, std::vector<std::vector<std::string> > >
      _parComboKeys;

    // Maps parent combo keys to children combo keys.
    std::map<std::vector<std::string>,
      std::vector<std::vector<std::vector<std::string> > > > _relations;

    void GetComboKeys(const std::string& parCatName,
      const unsigned int maxKeyGroup, ISTable& keysTable, 
      std::vector<std::vector<std::string> >& comboKeys,
      std::vector<std::string>& parKeys);

    virtual void GetParentCifItems(std::vector<std::string>& parCifItems,
      const std::string& cifItemName) = 0;

    void AddParentCategoryToItemLinkedGroup(ISTable& itemLinkedGroup,
      ISTable& itemLinkedGroupList);

    void CreateAllRelations(ISTable& itemLinkedGroup,
      ISTable& itemLinkedGroupList);

    void ISTableFindPairs(std::map<std::string,
      std::vector<std::vector<std::string> > >& childrenKeys,
      const std::vector<std::string>& parKeys, ISTable& itemLinkedGroupList);

    void UpdateMap(std::map<std::string,
      std::vector<std::vector<std::string> > >& childrenKeys,
      const std::string& childCat, std::vector<std::string>& childKeys);

    void UpdateParComboKeys(const std::string& parName,
      std::vector<std::string>& parKeys);

    void UpdateRelations(std::vector<std::string>& parKeys,
      std::vector<std::vector<std::string> >& comboKeys);

    bool KeysMatch(const std::vector<std::string>& firstKey,
      const std::vector<std::string>& secondKey);
};


#endif