00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __EDFMACROS_H
00028 #define __EDFMACROS_H
00029
00030 #define DECODEHEADERFIELD(packet, fieldName) \
00031 packet+offsetof(struct EDFPackedHeader,fieldName), sizeof((struct EDFPackedHeader *)0)->fieldName
00032
00033 #define DECODECHANNELFIELD(packet, fieldName, whichChannel, totalChannels) \
00034 packet+totalChannels*offsetof(struct EDFPackedChannelHeader,fieldName) + whichChannel*sizeof(((struct EDFPackedChannelHeader *)0)->fieldName),sizeof((struct EDFPackedChannelHeader *)0)->fieldName
00035
00036 #define LOADHFI(m) \
00037 result->m = EDFUnpackInt(DECODEHEADERFIELD(packet, m))
00038 #define LOADHFD(m) \
00039 result->m = EDFUnpackDouble(DECODEHEADERFIELD(packet, m))
00040 #define LOADHFS(m) \
00041 strcpy(result->m, EDFUnpackString(DECODEHEADERFIELD(packet, m)))
00042
00043 #define LOADCFI(m) \
00044 result->m = EDFUnpackInt(DECODECHANNELFIELD(packet, m, whichChannel, totalChannels))
00045 #define LOADCFD(m) \
00046 result->m = EDFUnpackDouble(DECODECHANNELFIELD(packet, m, whichChannel, totalChannels))
00047 #define LOADCFS(m) \
00048 strcpy(result->m, EDFUnpackString(DECODECHANNELFIELD(packet, m, whichChannel, totalChannels)))
00049
00050 #define STORECFI(m, i) \
00051 storeEDFInt(DECODECHANNELFIELD(packet, m, whichChannel, totalChannels), i)
00052 #define STORECFD(m, d) \
00053 storeEDFDouble(DECODECHANNELFIELD(packet, m, whichChannel, totalChannels), d)
00054 #define STORECFS(m, s) \
00055 storeEDFString(DECODECHANNELFIELD(packet, m, whichChannel, totalChannels), s)
00056
00057 #define STOREHFI(m, i) \
00058 storeEDFInt(DECODEHEADERFIELD(packet, m), i)
00059 #define STOREHFD(m, d) \
00060 storeEDFDouble(DECODEHEADERFIELD(packet, m), d)
00061 #define STOREHFS(m, s) \
00062 storeEDFString(DECODEHEADERFIELD(packet, m), s)
00063
00064 #endif