MDPHeader.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: MDPHeader.hpp 3140 2012-06-18 15:03:02Z susancummins $"
00002 
00003 //============================================================================
00004 //
00005 //  This file is part of GPSTk, the GPS Toolkit.
00006 //
00007 //  The GPSTk is free software; you can redistribute it and/or modify
00008 //  it under the terms of the GNU Lesser General Public License as published
00009 //  by the Free Software Foundation; either version 2.1 of the License, or
00010 //  any later version.
00011 //
00012 //  The GPSTk is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU Lesser General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU Lesser General Public
00018 //  License along with GPSTk; if not, write to the Free Software Foundation,
00019 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00020 //  
00021 //  Copyright 2004, The University of Texas at Austin
00022 //
00023 //============================================================================
00024 
00025 //============================================================================
00026 //
00027 //This software developed by Applied Research Laboratories at the University of
00028 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00029 //Department of Defense. The U.S. Government retains all rights to use,
00030 //duplicate, distribute, disclose, or release this software. 
00031 //
00032 //Pursuant to DoD Directive 523024 
00033 //
00034 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00035 //                           release, distribution is unlimited.
00036 //
00037 //=============================================================================
00038 
00039 #ifndef MDPHEADER_HPP
00040 #define MDPHEADER_HPP
00041 
00047 #include <map>
00048 #include <iostream>
00049 
00050 #include <Exception.hpp>
00051 #include <CommonTime.hpp>
00052 #include <StringUtils.hpp>
00053 #include <BinUtils.hpp>
00054 
00055 #include <FFData.hpp>
00056 #include <FFStream.hpp>
00057 #include "DataStatus.hpp"
00058 
00059 #include <RinexObsData.hpp>
00060 
00061 #if !defined( __SUNPRO_CC ) && !defined( _MSC_VER )
00062 #include <stdint.h>
00063 #endif
00064 
00065 
00066 namespace gpstk
00067 {
00068 
00069    class MDPStream;
00070 
00073    class MDPHeader : public FFData, public CRCDataStatus
00074    {
00075    public:
00076       MDPHeader() throw() : id(0),length(0),crc(0)
00077       {length=myLength;}
00078 
00079       // Returns whether or not this MDPData is valid.
00080       bool isValid() const {return good();}
00081 
00083       virtual bool isData() const {return true;}
00084 
00088       virtual std::string encode() const throw();
00089          
00094       virtual void decode(std::string str) throw();
00095 
00097       virtual std::string getName() const {return "hdr";}
00098 
00102       void dump(std::ostream& out) const throw();
00103 
00106       void setCRC(std::string& str) const throw(FFStreamError);
00107          
00109       void checkCRC(std::string str) throw();
00110 
00111       unsigned short id;              
00112       gpstk::CommonTime time;            
00113       unsigned short freshnessCount;  
00114 
00115       // These items need to be mutable so they can be set when an object
00116       // is sent to a stream.
00117       mutable unsigned short length;  
00118       mutable unsigned short crc;     
00119 
00120       static const uint16_t myLength;  
00121       static const uint16_t frameWord; 
00122       static int debugLevel;
00123       static bool hexDump;
00124 
00125       void readHeader(MDPStream& s)
00126          throw(FFStreamError, EndOfFile);
00127 
00128       std::string readBody(MDPStream& s)
00129          throw(FFStreamError, EndOfFile);
00130 
00131    protected:
00132       virtual void reallyPutRecord(FFStream& s) const 
00133          throw(std::exception, StringUtils::StringException, 
00134                FFStreamError);
00135 
00136       virtual void reallyGetRecord(FFStream& s)
00137          throw(std::exception, StringUtils::StringException, 
00138                FFStreamError, EndOfFile);
00139    }; // class MDPHeader
00140 
00141 } // namespace gpstk
00142 
00143 #endif // MDPHEADER_HPP

Generated on Sat May 25 03:31:10 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1