00001 #ifndef SXPACKETHEADER_H_INCLUDED 00002 #define SXPACKETHEADER_H_INCLUDED 00003 00004 #include <QMap> 00005 #include <QVariant> 00006 #include <QDataStream> 00007 #include "sxGlobal.h" 00008 00009 #define SXHDR_CHANNEL_COUNT "channel-count" 00010 #define SXHDR_BLOCK_LENGTH "block-length" 00011 #define SXHDR_SAMPLING_FREQUENCY "sampling-frequency" 00012 #define SXHDR_SAMPLE_DELTA "sample-delta" 00013 #define SXHDR_OVERLAP_LENGTH "overlap-length" 00014 #define SXHDR_DIO_SFREQUENCY "dio-sfrequency" 00015 #define SXHDR_PACKET_ID "packet-id" 00016 #define SXHDR_TIME_CREATED "time-created" 00017 #define SXHDR_TIME_ID "time-id" 00018 #define SXHDR_END_MARK "%:" 00019 #define SXHDR_SPLITTER_MARK "%$" 00020 00024 class SX_SDKEXPORT sxPacketHeader 00025 { 00026 public: 00027 virtual ~sxPacketHeader(); 00028 00029 sxPacketHeader(); 00030 explicit sxPacketHeader(const sxPacketHeader& desc); 00031 sxPacketHeader &operator=(const sxPacketHeader& desc); 00032 00033 QString ToString() const; 00034 void FromString(const QString& str, bool clearOld = true); 00035 void Serialize(QDataStream & ds) const; 00036 void Deserialize(QDataStream & ds); 00037 bool Merge(const sxPacketHeader& desc); 00038 sxPacketHeader * Clone() const; 00039 void Clear(); 00040 size_t Size() const; 00041 bool Contains(const QString & key) const; 00042 bool IsEmpty() const; 00043 void Remove(const QString & key); 00044 void Set(const QString& key, const QVariant& value); 00045 QVariant Get(const QString& key, const QVariant& defaultValue = QVariant()) const; 00046 private: 00047 QMap<QString, QVariant> xValues; 00048 }; 00049 00050 00051 #endif // SXPACKETHEADER_H_INCLUDED