Go to the documentation of this file. 1 #ifndef _MAPPED_VARS_H_
2 #define _MAPPED_VARS_H_ "$Id: mapped_vars.h 465 2020-07-24 22:59:56Z fargos $"
80 unsigned char **segment,
size_t *segmentLenPtr,
const uint_fast32_t doInit,
81 const char *fileName);
90 #define INIT_MAPPED_VAR(name, fmt, len) { 0, 0, name, fmt, len, 0}
98 #define INIT_MAPPED_INT_VAR(name) INIT_MAPPED_VAR(name, "=%d", sizeof(int))
108 #define MAPPED_TYPE_VAR(t, tbl, id) ((t *)(tbl[id].address))
114 #define MAPPED_INT_VAR(tbl, id) MAPPED_TYPE_VAR(int32_t, tbl,id)
121 #define UPDATE_MAPPED_TYPE_VAR(t, tbl, id) { int _l = sprintf((char *) tbl[id].outputAddress, tbl[id].formatPattern, *MAPPED_TYPE_VAR(t, tbl, id)); tbl[id].outputAddress[_l] = ' '; }
129 #define RELOAD_MAPPED_TYPE_VAR(t, tbl, id) { int _l = sscanf((char *) tbl[id].outputAddress, tbl[id].formatPattern, MAPPED_TYPE_VAR(t, tbl, id)); }
131 #define UPDATE_MAPPED_INT_VAR(tbl, id) { uint32_t workBfr[6]; uint32_t _l; uint64_t _v = *MAPPED_INT_VAR(tbl, id); char *_r = int_to_ascii(workBfr, sizeof(workBfr), _v, &_l); int _i = 0; while (tbl[id].formatPattern[_i] != '%') { tbl[id].outputAddress[_i] = tbl[id].formatPattern[_i]; _i+=1; } memcpy(tbl[id].outputAddress+_i, _r, _l); }
139 template <
typename T>
struct MappedVarRecordOfType {
uint64_t u64
Definition: mapped_vars.h:35
#define stderr
Definition: tmp.o.cpp:3115
#define MAP_FILE_INIT
Definition: mapped_file.h:69
unsigned char * address
Definition: mapped_vars.h:29
const char srcID[]
Definition: catSym.c:17
int64_t i64
Definition: mapped_vars.h:36
const char * formatPattern
Definition: mapped_vars.h:32
union MappedVarRecord::@20 val
int createMappedFile(unsigned char **segment, const char *fileName, size_t *segmentLenPtr, uint_fast32_t doInit)
Create or open a mapped file with the specified file name.
Definition: mapped_file.cpp:207
int32_t i32
Definition: mapped_vars.h:37
const char * varName
Definition: mapped_vars.h:31
const char srcID[] OME_USED
Definition: tick_time.cpp:24
uint32_t len
Definition: mapped_vars.h:33
Compiler-specific macros to provide performance-related hints.
double d
Definition: mapped_vars.h:40
uint32_t u32
Definition: mapped_vars.h:38
float f
Definition: mapped_vars.h:39
int createMappedVars(const uint_fast32_t numVars, struct MappedVarRecord vars[], unsigned char **segment, size_t *segmentLenPtr, const uint_fast32_t doInit, const char *fileName)
Create/reload an array of MappedVarRecords that is mapped by a memory mapped file.
Definition: mapped_vars.cpp:30
unsigned char * cp
Definition: mapped_vars.h:41
Data structure to reference a variable record within a memory-mapped segment.
Definition: mapped_vars.h:28
unsigned char * outputAddress
Definition: mapped_vars.h:30