offbrand
A collection of generic, reference counted datastructures in C for C
 All Classes Files Functions Variables Typedefs Macros Groups
Classes | Functions
obvector_private.h File Reference

obvector Private Interface More...

#include "../obvector.h"

Go to the source code of this file.

Classes

struct  obvector_struct
 obvector internal structure, encapsulating all data needed for an instance of obvector More...
 

Functions

obvectorobvector_create_default (uint32_t initial_capacity)
 Create the default obvector. More...
 
void obvector_resize (obvector *v, uint32_t index)
 Resizes a vector if the number of objects it contains is equal to its capacity by doubling the potential capacity of the vector. More...
 
obj ** obvector_recursive_sort (obj **to_sort, uint32_t size, int8_t order, ob_compare_fptr funct)
 Internal merge sort implementation for an obvector. More...
 
ob_hash_t obvector_hash (const obj *to_hash)
 Hash function for obvector. More...
 
int8_t obvector_compare (const obj *a, const obj *b)
 Compares two instances of obvector. More...
 
void obvector_display (const obj *to_print)
 Display function for an instance of OBString. More...
 
void obvector_destroy (obj *to_dealloc)
 Destructor for obvector. More...
 
uint32_t obvector_find_valid_precursor (obj **array, uint32_t index)
 Searches an array of obj for the first encountered non-NULL pointer, returning the index where this pointer is found. More...
 

Detailed Description

obvector Private Interface

Author
theck

Function Documentation

int8_t obvector_compare ( const obj a,
const obj b 
)

Compares two instances of obvector.

Parameters
aA non-NULL obj pointer to type obvector
bA non-NULL obj pointer to type obvector
Return values
OB_NOT_EQUALa does not equal b
OB_EQUAL_TOa equals b
obvector* obvector_create_default ( uint32_t  initial_capacity)

Create the default obvector.

Parameters
initial_capacityCapacity of the vector to be created
Returns
A new, partially initialized instance of obvector
void obvector_destroy ( obj to_dealloc)

Destructor for obvector.

Parameters
to_deallocAn obj pointer to an instance of obvector with reference count of 0
Warning
Do not call manually, release will call automatically when the instances reference count drops to 0!
void obvector_display ( const obj to_print)

Display function for an instance of OBString.

Parameters
to_printA non-NULL obj pointer to type OBString
uint32_t obvector_find_valid_precursor ( obj **  array,
uint32_t  index 
)

Searches an array of obj for the first encountered non-NULL pointer, returning the index where this pointer is found.

Parameters
arrayArray of pointers to instances of Offbrand compatible classes
indexIndex from which to begin searching
Return values
<UINT32_MAXIndex where a non-NULL pointer was found
UINT32_MAXNo non-NULL pointer was found
ob_hash_t obvector_hash ( const obj to_hash)

Hash function for obvector.

Parameters
to_hashAn obj pointer to an instance of obvector
Returns
Key value (hash) for the given obj pointer to an obvector
obj** obvector_recursive_sort ( obj **  to_sort,
uint32_t  size,
int8_t  order,
ob_compare_fptr  funct 
)

Internal merge sort implementation for an obvector.

Parameters
to_sortPrimitive array of objects to be sorted
sizeSize of to_sort
orderAccepts OB_LEAST_TO_GREATEST or OB_GREATEST_TO_LEAST as valid sorting orders
functA compare_fptr to a function that returns an int8_t when given two obj * arguments
Returns
The sorted primitive array of objects (a new primitive array, not to_sort)
Warning
There is little to no parameter checking in this function, all sorting should use the publicly accessable function which calls this method internally.
void obvector_resize ( obvector v,
uint32_t  index 
)

Resizes a vector if the number of objects it contains is equal to its capacity by doubling the potential capacity of the vector.

Parameters
vPointer to an instance of obvector
indexIndex that vector must be resized to contain