-
Notifications
You must be signed in to change notification settings - Fork 1
/
fam.h
83 lines (78 loc) · 1.67 KB
/
fam.h
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
#ifndef FAM_H
#define FAM_H
#include "indi.h"
#include <vector>
#include <string>
class Indi;
class Fam {
private:
std::string uniqueID_;
int husb_;
int wife_;
std::vector< int > chil_;
int marr_[3];
int div_[3];
public:
Fam() {
uniqueID_ = "";
husb_ = -1;
wife_ = -1;
chil_.clear();
for (int i = 0; i < 3; ++i) {
marr_[i] = 0;
div_[i] = 0;
}
}
// Setters:
inline void set_id (std::string n) {
this->uniqueID_ = n;
}
void set_marr (int d, int m, int y) {
this->marr_[0] = d;
this->marr_[1] = m;
this->marr_[2] = y;
}
inline void set_husb (int h) {
this->husb_ = h;
}
inline void set_wife (int w) {
this->wife_ = w;
}
void set_div (int d, int m, int y) {
this->div_[0] = d;
this->div_[1] = m;
this->div_[2] = y;
}
// Getters:
inline std::string get_id () {
return this->uniqueID_;
}
inline int * get_marr () {
return this->marr_;
}
inline int get_husb () {
return this->husb_;
}
inline int get_wife () {
return this->wife_;
}
std::vector< int > get_chil () {
return this->chil_;
}
inline int * get_div () {
return this->div_;
}
// Other functions
inline void add_chil (int c) {
(this->chil_).push_back(c);
}
bool checkChild(int childID) {
for (std::vector<int>::iterator it = chil_.begin(); it != chil_.end(); ++it) {
if (*it == childID) {
return true;
}
}
return false;
}
};
#endif /* Fam */