![]() |
![]() |
![]() |
cpg-network Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
CpgStack * cpg_stack_new (guint size
); void cpg_stack_init (CpgStack *stack
,guint size
); void cpg_stack_destroy (CpgStack *stack
); void cpg_stack_free (CpgStack *stack
); guint cpg_stack_size (CpgStack *stack
); guint cpg_stack_count (CpgStack *stack
); void cpg_stack_push (CpgStack *stack
,gdouble value
); gdouble cpg_stack_pop (CpgStack *stack
); void cpg_stack_reset (CpgStack *stack
); gdouble cpg_stack_at (CpgStack *stack
,gint idx
); CpgStack;
CpgStack * cpg_stack_new (guint size
);
Create a new stack with the given size.
|
the stack size |
Returns : |
A CpgStack |
void cpg_stack_init (CpgStack *stack
,guint size
);
Initialize the stack to a certain size (useful when a stack is allocated statically).
|
A CpgStack |
|
the stack size |
void cpg_stack_destroy (CpgStack *stack
);
Destroy the stack. This resizes the stack to 0. To free the whole stack, use
cpg_stack_free
.
|
A CpgStack |
guint cpg_stack_size (CpgStack *stack
);
Get the size of the stack. This is the maximum number of items that the stack can hold. Use cpg_stack_count to get the number of items currently on the stack
|
A CpgStack |
Returns : |
the stack size |
guint cpg_stack_count (CpgStack *stack
);
Count the number of items on the stack.
|
A CpgStack |
Returns : |
the number of items on the stack |
void cpg_stack_push (CpgStack *stack
,gdouble value
);
Push a value on the stack. The stack will not be automatically resized, thus be sure to know that you are not exceeding the stack size.
|
A CpgStack |
|
the value |
gdouble cpg_stack_pop (CpgStack *stack
);
Pop a value of the stack. Note: this function does not check whether there are still values on the stack, be sure to either know, or check the stack yourself.
|
A CpgStack |
Returns : |
the last value on the stack |
gdouble cpg_stack_at (CpgStack *stack
,gint idx
);
Get a value from the stack at the specified index idx
.
|
A CpgStack |
|
The index |
Returns : |
The stack value at index idx
|