frameutils/swapframe.hh

00001 /* -*- mode: c++; c-basic-offset: 4; -*- */
00002 #ifndef SWAPFRAME_HH
00003 #define SWAPFRAME_HH
00004 
00014 class SwapFrame {
00015 public:
00020     SwapFrame(void);
00021 
00025     ~SwapFrame(void);
00026 
00032     void Swap(char* p, int len);
00033 
00034 private:
00035     enum wType {
00036         kNone = 0,
00037         kChar,
00038         kString,
00039         kShort,
00040         kInt,
00041         kDouble,
00042         kPtr
00043     };
00044 
00045     void SwapString(int N=1);
00046     void SwapShort(int N=1);
00047     void SwapInt(int N=1);
00048     void SwapDouble(int N=1);
00049     short SwapHdr(void);
00050     bool procFileHdr(void);
00051     void procSH(void);
00052     void procSE(void);
00053     void procVect(void);
00054     void Bump(int nBytes) {mPtr += nBytes; mLeft -= nBytes;}
00055 
00056 #define MAXID     32
00057 #define MAXTABLE 128
00058 
00059 private:
00060     bool  mBigEnd;    // byte ordering of the present machine.
00061     char* mPtr;
00062     int   mLeft;
00063     int*  mTable[MAXID];
00064     int   mLastID;
00065     int   mVectID;
00066 };
00067 
00068 #endif // SWAPFRAME_HH

Generated on Sun Mar 8 19:20:47 2009 for dmt by  doxygen 1.5.4