Golem  v0.1.1
Generic Operating system Libraries for Embedded Multitasking
 All Data Structures Files Functions Variables Pages
glm_vector.h File Reference

Vector datatype. Part of Golem's collection of Advanced Data Types (ADTs). More...

#include "../glm_heap.h"
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  vector_t
 The vector datatype. More...
 

Functions

vector_tvector_create (heap_id_t a_heap_id, uint_base_t a_length, size_t a_objectsize)
 Creates a new vector with the given length for the given heap-ID. Returns a pointer to the newly created vector or returns NULL if creation failed. A vector. More...
 
void vector_destroy (heap_id_t a_heap_id, vector_t *a_vector)
 Clears the vector and then destroy's it.
 
void vector_clear (heap_id_t a_heap_id, vector_t *a_vector)
 Empties the vector, destroying all objects stored in it.
 
uint_base_t vector_add (heap_id_t a_heap_id, vector_t *a_vector, void *a_object)
 Adds the given object reference to the given vector and returns its index location.
 
uint_base_t vector_get_length (vector_t *a_vector)
 Returns the length of the given vector.
 
void * vector_get_object (vector_t *a_vector, uint_base_t a_index)
 Returns the object reference stored at index location [a_index] of vector [a_vector].
 

Detailed Description

Vector datatype. Part of Golem's collection of Advanced Data Types (ADTs).

Author
Ruud Beukema

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Definition in file glm_vector.h.

Function Documentation

vector_t* vector_create ( heap_id_t  a_heap_id,
uint_base_t  a_length,
size_t  a_objecsize 
)

Creates a new vector with the given length for the given heap-ID. Returns a pointer to the newly created vector or returns NULL if creation failed. A vector.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Definition at line 18 of file glm_vector.c.