/*************************************************************************** * Copyright (C) 2009 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_MSEEDPACKET_H #define GEMPA_CAPS_MSEEDPACKET_H #include #include namespace Gempa { namespace CAPS { class MSEEDDataRecord : public DataRecord { public: MSEEDDataRecord(); virtual const char *formatName() const; 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 = Time(), const Time &end = Time(), int maxSize = -1); virtual bool put(std::streambuf &buf, bool withHeader) const; /** * @brief Returns the packet type * @return The packet type */ PacketType packetType() const { return MSEEDPacket; } /** * @brief Initializes the internal data vector from the given buffer * @param The buffer to read the data from * @param The buffer size */ virtual void setData(const void *data, size_t size); void unpackHeader() { unpackHeader(_data.data(), _data.size()); } protected: Header _header; Time _startTime; Time _endTime; int _dataType; private: void unpackHeader(char *data, size_t size); }; } } #endif