GRU - Generic Reusable Utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Typedefs | Functions
gru_node.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include "common/gru_portable.h"

Go to the source code of this file.

Data Structures

struct  gru_node_t_
 

Macros

#define gru_node_get_data_ptr(type, node)   (type *) node->data
 
#define gru_node_get_data(type, node)   (*(gru_node_get_data_ptr(type, node)))
 

Typedefs

typedef struct gru_node_t_ gru_node_t
 

Functions

gru_export gru_node_tgru_node_new (const void *ptr)
 Creates a new node. More...
 
gru_export void gru_node_destroy (gru_node_t **node)
 Destroys a node and sets is address to NULL. More...
 
gru_export void gru_node_set_previous (gru_node_t *gru_restrict node, gru_node_t *gru_restrict previous)
 Sets the previous node for a given node. More...
 
gru_export void gru_node_set_next (gru_node_t *gru_restrict node, gru_node_t *gru_restrict next)
 Sets the next node for a given node. More...
 
gru_export void gru_node_reset (gru_node_t *gru_restrict node)
 Reset the pointers for the node and unassign the next and previous pointers. More...
 
gru_export void gru_node_unlink (gru_node_t *gru_restrict node)
 Unlink a node from it's previous and next node and resets it. More...
 

Macro Definition Documentation

#define gru_node_get_data (   type,
  node 
)    (*(gru_node_get_data_ptr(type, node)))
#define gru_node_get_data_ptr (   type,
  node 
)    (type *) node->data

Typedef Documentation

typedef struct gru_node_t_ gru_node_t

Function Documentation

gru_export void gru_node_destroy ( gru_node_t **  node)

Destroys a node and sets is address to NULL.

Parameters
nodea pointer to the node pointer to destroy
gru_export gru_node_t* gru_node_new ( const void *  ptr)

Creates a new node.

Parameters
ptrdata pointer
Returns
a new node
gru_export void gru_node_reset ( gru_node_t *gru_restrict  node)

Reset the pointers for the node and unassign the next and previous pointers.

Parameters
nodethe node to reset
gru_export void gru_node_set_next ( gru_node_t *gru_restrict  node,
gru_node_t *gru_restrict  next 
)

Sets the next node for a given node.

Parameters
nodethe node to set
nextthe node to be set as the next to the node
gru_export void gru_node_set_previous ( gru_node_t *gru_restrict  node,
gru_node_t *gru_restrict  previous 
)

Sets the previous node for a given node.

Parameters
nodethe node to set
previousthe node to be set as a previous to the node
gru_export void gru_node_unlink ( gru_node_t *gru_restrict  node)

Unlink a node from it's previous and next node and resets it.

Parameters
nodethe node to unlink