cgul_hash_node.h File Reference

hash node More...

#include "cgul_common.h"
#include "cgul_exception.h"
Include dependency graph for cgul_hash_node.h:
This graph shows which files directly or indirectly include this file:

Typedefs

typedef typedefCGUL_BEGIN_C struct cgul_hash_node * cgul_hash_node_t
 

Functions

CGUL_EXPORT const void * cgul_hash_node__get_key (cgul_exception_t *cex, cgul_hash_node_t n)
 
CGUL_EXPORT void * cgul_hash_node__get_value (cgul_exception_t *cex, cgul_hash_node_t n)
 
CGUL_EXPORT void cgul_hash_node__set_value (cgul_exception_t *cex, cgul_hash_node_t n, const void *value)
 
CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_prev (cgul_exception_t *cex, cgul_hash_node_t n)
 
CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_next (cgul_exception_t *cex, cgul_hash_node_t n)
 
CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_older (cgul_exception_t *cex, cgul_hash_node_t n)
 
CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_younger (cgul_exception_t *cex, cgul_hash_node_t n)
 

Detailed Description

This class implements a hash node which holds one key/value pair.

Author
Paul Serice

Typedef Documentation

§ cgul_hash_node_t

typedef typedefCGUL_BEGIN_C struct cgul_hash_node* cgul_hash_node_t

Function Documentation

§ cgul_hash_node__get_key()

CGUL_EXPORT const void* cgul_hash_node__get_key ( cgul_exception_t cex,
cgul_hash_node_t  n 
)

Get the key for this node.

Parameters
[in]cexc-style exception
[in]ncgul_hash_node_t instance
Returns
key

Referenced by cgul_hash_cxx::foldl_keys(), cgul_hash_cxx::foldl_pairs(), cgul_hash_cxx::foldr_keys(), cgul_hash_cxx::foldr_pairs(), and cgul_hash_node_cxx::get_key().

§ cgul_hash_node__get_value()

CGUL_EXPORT void* cgul_hash_node__get_value ( cgul_exception_t cex,
cgul_hash_node_t  n 
)

Get the value for this node.

Parameters
[in]cexc-style exception
[in]ncgul_hash_node_t instance
Returns
value

Referenced by cgul_hash_cxx::foldl_pairs(), cgul_hash_cxx::foldl_values(), cgul_hash_cxx::foldr_pairs(), cgul_hash_cxx::foldr_values(), and cgul_hash_node_cxx::get_value().

§ cgul_hash_node__set_value()

CGUL_EXPORT void cgul_hash_node__set_value ( cgul_exception_t cex,
cgul_hash_node_t  n,
const void *  value 
)

Set the value for this node.

Parameters
[in]cexc-style exception
[in]ncgul_hash_node_t instance
[in]valuenew value

Referenced by cgul_hash_node_cxx::set_value().

§ cgul_hash_node__get_prev()

CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_prev ( cgul_exception_t cex,
cgul_hash_node_t  n 
)

Get the previous node in insertion order. This method is a synonym for cgul_hash_node__get_older(). You can use this method to iterate over the hash in reverse insertion order. When there are no more nodes, NULL is returned. You can use cgul_hash__get_back() to get the last node in a cgul_hash in order to start iterating.

Parameters
[in]cexc-style exception
[in]ncgul_hash_node_t instance
Returns
previous node
See also
cgul_hash_node__get_older()

Referenced by cgul_hash_cxx::foldr_keys(), cgul_hash_cxx::foldr_pairs(), cgul_hash_cxx::foldr_values(), and cgul_hash_node_cxx::get_prev().

§ cgul_hash_node__get_next()

CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_next ( cgul_exception_t cex,
cgul_hash_node_t  n 
)

Get the next node in insertion order. This method is a synonym for cgul_hash_node__get_younger(). You can use this method to iterate over the hash in insertion order. When there are no more nodes, NULL is returned. You can use cgul_hash__get_front() to get the first node in a cgul_hash in order to start iterating.

Parameters
[in]cexc-style exception
[in]ncgul_hash_node_t instance
Returns
previous node
See also
cgul_hash_node__get_younger()

Referenced by cgul_hash_cxx::foldl_keys(), cgul_hash_cxx::foldl_pairs(), cgul_hash_cxx::foldl_values(), cgul_hash_node_cxx::get_next(), and cgul_hash_cxx::traverse_range().

§ cgul_hash_node__get_older()

CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_older ( cgul_exception_t cex,
cgul_hash_node_t  n 
)

Return the next older node. Together with cgul_hash_node__get_younger(), this method lets you traverse the hash in chronological order. If there is no older node, this method returns NULL.

The following example shows how to iterate over the entire hash in reverse chronological order. Notice that you have to start with the youngest node when calling cgul_hash_node__get_older():

    cgul_hash_node_t n = cgul_hash__get_youngest(cex, h);
    for ( ; n ; n = cgul_hash_node__get_older(cex, n)) {
        ...
    }
Parameters
[in]cexc-style exception
[in]ncgul_hash_node instance
Returns
older node

Referenced by cgul_hash_node_cxx::get_older().

§ cgul_hash_node__get_younger()

CGUL_EXPORT cgul_hash_node_t cgul_hash_node__get_younger ( cgul_exception_t cex,
cgul_hash_node_t  n 
)

Return the next younger node. Together with cgul_hash_node__get_older(), this method lets you traverse the hash in chronological order. If there is no younger node, this method returns NULL.

The following example shows how to iterate over the entire hash in chronological order. Notice that you have to start with the oldest node when calling cgul_hash_node__get_younger():

    cgul_hash_node_t n = cgul_hash__get_oldest(cex, h);
    for ( ; n ; n = cgul_hash_node__get_younger(cex, n)) {
        ...
    }
Parameters
[in]cexc-style exception
[in]ncgul_hash_node instance
Returns
younger node

Referenced by cgul_hash_node_cxx::get_younger().