Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

edfmacros.h

Go to the documentation of this file.
00001 /*
00002 NeuroServer
00003  
00004 A collection of programs to translate between EEG data and TCP network
00005 messages. This is a part of the OpenEEG project, see http://openeeg.sf.net
00006 for details.
00007     
00008 Copyright (C) 2003, 2004 Rudi Cilibrasi (cilibrar@ofb.net)
00009      
00010 This library is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU Lesser General Public
00012 License as published by the Free Software Foundation; either
00013 version 2.1 of the License, or (at your option) any later version.
00014          
00015 This library is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 Lesser General Public License for more details.
00019              
00020 You should have received a copy of the GNU Lesser General Public
00021 License along with this library; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
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

Generated on Tue Feb 8 00:05:15 2005 for Neuroserver by doxygen 1.3.3