You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.1 KiB
C++

/***************************************************************************
* Copyright (C) 2012 by gempa GmbH *
* *
* All Rights Reserved. *
* *
* NOTICE: All information contained herein is, and remains *
* the property of gempa GmbH and its suppliers, if any. The intellectual *
* and technical concepts contained herein are proprietary to gempa GmbH *
* and its suppliers. *
* Dissemination of this information or reproduction of this material *
* is strictly forbidden unless prior written permission is obtained *
* from gempa GmbH. *
***************************************************************************/
#ifndef GEMPA_CAPS_RTCM2PACKET_H
#define GEMPA_CAPS_RTCM2PACKET_H
#include <gempa/caps/endianess.h>
#include <gempa/caps/packet.h>
#include <vector>
namespace Gempa {
namespace CAPS {
class RTCM2DataRecord : public DataRecord {
public:
struct RTCM2Header : Header {
bool get(std::streambuf &buf) {
Endianess::Reader get(buf);
get(samplingTime.year);
get(samplingTime.yday);
get(samplingTime.hour);
get(samplingTime.minute);
get(samplingTime.second);
get(samplingTime.usec);
get(samplingFrequencyNumerator);
get(samplingFrequencyDenominator);
return get.good;
}
bool put(std::streambuf &buf) const;
// size of data header
int dataSize() const {
return
sizeof(samplingTime.year) +
sizeof(samplingTime.yday) +
sizeof(samplingTime.hour) +
sizeof(samplingTime.minute) +
sizeof(samplingTime.second) +
sizeof(samplingTime.usec) +
sizeof(samplingFrequencyNumerator) +
sizeof(samplingFrequencyDenominator);
}
};
RTCM2DataRecord();
const char* formatName() const;
void setTimeStamp(const Time &ts);
void setSamplingFrequency(uint16_t numerator, uint16_t denominator);
virtual bool readMetaData(std::streambuf &buf, int size,
Header &header,
Time &startTime,
Time &endTime);
virtual const Header *header() const;
virtual Time startTime() const;
virtual Time endTime() const;
virtual bool canTrim() const;
virtual bool canMerge() const;
virtual bool trim(const Time &start,
const Time &end) const;
virtual size_t dataSize(bool withHeader) const;
virtual ReadStatus get(std::streambuf &buf, int size,
const Time &start,
const Time &end,
int maxSize = -1);
virtual bool put(std::streambuf &buf, bool withHeader) const;
PacketType packetType() const { return RTCM2Packet; }
private:
RTCM2Header _header;
Buffer _data;
Time _startTime;
Time _endTime;
};
}
}
#endif