![]() |
netmsgs
1.2.2
RoadNarrows Robotics Network Messaging Package
|
Internal intra-library definitions. More...
#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <libgen.h>#include <string.h>#include "rnr/rnrconfig.h"#include "rnr/log.h"#include "rnr/netmsgs.h"#include "nmLibInternal.h"Go to the source code of this file.
Macros | |
| #define | _NMSET_VAL(_this, pv, T) (T)(_this.m_bits & NMBITS_HAS_CONST? (T)(_this.m_valConst): *((T*)pv)) |
| Set field value. More... | |
| #define | _NMCHK_MIN(fname, _this, v, T, fmt) |
| Check value is ≥ minimum. More... | |
| #define | _NMCHK_MAX(fname, _this, v, T, fmt) |
| Check value is ≤ maximum. More... | |
Functions | |
| int | nmSetU8 (const NMFieldDef_T *pFieldDef, void *pValIn, byte_t *pValOut) |
| Helper function to set an unsigned 8-bit integer. More... | |
| int | nmSetS8 (const NMFieldDef_T *pFieldDef, void *pValIn, signed char *pValOut) |
| Helper function to set a signed 8-bit integer. More... | |
| int | nmSetU16 (const NMFieldDef_T *pFieldDef, void *pValIn, ushort_t *pValOut) |
| Helper function to set an unsigned 16-bit integer. More... | |
| int | nmSetS16 (const NMFieldDef_T *pFieldDef, void *pValIn, short *pValOut) |
| Helper function to set a signed 16-bit integer. More... | |
| int | nmSetU32 (const NMFieldDef_T *pFieldDef, void *pValIn, uint_t *pValOut) |
| Helper function to set an unsigned 32-bit integer. More... | |
| int | nmSetS32 (const NMFieldDef_T *pFieldDef, void *pValIn, int *pValOut) |
| Helper function to set a signed 32-bit integer. More... | |
| int | nmSetU64 (const NMFieldDef_T *pFieldDef, void *pValIn, ulonglong_t *pValOut) |
| Helper function to set an unsigned 64-bit integer. More... | |
| int | nmSetS64 (const NMFieldDef_T *pFieldDef, void *pValIn, long long *pValOut) |
| Helper function to set a signed 64-bit integer. More... | |
| int | nmSetF32 (const NMFieldDef_T *pFieldDef, void *pValIn, float *pValOut) |
| Helper function to set a 32-bit floating point number. More... | |
| int | nmSetF64 (const NMFieldDef_T *pFieldDef, void *pValIn, double *pValOut) |
| Helper function to set a 64-bit floating point number. More... | |
| void | nmTraceField (const NMFieldDef_T *pFieldDef, byte_t buf[], size_t uCount, uint_t uDepth, const char *sFmt,...) |
| Trace packing/unpacking of a message field. More... | |
Variables | |
| const int | NMHashOffset = (int)NMFTypeBool |
| hash base offset | |
| const int | NMHashNoIdx = 0xff |
| hash no index value | |
| const byte_t | NMHashTbl [] |
| const size_t | NMHashNumEntries = arraysize(NMHashTbl) |
Internal intra-library definitions.
Definition in file nmLibInternal.c.
| #define _NMCHK_MAX | ( | fname, | |
| _this, | |||
| v, | |||
| T, | |||
| fmt | |||
| ) |
Check value is ≤ maximum.
| fname | This field's string name. |
| _this | This field's specific information. |
| v | Field value. |
| T | Field C type. |
| fmt | Format string on error. |
Definition at line 112 of file nmLibInternal.c.
Referenced by nmSetF32(), nmSetF64(), nmSetS16(), nmSetS32(), nmSetS64(), nmSetS8(), nmSetU16(), nmSetU32(), nmSetU64(), and nmSetU8().
| #define _NMCHK_MIN | ( | fname, | |
| _this, | |||
| v, | |||
| T, | |||
| fmt | |||
| ) |
Check value is ≥ minimum.
| fname | This field's string name. |
| _this | This field's specific information. |
| v | Field value. |
| T | Field C type. |
| fmt | Format string on error. |
Definition at line 88 of file nmLibInternal.c.
Referenced by nmSetF32(), nmSetF64(), nmSetS16(), nmSetS32(), nmSetS64(), nmSetS8(), nmSetU16(), nmSetU32(), nmSetU64(), and nmSetU8().
| #define _NMSET_VAL | ( | _this, | |
| pv, | |||
| T | |||
| ) | (T)(_this.m_bits & NMBITS_HAS_CONST? (T)(_this.m_valConst): *((T*)pv)) |
Set field value.
| _this | This field's specific information. |
| pv | Pointer to field value. |
| T | Field C type. |
Definition at line 74 of file nmLibInternal.c.
Referenced by nmSetF32(), nmSetF64(), nmSetS16(), nmSetS32(), nmSetS64(), nmSetS8(), nmSetU16(), nmSetU32(), nmSetU64(), and nmSetU8().
| int nmSetF32 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| float * | pValOut | ||
| ) |
Helper function to set a 32-bit floating point number.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 443 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, NMFieldThis_T::m_f32, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, and NM_OK.
Referenced by nmPackFlatF32(), and nmPackITVF32().
| int nmSetF64 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| double * | pValOut | ||
| ) |
Helper function to set a 64-bit floating point number.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 474 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, NMFieldThis_T::m_f64, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, and NM_OK.
Referenced by nmPackFlatF64(), and nmPackITVF64().
| int nmSetS16 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| short * | pValOut | ||
| ) |
Helper function to set a signed 16-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 282 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u16, and NM_OK.
Referenced by nmPackFlatS16(), and nmPackITVS16().
| int nmSetS32 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| int * | pValOut | ||
| ) |
Helper function to set a signed 32-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 344 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u32, and NM_OK.
Referenced by nmPackFlatS32(), and nmPackITVS32().
| int nmSetS64 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| long long * | pValOut | ||
| ) |
Helper function to set a signed 64-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 410 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u64, and NM_OK.
Referenced by nmPackFlatS64(), and nmPackITVS64().
| int nmSetS8 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| signed char * | pValOut | ||
| ) |
Helper function to set a signed 8-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 216 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u8, and NM_OK.
Referenced by nmPackFlatS8(), and nmPackITVS8().
| int nmSetU16 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| ushort_t * | pValOut | ||
| ) |
Helper function to set an unsigned 16-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 249 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u16, and NM_OK.
Referenced by nmPackFlatU16(), and nmPackITVU16().
| int nmSetU32 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| uint_t * | pValOut | ||
| ) |
Helper function to set an unsigned 32-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 313 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u32, and NM_OK.
Referenced by nmPackFlatU32(), and nmPackITVU32().
| int nmSetU64 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| ulonglong_t * | pValOut | ||
| ) |
Helper function to set an unsigned 64-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 375 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u64, and NM_OK.
Referenced by nmPackFlatU64(), and nmPackITVU64().
| int nmSetU8 | ( | const NMFieldDef_T * | pFieldDef, |
| void * | pValIn, | ||
| byte_t * | pValOut | ||
| ) |
Helper function to set an unsigned 8-bit integer.
| pFieldDef | Pointer to message field definition. | |
| [in] | pValIn | Pointer to field value. |
| [out] | pValOut | Pointer to constrained, assigned field value. |
Definition at line 182 of file nmLibInternal.c.
References _NMCHK_MAX, _NMCHK_MIN, _NMSET_VAL, _nm_field_def_struct::m_sFName, _nm_field_def_struct::m_this, NMFieldThis_T::m_u8, and NM_OK.
Referenced by nmPackFlatU8(), and nmPackITVU8().
| void nmTraceField | ( | const NMFieldDef_T * | pFieldDef, |
| byte_t | buf[], | ||
| size_t | uCount, | ||
| uint_t | uDepth, | ||
| const char * | sFmt, | ||
| ... | |||
| ) |
Trace packing/unpacking of a message field.
| pFieldDef | Pointer to field definition. |
| buf | Packed/unpacked buffer. |
| uCount | Number of bytes in buffer to trace. |
| uDepth | Depth of field in recursive definition. |
| sFmt | Field representation format string. |
| ... | Field representation variable arguments. |
Definition at line 504 of file nmLibInternal.c.
References _nm_field_def_struct::m_eFId, _nm_field_def_struct::m_eFType, _nm_field_def_struct::m_sFName, NMFID_NONE, and nmPrintBuf().
| const size_t NMHashNumEntries = arraysize(NMHashTbl) |
| const byte_t NMHashTbl[] |
Field Type Hash Table.
Maps field type to zero base index.
Definition at line 140 of file nmLibInternal.c.
Referenced by NMHashFType().