FMI Library: part of JModelica.org
|
Macros | |
#define | jm_stack(T) jm_mangle(jm_stack, T) |
A basic stack of items. More... | |
#define | jm_stack_alloc(T) jm_mangle(jm_stack_alloc, T) |
Allocates a stack with the given reserved memory. More... | |
#define | jm_stack_free(T) jm_mangle(jm_stack_free, T) |
Release memory allocated for a stack. More... | |
#define | jm_stack_init(T) jm_mangle(jm_stack_init, T) |
Initializes a jm_stack allocated on stack. More... | |
#define | jm_stack_free_data(T) jm_mangle(jm_stack_free_data, T) |
Releases memory allocated for stack data. More... | |
#define | jm_stack_get_size(T) jm_mangle(jm_stack_get_size, T) |
Get the number of elements in the stack. More... | |
#define | jm_stack_reserve(T) jm_mangle(jm_stack_reserve, T) |
Preallocate memory for the stack (to speed up consequent push). More... | |
#define | jm_stack_push(T) jm_mangle(jm_stack_push, T) |
Put an element on the stack. More... | |
#define | jm_stack_is_empty(T) jm_mangle(jm_stack_is_empty, T) |
#define | jm_stack_pop(T) jm_mangle(jm_stack_pop, T) |
#define | jm_stack_top(T) jm_mangle(jm_stack_top, T) |
#define | jm_stack_foreach(T) jm_mangle(jm_stack_foreach, T) |
#define | JM_STACK_MINIMAL_CAPACITY JM_VECTOR_MINIMAL_CAPACITY |
#define | JM_STACK_MAX_MEMORY_CHUNK JM_VECTOR_MAX_MEMORY_CHUNK |
#define | jm_stack_declare_template(T) |
#define jm_stack | ( | T | ) | jm_mangle(jm_stack, T) |
A basic stack of items.
Stack is implemented on top of jm_vector right now. There is a couple of extra methonds that are convenient.
Definition at line 41 of file jm_stack.h.
#define jm_stack_alloc | ( | T | ) | jm_mangle(jm_stack_alloc, T) |
Allocates a stack with the given reserved memory.
capacity | - initial stack capacity, can be 0 |
c | - jm_callbacks callbacks, can be zero |
Definition at line 52 of file jm_stack.h.
#define jm_stack_free | ( | T | ) | jm_mangle(jm_stack_free, T) |
Release memory allocated for a stack.
Definition at line 60 of file jm_stack.h.
#define jm_stack_init | ( | T | ) | jm_mangle(jm_stack_init, T) |
Initializes a jm_stack allocated on stack.
a | - pointer to the stack to be initialized; |
c | - jm_callbacks callbacks, can be zero |
Definition at line 71 of file jm_stack.h.
#define jm_stack_free_data | ( | T | ) | jm_mangle(jm_stack_free_data, T) |
Releases memory allocated for stack data.
This only needs to be called both for stack allocated jm_stack structs.
a | - pointer to the stack. |
Definition at line 83 of file jm_stack.h.
#define jm_stack_get_size | ( | T | ) | jm_mangle(jm_stack_get_size, T) |
Get the number of elements in the stack.
Definition at line 92 of file jm_stack.h.
#define jm_stack_reserve | ( | T | ) | jm_mangle(jm_stack_reserve, T) |
Preallocate memory for the stack (to speed up consequent push).
Definition at line 101 of file jm_stack.h.
#define jm_stack_push | ( | T | ) | jm_mangle(jm_stack_push, T) |
Put an element on the stack.
Definition at line 111 of file jm_stack.h.
#define jm_stack_is_empty | ( | T | ) | jm_mangle(jm_stack_is_empty, T) |
jm_stack_is_empty returns 1 if the stack is empty and 0 otherwize. int jm_stack_is_empty(jm_stack(T)*)
Definition at line 117 of file jm_stack.h.
#define jm_stack_pop | ( | T | ) | jm_mangle(jm_stack_pop, T) |
jm_stack_pop gets the stack head and moves to the next element. Popping an empty stack gives assertion failure. T jm_stack_pop(jm_stack(T)* a)
Definition at line 123 of file jm_stack.h.
#define jm_stack_top | ( | T | ) | jm_mangle(jm_stack_top, T) |
jm_stack_top gets the stack top. Call on an empty stack gives assertion failure. T jm_stack_top(jm_stack(T)* a)
Definition at line 129 of file jm_stack.h.
#define jm_stack_foreach | ( | T | ) | jm_mangle(jm_stack_foreach, T) |
jm_stack_foreach calls f for each element in the stack. "data" parameter is forwarded to the function as the second argument. void jm_stack_foreach(T)(jm_stack(T)* a, void (f)(T, void), void * data)
Definition at line 136 of file jm_stack.h.
#define JM_STACK_MINIMAL_CAPACITY JM_VECTOR_MINIMAL_CAPACITY |
minimal number of items always allocated for the stack
Definition at line 140 of file jm_stack.h.
#define JM_STACK_MAX_MEMORY_CHUNK JM_VECTOR_MAX_MEMORY_CHUNK |
maximum memory chunk (in items) to be allocated in push.
Definition at line 143 of file jm_stack.h.
#define jm_stack_declare_template | ( | T | ) |
Declare stack for the specific type.
Definition at line 146 of file jm_stack.h.