Ion C
C library for Ion
|
#include <ion_collection.h>
Data Fields | |
void * | _owner |
int32_t | _node_size |
int32_t | _count |
ION_COLLECTION_NODE * | _head |
ION_COLLECTION_NODE * | _tail |
ION_COLLECTION_NODE * | _freelist |
The collections used by the parser are linked lists which are managed by the collection header. the memory used for the nodes is allocated on the parent, which is passed in when the user initializes the collection
the nodes in the list have a user sized data buffer, which is expected to a small struct (like ion string) or a scaler (like an int or pointer).
the push, pop, and append routines return the address of this data buffer - for push and append it is the buffer of the new node for pop it is the buffer of the released node - which is still allocated and is, therefore, good UNTIL ANOTHER push or append or copy is executed against the containing collection.
each collections holds a high water mark free list of nodes that were previously used but aren't currently being used
to use this as a: queue you'll want to "append" and "pop head" stack you'll want to "push" and "pop head"