* *
****************************************************************************/
-#ifndef _FAMILIA_MARRIAGE_H
-#define _FAMILIA_MARRIAGE_H
+#ifndef _FAMILIA_FAMILY_H
+#define _FAMILIA_FAMILY_H
#include "individual.h"
/** 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;
};
/**
/**
* 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
*/
* @parameter family to set the individual
* @parameter individual which will be set
*/
-void familia_family_set_individual(struct familia_family * family, struct familia_individual * individual, enum FFamilyIndividualIndex index);
+void familia_family_set_parent(struct familia_family * family, struct familia_individual * individual, enum FFamilyIndividualIndex index);
/**
* Gets individual from the given family
* @parameter family to get the individual
* @parameter individual index of which individual get
*/
-struct familia_individual * familia_family_get_individual(struct familia_family * family, enum FFamilyIndividualIndex index);
+struct familia_individual * familia_family_get_parent(struct familia_family * family, enum FFamilyIndividualIndex index);
/**
* 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_parent(struct familia_family * family, enum FFamilyIndividualIndex index);
+
+/**
+ * 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_individual(struct familia_family * family, enum FFamilyIndividualIndex index);
+struct familia_individual * familia_family_remove_child_by_id(struct familia_family * family, unsigned short index);
-#endif /*_FAMILIA_MARRIAGE_H */
+#endif /*_FAMILIA_FAMILY_H */