Added debugging code for dumping data from memory using GUI.
[familia.git] / src / storage / family.h
index d3691673a6b17cfd98a02df4f0d923487c60d885..50fb19cfb8757e5debda2424b568b5664a315eb3 100644 (file)
@@ -17,8 +17,8 @@
  *                                                                          *
  ****************************************************************************/
 
-#ifndef _FAMILIA_MARRIAGE_H
-#define _FAMILIA_MARRIAGE_H
+#ifndef _FAMILIA_FAMILY_H
+#define _FAMILIA_FAMILY_H
 
 #include "individual.h"
 
@@ -39,6 +39,12 @@ struct familia_family {
 
        /** Second individual of family */
        struct familia_individual * individual2;
+
+       /** Children of this family */
+       struct familia_individual ** children;
+
+       /** Number of children of this family */
+       unsigned short children_no;
 };
 
 /**
@@ -50,7 +56,7 @@ struct familia_family * familia_family_new();
 
 /**
  * Frees allocated memory of the given family
- * DISCLAIMER! This function does not remove linked individuals. You have to
+ * DISCLAIMER! This function does not free memory of linked individuals. You have to
  * remove them manually from storage.
  * @parameter individual free
  */
@@ -72,11 +78,42 @@ struct familia_individual * familia_family_get_individual(struct familia_family
 
 /**
  * Removes individual from the given family
- * DISCLAIMER! This function does not remove linked individuals. You have to
+ * DISCLAIMER! This function does not free memory of linked individuals. You have to
  * remove them manually from storage.
  * @parameter family to remove the individual
  * @parameter individual index of which individual to remove
+ * @return returns removed individual, NULL if such does not exist.
  */
 struct familia_individual * familia_family_remove_individual(struct familia_family * family, enum FFamilyIndividualIndex index);
 
-#endif /*_FAMILIA_MARRIAGE_H */
+/**
+ * Adds new child in the given family
+ * Automatically sets family as parents in individual variable.
+ *
+ * @parameter family to set the individual
+ * @parameter individual which will be added
+ */
+void familia_family_add_child(struct familia_family * family, struct familia_individual * individual);
+
+/**
+ * Gets the nth child from the given family
+ * Child with index = 0 is the oldest. Bigger the index, the child is younger
+ * @parameter family to get the child
+ * @parameter individual index of which individual get
+ * @return selected child. If index is bigger than child_no of the family
+ *         returns NULL.
+ */
+struct familia_individual * familia_family_get_child_by_id(struct familia_family * family, unsigned short index);
+
+/**
+ * Removes child from the given family
+ * DISCLAIMER! This function does not free memory of linked children. You have to
+ * remove them manually from storage.
+ * @parameter family to remove the child
+ * @parameter index of which child should be removed
+ * @return removed child. If such does not exist or index is bigger than child_no
+ *         of the family, returns NULL.
+ */
+struct familia_individual * familia_family_remove_child_by_id(struct familia_family * family, unsigned short index);
+
+#endif /*_FAMILIA_FAMILY_H */