00001 #pragma ident "$Id: CodeBuffer.hpp 500 2007-04-27 12:02:53Z ocibu $"
00002
00003
00004
00005
00006 #ifndef CODEBUFFER_HPP
00007 #define CODEBUFFER_HPP
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #include "DayTime.hpp"
00052
00053
00054 #include "PCodeConst.hpp"
00055
00056 namespace gpstk
00057 {
00081 class CodeBuffer
00082 {
00083 public:
00085
00086
00091 CodeBuffer( const int SVPRNID );
00092 ~CodeBuffer( );
00093 CodeBuffer& operator=( const CodeBuffer& c );
00094
00099 void updateBufferStatus( const gpstk::DayTime& dt,
00100 const codeType PYFlag );
00101
00108 void updateBufferStatus( const codeType PYFlag ) { POrYCode = PYFlag; }
00109
00111 const gpstk::DayTime& getCurrentTime( ) { return(currentTime); }
00112
00114 codeType getPYFlag( ) { return(POrYCode); }
00115
00117 int getPRNID( ) { return(PRNID); }
00118
00120 unsigned long& operator[]( int i );
00121 const unsigned long& operator[]( const int i ) const;
00122
00127 unsigned long getBit( const long i ) const;
00128
00132 CodeBuffer& operator^=( const CodeBuffer& cb );
00133
00134 protected:
00135 CodeBuffer( const CodeBuffer& c );
00136 unsigned long * buffer;
00137 int PRNID;
00138 gpstk::DayTime currentTime;
00139 codeType POrYCode;
00140 };
00141
00142 inline CodeBuffer::~CodeBuffer( ) { delete [] buffer; }
00143 inline CodeBuffer& CodeBuffer::operator^=( const CodeBuffer& cb )
00144 {
00145 for (long i=0;i<NUM_6SEC_WORDS;++i) buffer[i] ^= cb.buffer[i];
00146 return( *this );
00147 }
00148
00149 inline unsigned long& CodeBuffer::operator[]( int i )
00150 {
00151 return(buffer[i]);
00152 }
00153
00154 inline const unsigned long& CodeBuffer::operator[]( int i ) const
00155 {
00156 return(buffer[i]);
00157 }
00158
00159 inline unsigned long CodeBuffer::getBit( const long i ) const
00160 {
00161 unsigned long iret;
00162 long bNdx = i / MAX_BIT;
00163 long bitNum = i - (bNdx * MAX_BIT);
00164 iret = buffer[bNdx];
00165
00166
00167 iret <<= bitNum;
00168
00169 iret >>= (MAX_BIT-1);
00170
00171 return iret;
00172 }
00174 }
00175 #endif // CODEBUFFER_HPP