1 #ifndef PACKETPP_TLV_DATA
2 #define PACKETPP_TLV_DATA
58 m_Data = other.m_Data;
72 if(recordRawData == NULL)
85 m_Data = other.m_Data;
97 if (m_Data == rhs.m_Data)
106 return (memcmp(m_Data, rhs.m_Data,
getTotalSize()) == 0);
123 bool isNull()
const {
return (m_Data == NULL); }
156 memcpy(&result, m_Data->
recordValue + offset,
sizeof(T));
175 memcpy(m_Data->
recordValue + valueOffset, &newValue,
sizeof(T));
196 template<
typename TLVRecordType>
200 mutable size_t m_RecordCount;
214 m_RecordCount = other.m_RecordCount;
228 m_RecordCount = other.m_RecordCount;
243 TLVRecordType resRec(tlvDataBasePtr);
246 if (tlvDataLen == 0 || resRec.getTotalSize() == 0)
261 TLVRecordType
getNextTLVRecord(TLVRecordType& record, uint8_t* tlvDataBasePtr,
size_t tlvDataLen)
const
263 TLVRecordType resRec(NULL);
269 if ((record.getRecordBasePtr() - tlvDataBasePtr) < 0)
273 if (record.getRecordBasePtr() - tlvDataBasePtr + (int)record.getTotalSize() >= (int)tlvDataLen)
276 resRec.assign(record.getRecordBasePtr() + record.getTotalSize());
277 if (resRec.getTotalSize() == 0)
291 TLVRecordType
getTLVRecord(uint8_t recordType, uint8_t* tlvDataBasePtr,
size_t tlvDataLen)
const
294 while (!curRec.isNull())
296 if (curRec.getType() == recordType)
317 if (m_RecordCount != (
size_t)-1)
318 return m_RecordCount;
322 while (!curRec.isNull())
328 return m_RecordCount;
357 TLVRecordBuilder(uint8_t recType,
const uint8_t* recValue, uint8_t recValueLen);
373 void init(uint8_t recType,
const uint8_t* recValue, uint8_t recValueLen);
376 uint8_t m_RecValueLen;
380 #endif // PACKETPP_TLV_DATA