Automatically set parent family in individual, when adding child to the family.
[familia.git] / src / memory_stack.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_MEMORY_STACK_H
21 #define _FAMILIA_MEMORY_STACK_H
22
23 /**
24  * @file memory_stack.h
25  * @brief API for communication of file parsers with Familia application.
26  */
27
28 /**
29  * Initializes memory stack for communication with the storage.
30  */
31 void familia_memory_stack_init();
32
33 /**
34  * Releases memory stack. Any additional resources will be freed. Data pointed
35  * to the storage objects, will stay as it is managed by storage itself.
36  */
37 void familia_memory_stack_free();
38
39 /**
40  * Helper function for displaying current state of memory stack. Data is passed
41  * to the stderr.
42  */
43 void familia_memory_stack_dump();
44
45 /**
46  * Searches memory for the object with the given key. If object does not exists,
47  * creates it and returns. If NULL will be returned this means that there was a
48  * problem with allocating memory.
49  * @param xref_key string under which the object will be found.
50  * @param type type of the object. It is used to properly allocate object.
51  * @return Pointer to found object, or newly created object of the given type.
52  *         Object is allocated in the application storage and should not be
53  *         free'd.
54  */
55 void * familia_memory_stack_find(char *xref_key, enum familia_storage_type type);
56
57 #endif /* _FAMILIA_MEMORY_STACK_H */