Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

keyinfo.h

Go to the documentation of this file.
00001 //**************************************************************************
00002 #ifndef _KEYINFO_H
00003 #define _KEYINFO_H
00004 //**************************************************************************
00005 #include <typeinfo>
00006 #include <vector>
00007 #include "semaphore.h"
00008 //**************************************************************************
00009 typedef enum
00010 {
00011 KEY_READ_ONLY, 
00012 KEY_READ_WRITE 
00013 } Permission;
00014 
00015 typedef enum
00016 {
00017 UNKNOWN,
00018 CHAR,
00019 SHORT,
00020 INT,
00021 LONG,
00022 FLOAT,
00023 DOUBLE
00024 } VariableType;
00025 
00026 typedef enum
00027 {
00028 GENERIC_DATA = 0,
00029 VARIABLE,
00030 CUSTOM_STRUCTURE,
00031 STATIC_1D_ARRAY,
00032 STATIC_2D_ARRAY,
00033 STATIC_3D_ARRAY,
00034 STATIC_4D_ARRAY,
00035 DYNAMIC_1D_ARRAY,
00036 DYNAMIC_2D_ARRAY,
00037 DYNAMIC_3D_ARRAY,
00038 DYNAMIC_4D_ARRAY
00039 } DataType;
00040 
00041 static char DataTypeDesc[][30] = {
00042 "Generic Data",
00043 "Variable",
00044 "Custom Structure",
00045 "Static 1D Array",
00046 "Static 2D Array",
00047 "Static 3D Array",
00048 "Static 4D Array",
00049 "Dynamic 1D Array",
00050 "Dynamic 2D Array",
00051 "Dynamic 3D Array",
00052 "Dynamic 4D Array"
00053 };
00054 
00055 typedef struct
00056 {
00057         int id;
00058         int elem_size;
00059         int num_elems;
00060         int is_locked;
00061         int is_dirty;
00062         char key[30];
00063         char type[80];
00064         char value[100];
00065         DataType description;
00066         Permission perm;
00067         void *ptr;
00068         void (*callback)(void*);
00069         void *callbackdata;
00070         Semaphore *sem;
00071         VariableType vartype;
00072 } KeyInfo;
00073 
00074 class KeyTable
00075 {
00076         public:
00077         int n;
00078         vector<KeyInfo> key;
00079 
00080         KeyTable();
00081         ~KeyTable();
00082         int Add();
00083         int getKeyHandle(char *keyword);
00084         char *Description(int i) { return DataTypeDesc[key[i].description]; }
00085         bool isVar(int i);
00086         bool isVar(char *keyword);
00087         bool isCharArray(int i);
00088         bool isCharArray(char *keyword);
00089         bool isValidKeyword(char *keyword);
00090         bool isViewableVar(int i);
00091         bool isViewableVar(char *keyword);
00092         bool isWritable(int i);
00093         bool isWritable(char *keyword);
00094         bool isArray(int i);
00095         bool isArray(char *keyword);
00096         bool isStaticArray(int i);
00097         bool isStaticArray(char *keyword);
00098         void List();
00099         void ListValues();
00100         void RegisterCallback(char *keyword, void (*cb)(void*), void *data);
00101         bool hasCallback(int i);
00102         bool hasCallback(char *keyword);
00103         void Callback(int i);
00104         void Callback(char *keyword);
00105 };
00106 //**************************************************************************
00107 int packStruct(KeyTable *T, unsigned char **dataptr, int &totsize);
00108 int unpackStruct(KeyTable *T, unsigned char *data, int size);
00109 //**************************************************************************
00110 #ifdef __GNUC__
00111 extern char *demangle_type(const char *s);
00112 #define keyType(T) demangle_type(typeid(T).name())
00113 #else
00114 #define keyType(T) ((char *) typeid(T).name())
00115 #endif
00116 //**************************************************************************
00117 #endif  // _KEYINFO_H
00118 //**************************************************************************

Generated on Sun Jun 16 17:36:41 2002 for Anirudh's Vortex-Wake Simulation Code by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001