Design Pattern Examples
Overview of object-oriented design patterns
uintarray.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __UINTARRAY_H__
8#define __UINTARRAY_H__
9
10#include <stdbool.h>
11#include <stdint.h>
12#include <stddef.h>
13
23typedef struct
24{
25 uint32_t* data;
26 size_t length;
28
29} UIntArray;
30
36
42void UIntArray_Clear(UIntArray* array);
43
52bool UIntArray_AddInt(UIntArray* array, uint32_t value);
53
61void UIntArray_RemoveInt(UIntArray* array, int removeIndex);
62
71int UIntArray_Find(UIntArray* array, uint32_t value);
72
82bool UIntArray_Copy(UIntArray* sourceArray, UIntArray* destinationArray);
83
84#endif // __UINTARRAY_H__
Represents an array of 32-bit unsigned integers. The data field points to a block of memory allocated...
Definition: uintarray.h:24
size_t allocatedLength
Number of elements that the data array can hold.
Definition: uintarray.h:27
uint32_t * data
Pointer to array of 32-bit unsigned integers.
Definition: uintarray.h:25
size_t length
Number of 32-bit unsigned integers actually in the data array.
Definition: uintarray.h:26
void UIntArray_Initialize(UIntArray *array)
Initialize the given UIntArray object.
Definition: uintarray.c:13
int UIntArray_Find(UIntArray *array, uint32_t value)
Search the given UIntArray object for the specified value and return the index of that found value.
Definition: uintarray.c:93
bool UIntArray_Copy(UIntArray *sourceArray, UIntArray *destinationArray)
Copy the source UIntArray to the destination UIntArray. The destination UIntArray is erased before ge...
Definition: uintarray.c:116
void UIntArray_Clear(UIntArray *array)
Clear the given UIntArray object so it can be reused again. Releases the list of integers.
Definition: uintarray.c:26
bool UIntArray_AddInt(UIntArray *array, uint32_t value)
Add an unsigned 32-bit integer to the given UIntArray object.
Definition: uintarray.c:38
void UIntArray_RemoveInt(UIntArray *array, int removeIndex)
Remove the unsigned 32-bit integer from the given UIntArray object at the given index....
Definition: uintarray.c:75