C++ bindings for cgul_multimap_node
More...
#include <cgul_multimap_node_cxx.h>
Public Member Functions | |
void * | get_key () const |
void * | get_value () const |
void | set_value (const void *value) |
cgul_multimap_node_cxx * | get_prev (int older_is_greater) const |
cgul_multimap_node_cxx * | get_next (int older_is_greater) const |
cgul_multimap_node_cxx * | get_older () const |
cgul_multimap_node_cxx * | get_younger () const |
cgul_multimap_node_t | get_obj () const |
Friends | |
class | cgul_multimap_cxx |
This class provides the C++ bindings for C cgul_multimap_node
objects. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_multimap_node
into C++-style function calls and exception handling. This class must not be extended.
|
inline |
Return the key stored in this node. The key is used to determine the sort order of the node. If you want to set the value of the key, there is no method to do so because changing the value of a key requires changing the node's position in the cgul_multimap_cxx
. Thus, if you need to change the value of a key, you should delete the node from the cgul_multimap_cxx
and insert a new node with the new value for the key.
References cgul_multimap_node__get_key().
|
inline |
|
inline |
|
inline |
Return the previous node. You can use this method to iterate over the multimap. When there are no more nodes, NULL
is returned. You can use get_back()
to get the last node in a cgul_multimap_cxx
in order to start iterating.
The primary sort criterion is the user's compare
function, of course, but the older_is_greater
boolean is used as a secondary sort criterion. When a key maps to many values, the older_is_greater
boolean determines how to sort the older nodes relative to the newer nodes.
The way the older_is_greater
boolean works in this implementation is that each key maps to a linked list of values. The compare
function only determines the relative order of the keys. To order the values, this implementation always pushes newer values onto the front of the list. Thus, the newest value is always at the front of the list, and the oldest value is always at the back of the list. If older_is_greater
is true, the sort order is from front to back. If older_is_greater
is false, the sort order is from back to front.
For example, if you want to iterate over the values for a particular key in the same order they were inserted, you would call this method with older_is_greater
set to 0
. This way, the older values are considered to be less than the newer values.
[in] | older_is_greater | whether older nodes are greater than newer nodes |
References cgul_multimap_node__get_prev().
|
inline |
Return the next node. You can use this method to iterate over the multimap. When there are no more nodes, NULL
is returned. You can use get_front()
to get the first node in a cgul_multimap_cxx
in order to start iterating.
The primary sort criterion is the user's compare
function, of course, but the older_is_greater
boolean is used as a secondary sort criterion. When a key maps to many values, the older_is_greater
boolean determines how to sort the older nodes relative to the newer nodes.
The way the older_is_greater
boolean works in this implementation is that each key maps to a linked list of values. The compare
function only determines the relative order of the keys. To order the values, this implementation always pushes newer values onto the front of the list. Thus, the newest value is always at the front of the list, and the oldest value is always at the back of the list. If older_is_greater
is true, the sort order is from front to back. If older_is_greater
is false, the sort order is from back to front.
For example, if you want to iterate over the values for a particular key in the same order they were inserted, you would call this method with older_is_greater
set to 0
. This way, the older values are considered to be less than the newer values.
[in] | older_is_greater | whether older nodes are greater than newer nodes |
References cgul_multimap_node__get_next().
|
inline |
Return the next older node. Together with get_younger()
, this method lets you traverse the multimap in chronological order. If there is no older node, this method returns NULL
.
The following example shows how to iterate over the entire multimap in reverse chronological order. Notice that you have to start with the youngest node when calling get_older()
:
cgul_multimap_node_cxx* n = mm->get_youngest(); for ( ; n ; n = n->get_older()) { ... }
References cgul_multimap_node__get_older().
|
inline |
Return the next younger node. Together with get_older()
, this method lets you traverse the multimap in chronological order. If there is no younger node, this method returns NULL
.
The following example shows how to iterate over the entire multimap in chronological order. Notice that you have to start with the oldest node when calling get_younger()
:
cgul_multimap_node_cxx* n = mm->get_oldest(); for ( ; n ; n = n->get_younger()) { ... }
References cgul_multimap_node__get_younger().
|
inline |
Get the underlying cgul_multimap_node
object.
|
friend |