13 #ifndef CARMA_BIMA_SHAREDMEMORY_H
14 #define CARMA_BIMA_SHAREDMEMORY_H
18 #include <sys/types.h>
32 #include "log4cpp/Category.hh"
35 #include "carma/util/Logger.h"
36 #include "carma/util/Program.h"
43 #define BIMA_SHARED_MEMORY_DIR "/dev/shm/"
44 #define BIMA_SHARED_MEMORY_FILE "_shared_memory"
49 #define FLOAT_TYPE 'F'
50 #define DOUBLE_TYPE 'D'
52 #define MAX_NAME_LEN 15
56 #define SHMTRC( A, B ) putData( A, &B );
57 #define CSHMTRC( A, B, C ) A.putData( B, &C );
71 SharedMemory(
const char *name );
76 void getData(
const char *name,
char *value,
int vsize = 1 );
77 void putData(
const char *name,
const char *value,
int vsize = 1 );
79 void putData(
const char *name,
char *value );
81 void getData(
const char *name,
unsigned short *values,
int vsize = 1 );
82 void putData(
const char *name,
unsigned short *values,
int vsize = 1 );
84 void getData(
const char *name,
int *values,
int vsize = 1 );
85 void putData(
const char *name,
int *values,
int vsize = 1 );
87 void getData(
const char *name,
float *values,
int vsize = 1 );
88 void putData(
const char *name,
float *values,
int vsize = 1 );
90 void getData(
const char *name,
double *values,
int vsize = 1 );
91 void putData(
const char *name,
double *values,
int vsize = 1 );
93 void getVariableInfo(
const char *name,
char *type,
int *size );
95 bool dataNameExists(
const char *name );
97 void updateLinearInterpolator(
const char * name,
98 const double x,
const double y,
const bool discontinuity );
100 double evaluateLinearInterpolator(
const char * name,
105 key_t nameToKey(
const char *name )
111 int l = strlen( name );
113 for (
int i = 0; i < l; i++ )
114 k = k ^ ( name[i] << ( 8 * ((i%4) + 1) ) );
122 char name[MAX_NAME_LEN+1];
142 struct hashentry *HASHB, *HASHP;
143 union commentary *COMMB;
145 std::ostringstream _mapFileName;
147 bool exists(
const char *name,
int &value );
148 void create(
const char *name,
char type,
int n,
int &index );
149 void fixname(
const char *in,
char *out );
152 void hashprobe(
int &hashn,
char *name,
int &index );
153 void info(
int &max,
int &left,
int &maxstore,
int &next );
156 log4cpp::Category &_logger;
163 #endif // CARMA_BIMA_SHAREDMEMORY_H
Exception class for errors.
Header file for the CARMA checked build diagnostic macros.
Exception class for Shared Memory errors specific to BIMA Adapted from ErrorException.