55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
#ifndef INCLUDED_C_UINTARRAY_H
|
|
#define INCLUDED_C_UINTARRAY_H
|
|
|
|
#ifndef INCLUDED_C_TYPES_H
|
|
#include <c_Types.h>
|
|
#endif /*INCLUDED_C_TYPES_H*/
|
|
|
|
#ifndef INCLUDED_C_ALLOCATOR_H
|
|
#include <c_Allocator.h>
|
|
#endif /*INCLUDED_C_ALLOCATOR_H*/
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
|
/* */
|
|
|
|
typedef struct {
|
|
c_uint_t* array;
|
|
c_size_t capacity;
|
|
c_size_t size;
|
|
c_Allocator_t allocator;
|
|
}c_UIntArray_t;
|
|
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
|
/* */
|
|
|
|
c_err_t c_UIntArray_Init(c_UIntArray_t* self, c_size_t capacity, c_Allocator_t* allocator);
|
|
|
|
void c_UIntArray_Destroy(c_UIntArray_t* self);
|
|
|
|
c_err_t c_UIntArray_Resize(c_UIntArray_t* self, c_size_t new_capacity);
|
|
|
|
c_err_t c_UIntArray_Append(c_UIntArray_t* self, c_uint_t value);
|
|
|
|
c_err_t c_UIntArray_Set(c_UIntArray_t* self, c_size_t index, c_uint_t value);
|
|
|
|
c_err_t c_UIntArray_Get(c_UIntArray_t* self, c_size_t index, c_uint_t* value);
|
|
|
|
c_err_t c_UIntArray_Remove(c_UIntArray_t* self, c_size_t index);
|
|
|
|
C_STATIC_FORCE_INLINE
|
|
c_bool_t c_UIntArray_IsEmpty(c_UIntArray_t* self) {
|
|
if (!self) return C_TRUE;
|
|
return self->size==0;
|
|
}
|
|
|
|
C_STATIC_FORCE_INLINE
|
|
c_size_t c_UIntArray_GetSize(c_UIntArray_t* self) {
|
|
if (!self) return 0;
|
|
return self->size;
|
|
}
|
|
|
|
c_err_t c_UIntArray_Copy(c_UIntArray_t* dest, c_UIntArray_t* src);
|
|
|
|
#endif /*INCLUDED_C_UINTARRAY_H*/
|