26 #ifndef CDCONTAINERS_INCLUDE_CDCONTAINERS_STACK_H 27 #define CDCONTAINERS_INCLUDE_CDCONTAINERS_STACK_H 164 #ifdef CDC_USE_SHORT_NAMES 167 #define stack_ctor(...) cdc_stack_ctor(__VA_ARGS__) 168 #define stack_ctorl(...) cdc_stack_ctorl(__VA_ARGS__) 169 #define stack_ctorv(...) cdc_stack_ctorv(__VA_ARGS__) 170 #define stack_dtor(...) cdc_stack_dtor(__VA_ARGS__) 173 #define stack_top(...) cdc_stack_top(__VA_ARGS__) 176 #define stack_empty(...) cdc_stack_empty(__VA_ARGS__) 177 #define stack_size(...) cdc_stack_size(__VA_ARGS__) 180 #define stack_push(...) cdc_stack_push(__VA_ARGS__) 181 #define stack_pop(...) cdc_stack_pop(__VA_ARGS__) 182 #define stack_swap(...) cdc_stack_swap(__VA_ARGS__) 185 #endif // CDCONTAINERS_INCLUDE_CDCONTAINERS_STACK_H void(* pop_back)(void *cntr)
Definition: isequence.h:50
enum cdc_stat cdc_stack_ctorl(const struct cdc_sequence_table *table, struct cdc_stack **s, struct cdc_data_info *info,...)
Constructs a stack, initialized by an arbitrary number of pointers. The last item must be NULL...
The cdc_stack struct.
Definition: stack.h:43
void cdc_stack_dtor(struct cdc_stack *s)
Destroys the stack.
enum cdc_stat cdc_stack_ctorv(const struct cdc_sequence_table *table, struct cdc_stack **s, struct cdc_data_info *info, va_list args)
Constructs a stack, initialized by args. The last item must be NULL.
const struct cdc_sequence_table * table
Definition: stack.h:45
static void cdc_stack_pop(struct cdc_stack *s)
Removes the top item from the stack. This function assumes that the stack isn't empty.
Definition: stack.h:149
static bool cdc_stack_empty(struct cdc_stack *s)
Returns true if the stack has size 0; otherwise returns false.
Definition: stack.h:110
enum cdc_stat cdc_stack_ctor(const struct cdc_sequence_table *table, struct cdc_stack **s, struct cdc_data_info *info)
Constructs an empty stack.
void *(* back)(void *cntr)
Definition: isequence.h:46
The cdc_sequence_table is a sequence container interface.
bool(* empty)(void *cntr)
Definition: isequence.h:47
cdc_stat
Definition: status.h:24
void cdc_stack_swap(struct cdc_stack *a, struct cdc_stack *b)
Swaps stack a and b. This operation is very fast and never fails.
static enum cdc_stat cdc_stack_push(struct cdc_stack *s, void *elem)
Adds element elem to the top of the stack.
Definition: stack.h:137
size_t(* size)(void *cntr)
Definition: isequence.h:48
static size_t cdc_stack_size(struct cdc_stack *s)
Returns the number of items in the stack.
Definition: stack.h:122
enum cdc_stat(* push_back)(void *cntr, void *elem)
Definition: isequence.h:49
static void * cdc_stack_top(struct cdc_stack *s)
Returns a pointer to the stack's top item. This function assumes that the stack isn't empty...
Definition: stack.h:97
void * container
Definition: stack.h:44
The cdc_data_info struct used to initialize contaners.
Definition: common.h:71
The cdc_sequence_table struct.
Definition: isequence.h:41