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

obdeque Private Interace More...

#include "../obdeque.h"

Go to the source code of this file.

Classes

struct  obdeque_node_struct
 obdeque_node internal structure, encapsulating the data needed for an node within a doubly linked list. Internally referenced only More...
 
struct  obdeque_iterator_struct
 obdeque_nodeIterator internal structure, encapsulating the data needed for an iterator of a doubly linked list. More...
 
struct  obdeque_struct
 obdeque internal structure, encapsulating the data needed for a doubly linked list More...
 

Typedefs

typedef struct obdeque_node_struct obdeque_node
 obdeque_node internal structure, encapsulating the data needed for an node within a doubly linked list. Internally referenced only
 

Functions

obdeque_nodeobdeque_new_node (obj *to_store)
 Constructor, creates a new obdeque_node containing an obj. More...
 
void obdeque_destroy_node (obj *to_dealloc)
 Destructor for obdeque_node. More...
 
struct obdeque_iterator_structobdeque_new_iterator (const obdeque *deque, obdeque_node *node)
 Constructor, creates an instance of obdeque_iterator bound to an obdeque and an obdeque_node within that deque. More...
 
void obdeque_destroy_iterator (obj *to_dealloc)
 Destructor for obdeque_iterator. More...
 
obdequeobdeque_create_default (void)
 Default constructor for obdeque. More...
 
obdeque obdeque_recursive_sort (obdeque deque, int8_t order, ob_compare_fptr funct)
 Internal merge sort implementation for an obdeque. More...
 
ob_hash_t obdeque_hash (const obj *to_hash)
 Hash function for obdeque. More...
 
int8_t obdeque_compare (const obj *a, const obj *b)
 Compares two instances of obdeque. More...
 
void obdeque_display (const obj *to_print)
 Displays information about an obdeque to stderr. More...
 
void obdeque_destroy (obj *to_dealloc)
 Destructor for obdeque. More...
 

Detailed Description

obdeque Private Interace

Author
theck

Function Documentation

int8_t obdeque_compare ( const obj a,
const obj b 
)

Compares two instances of obdeque.

Parameters
aA non-NULL obj pointer to type obdeque
bA non-NULL obj pointer to type obdeque
Return values
OB_LESS_THANobj a is less than b
OB_GREATER_THANobj a is equivalent to b
OB_EQUAL_TOobj a is greater than b
obdeque* obdeque_create_default ( void  )

Default constructor for obdeque.

Returns
An instance of class obdeque
Warning
All public constructors should call this constructor and initialize individual members as needed, so that all base data is initialized properly
void obdeque_destroy ( obj to_dealloc)

Destructor for obdeque.

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

Destructor for obdeque_iterator.

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

Destructor for obdeque_node.

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

Displays information about an obdeque to stderr.

Parameters
to_printA non-NULL obj pointer to type obdeque
ob_hash_t obdeque_hash ( const obj to_hash)

Hash function for obdeque.

Parameters
to_hashAn obj pointer to an instance of obdeque
Returns
Key value (hash) for the given obj pointer to a obdeque
struct obdeque_iterator_struct* obdeque_new_iterator ( const obdeque deque,
obdeque_node node 
)

Constructor, creates an instance of obdeque_iterator bound to an obdeque and an obdeque_node within that deque.

Parameters
dequeAn instance of obdeque
nodeAn instance of obdeque_node contained within deque
Returns
An instance of obdeque_iterator
obdeque_node* obdeque_new_node ( obj to_store)

Constructor, creates a new obdeque_node containing an obj.

Parameters
to_storeA non-NULL instance of any Offbrand compatible class
Returns
A new instance of obdeque node storing to_store and with NULL references to next and prev nodes
obdeque obdeque_recursive_sort ( obdeque  deque,
int8_t  order,
ob_compare_fptr  funct 
)

Internal merge sort implementation for an obdeque.

Parameters
dequeStatic obdeque to be sorted
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
A sorted static deque
Warning
There is little to no parameter checking in this function, all sorting should use the publicly accessable function which calls this method internally.