More generic use of event.
[familia.git] / storage / family.h
1 /****************************************************************************
2  *  Familia Lignum - Genealogical program                                   *
3  *  Copyright (C) 2011-2012 Rafał Długołęcki <rafal@dlugolecki.net.pl>      *
4  *                                                                          *
5  *  This program is free software; you can redistribute it and/or modify    *
6  *  it under the terms of the GNU General Public License as published by    *
7  *  the Free Software Foundation; version 2 of the License.                 *
8  *                                                                          *
9  *  This program is distributed in the hope that it will be useful,         *
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of          *
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
12  *  GNU General Public License for more details.                            *
13  *                                                                          *
14  *  You should have received a copy of the GNU General Public License along *
15  *  with this program; if not, write to the Free Software Foundation, Inc., *
16  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.             *
17  *                                                                          *
18  ****************************************************************************/
19
20 #ifndef _FAMILIA_MARRIAGE_H
21 #define _FAMILIA_MARRIAGE_H
22
23 #include "individual.h"
24
25 enum FFamilyIndividualIndex {
26         Individual1,
27         Individual2
28 };
29
30 /**
31  * Structure holding family data.
32  */
33 struct familia_family {
34         /** Marriage identifier */
35         unsigned int id;
36
37         /** First individual of family */
38         struct familia_individual * individual1;
39
40         /** Second individual of family */
41         struct familia_individual * individual2;
42 };
43
44 /**
45  * Creates new family structure
46  * @return Newly allocated individual.If allocation failed, returns NULL, like
47  *         malloc.
48  */
49 struct familia_family * familia_family_new();
50
51 /**
52  * Frees allocated memory of the given family
53  * DISCLAIMER! This function does not remove linked individuals. You have to
54  * remove them manually from storage.
55  * @parameter individual free
56  */
57 void familia_family_free(struct familia_family * family);
58
59 /**
60  * Sets individual1 in the given family
61  * @parameter family to set the individual
62  * @parameter individual which will be set
63  */
64 void familia_family_set_individual(struct familia_family * family, struct familia_individual * individual, enum FFamilyIndividualIndex index);
65
66 /**
67  * Gets individual from the given family
68  * @parameter family to get the individual
69  * @parameter individual index of which individual get
70  */
71 struct familia_individual * familia_family_get_individual(struct familia_family * family, enum FFamilyIndividualIndex index);
72
73 /**
74  * Removes individual from the given family
75  * DISCLAIMER! This function does not remove linked individuals. You have to
76  * remove them manually from storage.
77  * @parameter family to remove the individual
78  * @parameter individual index of which individual to remove
79  */
80 struct familia_individual * familia_family_remove_individual(struct familia_family * family, enum FFamilyIndividualIndex index);
81
82 #endif /*_FAMILIA_MARRIAGE_H */