00001 #pragma ident "$Id: MDPHeader.hpp 3140 2012-06-18 15:03:02Z susancummins $"
00002
00003
00004
00005
00006
00007
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 #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
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
00116
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 };
00140
00141 }
00142
00143 #endif // MDPHEADER_HPP