cgul_bitwise_trie_node.h File Reference

bitwise trie node More...

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

Typedefs

typedef typedefCGUL_BEGIN_C struct cgul_bitwise_trie_node * cgul_bitwise_trie_node_t
 

Functions

CGUL_EXPORT unsigned long int cgul_bitwise_trie_node__get_index (cgul_exception_t *cex, cgul_bitwise_trie_node_t n)
 
CGUL_EXPORT void * cgul_bitwise_trie_node__get_value (cgul_exception_t *cex, cgul_bitwise_trie_node_t n)
 
CGUL_EXPORT void cgul_bitwise_trie_node__set_value (cgul_exception_t *cex, cgul_bitwise_trie_node_t n, const void *value)
 
CGUL_EXPORT cgul_bitwise_trie_node_t cgul_bitwise_trie_node__get_older (cgul_exception_t *cex, cgul_bitwise_trie_node_t n)
 
CGUL_EXPORT cgul_bitwise_trie_node_t cgul_bitwise_trie_node__get_younger (cgul_exception_t *cex, cgul_bitwise_trie_node_t n)
 

Detailed Description

This class implements a bitwise trie node which holds one index/value pair.

Author
Paul Serice

Typedef Documentation

§ cgul_bitwise_trie_node_t

typedef typedefCGUL_BEGIN_C struct cgul_bitwise_trie_node* cgul_bitwise_trie_node_t

Opaque pointer to a cgul_bitwise_trie_node instance.

Function Documentation

§ cgul_bitwise_trie_node__get_index()

CGUL_EXPORT unsigned long int cgul_bitwise_trie_node__get_index ( cgul_exception_t cex,
cgul_bitwise_trie_node_t  n 
)

Return the index stored in this node. If you want to set the value of the index, there is no method to do so because changing the value of a index requires changing the node's position in the cgul_bitwise_trie. Thus, if you need to change the value of a index, you should delete the node from the cgul_bitwise_trie and insert a new node with the new value for the index.

Parameters
[in]cexc-style exception
[in]ncgul_bitwise_trie_node instance
Returns
index

§ cgul_bitwise_trie_node__get_value()

CGUL_EXPORT void* cgul_bitwise_trie_node__get_value ( cgul_exception_t cex,
cgul_bitwise_trie_node_t  n 
)

Return the value stored in this node.

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

§ cgul_bitwise_trie_node__set_value()

CGUL_EXPORT void cgul_bitwise_trie_node__set_value ( cgul_exception_t cex,
cgul_bitwise_trie_node_t  n,
const void *  value 
)

Set the value stored in this node.

Parameters
[in]cexc-style exception
[in]ncgul_bitwise_trie_node instance
[in]value

§ cgul_bitwise_trie_node__get_older()

CGUL_EXPORT cgul_bitwise_trie_node_t cgul_bitwise_trie_node__get_older ( cgul_exception_t cex,
cgul_bitwise_trie_node_t  n 
)

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

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

    cgul_bitwise_trie_node_t n = cgul_bitwise_trie__get_youngest(cex, t);
    for ( ; n ; n = cgul_bitwise_trie_node__get_older(cex, n)) {
        ...
    }
Parameters
[in]cexc-style exception
[in]ncgul_bitwise_trie_node instance
Returns
older node

§ cgul_bitwise_trie_node__get_younger()

CGUL_EXPORT cgul_bitwise_trie_node_t cgul_bitwise_trie_node__get_younger ( cgul_exception_t cex,
cgul_bitwise_trie_node_t  n 
)

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

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

    cgul_bitwise_trie_node_t n = cgul_bitwise_trie__get_oldest(cex, t);
    for ( ; n ; n = cgul_bitwise_trie_node__get_younger(cex, n)) {
        ...
    }
Parameters
[in]cexc-style exception
[in]ncgul_bitwise_trie_node instance
Returns
younger node