![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
A vector (resizing array) data type. More...
#include <vector.h>
Data Fields | |
| void ** | end |
| The end of the underlying array. | |
| void ** | next |
| The element after the last element in the underlying array. | |
| void ** | start |
| The start of the underlying array. | |
| int | votes |
| The number of votes to shrink this vector. | |
| int | votes_required |
| The number of votes required to shrink this vector. | |
A vector (resizing array) data type.
This struct implements a dynamic array that can grow as needed. It is designed to be a simple way of storing a collection of pointers that is frequently filled and then completely emptied.
| void** vector_t::end |
The end of the underlying array.
Points to one past the last allocated position in the array. The total capacity of the vector is (end - start). When next == end, the vector needs to be resized to add more elements.
| void** vector_t::next |
The element after the last element in the underlying array.
Points to the next available position in the array. The invariant start <= next <= end is maintained. The number of elements in the vector is (next - start).
| void** vector_t::start |
The start of the underlying array.
Points to the beginning of the dynamically allocated array that stores the vector's elements. This array contains pointers to the actual elements stored in the vector.
| int vector_t::votes |
The number of votes to shrink this vector.
This counter is incremented when vector_shrink_vote() is called. When it reaches votes_required, the vector may be resized to a smaller capacity to free up memory.
| int vector_t::votes_required |
The number of votes required to shrink this vector.
This field is used in conjunction with votes to implement a voting mechanism for vector shrinking. When the number of votes reaches votes_required, the vector may be resized to a smaller capacity.