X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=src%2Fstorage%2Ffamily.h;h=a8dc2fd95b4079443c75aa2ee255e9b3a37042d2;hb=9c12f0411c31e96fd1c5bd11fb2b6362dc65fdab;hp=d3691673a6b17cfd98a02df4f0d923487c60d885;hpb=094bc471373afa79a63c024909d57261fef00b2f;p=familia.git diff --git a/src/storage/family.h b/src/storage/family.h index d369167..a8dc2fd 100644 --- a/src/storage/family.h +++ b/src/storage/family.h @@ -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,40 @@ 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 + * @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 */