Containers are data types that hold data and allow iteration over their elements with an Iterator Functions, or eventually an Accessor Functions. More...
Modules | |
Array | |
These functions provide array management. | |
Compact List | |
Eina_Clist is a compact (inline) list implementation. | |
Hash Table | |
Hash table management. | |
Inline Array | |
Inline array is a container that stores the data itself not pointers to data, this means there is no memory fragmentation, also for small data types(such as char, short, int, etc.) it's more memory efficient. | |
Inline List | |
These functions provide inline list management. | |
List | |
These functions provide double linked list management. | |
Sparse Matrix | |
These functions provide matrix sparse management. | |
Red-Black tree | |
These functions provide Red-Black trees management. | |
Trash | |
Generic Value Storage | |
Abstracts generic data storage and access to it in an extensible and efficient way. |
Detailed Description
Containers are data types that hold data and allow iteration over their elements with an Iterator Functions, or eventually an Accessor Functions.
The containers in eina are designed with performance in mind, one consequence of this is that they don't check the validity of data structures given to them(Magic).
The choice of which container to use in each situation is very important in achieving good performance and readable code. The most common container types to be used are:
- List
- Inline list
- Array
- Inline array
- Hash
All types have virtues and vices. The following considerations are good starting point in deciding which container to use:
- Hashes are appropriate for datasets which will be searched often;
- arrays are good when accessing members by position;
- lists provide good versatility for adding elements in any position with minimal overhead;
- inline arrays use very little memory and don't cause fragmentation and therefore are a good option in memory constrained systems;
- inline lists are the appropriate type to use when the flexibility of a list is required but the overhead of pointer indirection is not acceptable.
- Warning
- These are general considerations, every situation is different, don't follow these recommendations blindly.