![]() |
librnr
1.14.5
RoadNarrows Robotics Common Library 1
|
Simple associvative map operator definitions. More...
#include <sys/types.h>#include <stdlib.h>#include <string.h>#include "rnr/rnrconfig.h"#include "rnr/dliststr.h"#include "rnr/log.h"#include "rnr/new.h"#include "rnr/assoc.h"Go to the source code of this file.
Functions | |
| int | NvpName2Val (Nvp_T tbl[], size_t nTblEntries, const char *sName) |
| Get the value associated with the name. More... | |
| const char * | NvpVal2Name (Nvp_T tbl[], size_t nTblEntries, int iVal) |
| Get the name associated with the value. More... | |
| void * | AssocMapVoidXtoY (AssocMapVoidMapper_T *pMapper, void *px) |
| Get the y value associated with the given x value. More... | |
| void * | AssocMapVoidYtoX (AssocMapVoidMapper_T *pMapper, void *py) |
| Get the x value associated with the given y value. More... | |
Simple associvative map operator definitions.
These associative maps are composed of tables (vectors) of discrete (x, y) points where the x and y may be of any data types.
—
Definition in file assoc.c.
| void* AssocMapVoidXtoY | ( | AssocMapVoidMapper_T * | pMapper, |
| void * | px | ||
| ) |
Get the y value associated with the given x value.
The table search terminates at the first match or at the end of the table.
| pMapper | Associative map mapper container. |
| px | Pointer to X value in table to find. |
Definition at line 123 of file assoc.c.
References CHKPTR, AssocMapVoidMapper_T::m_opXCmp, AssocMapVoidMapper_T::m_pMapDft, AssocMapVoidMapper_T::m_tblAssocMap, AssocMapVoidMapper_T::m_tblSize, NULL, AssocMapVoidPoint_T::x, and AssocMapVoidPoint_T::y.
| void* AssocMapVoidYtoX | ( | AssocMapVoidMapper_T * | pMapper, |
| void * | py | ||
| ) |
Get the x value associated with the given y value.
The table search terminates at the first match or at the end of the table.
| pMapper | Associative map mapper container. |
| py | Pointer to Y value in table to find. |
Definition at line 159 of file assoc.c.
References CHKPTR, AssocMapVoidMapper_T::m_opYCmp, AssocMapVoidMapper_T::m_pMapDft, AssocMapVoidMapper_T::m_tblAssocMap, AssocMapVoidMapper_T::m_tblSize, NULL, AssocMapVoidPoint_T::x, and AssocMapVoidPoint_T::y.
| int NvpName2Val | ( | Nvp_T | tbl[], |
| size_t | nTblEntries, | ||
| const char * | sName | ||
| ) |
Get the value associated with the name.
The table search terminates at the first match or at the end of nTblEntries entries.
| tbl[] | Name-Value Pair table |
| nTblEntries | Number of name-value pair table entries |
| sName | Name to in table to find. |
Definition at line 64 of file assoc.c.
References CHKEXPR_ULONG, and Nvp_T::m_iVal.
Referenced by OptsCvtArgLogLevel(), and test_assoc().
| const char* NvpVal2Name | ( | Nvp_T | tbl[], |
| size_t | nTblEntries, | ||
| int | iVal | ||
| ) |
Get the name associated with the value.
The table search terminates at the first match or at the end of nTblEntries entries.
| tbl[] | Name-Value Pair table |
| nTblEntries | Number of name-value pair table entries |
| iVal | Value in table to find. |
Definition at line 94 of file assoc.c.
References CHKEXPR_ULONG, and Nvp_T::m_sName.
Referenced by AddNewBody(), PrintBody(), test_assoc(), and units_shortname().