CodeBuffer.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: CodeBuffer.hpp 500 2007-04-27 12:02:53Z ocibu $"
00002 
00003 
00004 //  CodeBuffer.hpp  
00005 
00006 #ifndef CODEBUFFER_HPP
00007 #define CODEBUFFER_HPP
00008 
00009 //============================================================================
00010 //
00011 //  This file is part of GPSTk, the GPS Toolkit.
00012 //
00013 //  The GPSTk is free software; you can redistribute it and/or modify
00014 //  it under the terms of the GNU Lesser General Public License as published
00015 //  by the Free Software Foundation; either version 2.1 of the License, or
00016 //  any later version.
00017 //
00018 //  The GPSTk is distributed in the hope that it will be useful,
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 //  GNU Lesser General Public License for more details.
00022 //
00023 //  You should have received a copy of the GNU Lesser General Public
00024 //  License along with GPSTk; if not, write to the Free Software Foundation,
00025 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 //  
00027 //  Copyright 2004, The University of Texas at Austin
00028 //
00029 //============================================================================
00030 
00031 //============================================================================
00032 //
00033 //This software developed by Applied Research Laboratories at the University of
00034 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00035 //Department of Defense. The U.S. Government retains all rights to use,
00036 //duplicate, distribute, disclose, or release this software. 
00037 //
00038 //Pursuant to DoD Directive 523024 
00039 //
00040 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00041 //                           release, distribution is unlimited.
00042 //
00043 //=============================================================================
00044 
00045 
00046 
00047 
00048 
00049 
00050    // Library headers
00051 #include "DayTime.hpp"
00052 
00053    // Project headers
00054 #include "PCodeConst.hpp"
00055 
00056 namespace gpstk
00057 {
00081    class CodeBuffer
00082    {
00083       public:
00085          //enum codeType { P_CODE, Y_CODE, BOTH }; 
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       // Shift LEFT to clear off msbs
00167       iret <<= bitNum;
00168       // Then shift RIGHT to clear off lsbs
00169       iret >>= (MAX_BIT-1);
00170    
00171       return iret;
00172    }
00174 }     // end of namespace
00175 #endif // CODEBUFFER_HPP

Generated on Wed Feb 8 03:30:57 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1