class TLVWriter
Defined at line 218 of file gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h
Provides a memory efficient encoder for writing data in Weave TLV format.
TLVWriter implements a forward-only, stream-style encoder for Weave TLV data. Applications
write data to an encoding by calling one of the writer's Put() methods, passing associated
tag and value information as necessary. Similarly applications can encode TLV container types
(structures, arrays or paths) by calling the writer's OpenContainer() or EnterContainer()
methods.
A TLVWriter object can write data directly to a fixed output buffer, or to a chain of one or
more PacketBuffer objects. Additionally, applications can supply their own
and
functions to direct output to an arbitrary destination, e.g. a socket or an
event queue.
Public Members
uint32_t ImplicitProfileId
void * AppData
GetNewBufferFunct GetNewBuffer
FinalizeBufferFunct FinalizeBuffer
Protected Members
uintptr_t mBufHandle
uint8_t * mBufStart
uint8_t * mWritePoint
uint32_t mRemainingLen
uint32_t mLenWritten
uint32_t mMaxLen
TLVType mContainerType
Public Methods
void Init (uint8_t * buf, uint32_t maxLen)
*** See WeaveTLVWriter.cpp file for API documentation ***
void InitMalloced (uint8_t *&outBuf,uint32_tinitialBufSize,uint32_tmaxLen)
void Init (PacketBuffer * buf, uint32_t maxLen)
void Init (PacketBuffer *buf,uint32_tmaxLen,boolallowDiscontiguousBuffers)
WEAVE_ERROR Finalize ()
WEAVE_ERROR ContinuePutBytes (const uint8_t * buf, uint32_t len)
WEAVE_ERROR Put (uint64_t tag, int8_t v)
WEAVE_ERROR Put (uint64_ttag,int8_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, int16_t v)
WEAVE_ERROR Put (uint64_ttag,int16_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, int32_t v)
WEAVE_ERROR Put (uint64_ttag,int32_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, int64_t v)
WEAVE_ERROR Put (uint64_ttag,int64_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, uint8_t v)
WEAVE_ERROR Put (uint64_ttag,uint8_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, uint16_t v)
WEAVE_ERROR Put (uint64_ttag,uint16_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, uint32_t v)
WEAVE_ERROR Put (uint64_ttag,uint32_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, uint64_t v)
WEAVE_ERROR Put (uint64_ttag,uint64_tv,boolpreserveSize)
WEAVE_ERROR Put (uint64_t tag, float v)
WEAVE_ERROR Put (uint64_t tag, double v)
WEAVE_ERROR PutBoolean (uint64_t tag, bool v)
WEAVE_ERROR PutBytes (uint64_ttag,const uint8_t *buf,uint32_tlen)
WEAVE_ERROR StartPutBytes (uint64_t tag, uint32_t totalLen)
WEAVE_ERROR PutString (uint64_t tag, const char * buf)
WEAVE_ERROR PutString (uint64_ttag,const char *buf,uint32_tlen)
WEAVE_ERROR PutStringF (uint64_t tag, const char * fmt)
WEAVE_ERROR VPutStringF (uint64_ttag,const char *fmt,va_listap)
WEAVE_ERROR PutNull (uint64_t tag)
WEAVE_ERROR CopyElement (TLVReader & reader)
WEAVE_ERROR CopyElement (uint64_t tag, TLVReader & reader)
WEAVE_ERROR StartContainer (uint64_ttag,TLVTypecontainerType,TLVType &outerContainerType)
WEAVE_ERROR EndContainer (TLVType outerContainerType)
WEAVE_ERROR OpenContainer (uint64_ttag,TLVTypecontainerType,TLVWriter &containerWriter)
WEAVE_ERROR CloseContainer (TLVWriter & containerWriter)
WEAVE_ERROR PutPreEncodedContainer (uint64_ttag,TLVTypecontainerType,const uint8_t *data,uint32_tdataLen)
WEAVE_ERROR CopyContainer (TLVReader & container)
WEAVE_ERROR CopyContainer (uint64_t tag, TLVReader & container)
WEAVE_ERROR CopyContainer (uint64_ttag,const uint8_t *encodedContainer,uint16_tencodedContainerLen)
TLVType GetContainerType ()
uint32_t GetLengthWritten ()
WEAVE_ERROR GetNewPacketBuffer (TLVWriter &writer,uintptr_t &bufHandle,uint8_t *&bufStart,uint32_t &bufLen)
Implementations of GetNewBufferFunct/FinalizeBufferFunct that support writing into one or more
PacketBuffers.
WEAVE_ERROR FinalizePacketBuffer (TLVWriter &writer,uintptr_tbufHandle,uint8_t *bufStart,uint32_tdataLen)
WEAVE_ERROR GetNewBuffer_Malloced (TLVWriter &writer,uintptr_t &bufHandle,uint8_t *&bufStart,uint32_t &bufLen)
Implementations of the GetNewBufferFunct that support writing into a dynamic buffer
Protected Methods
bool IsContainerOpen ()
Defined at line 311 of file gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h
bool IsCloseContainerReserved ()
Determine whether the container should reserve space for the
CloseContainer symbol at the point of starting / opening the
container.
Defined at line 324 of file gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h
void SetContainerOpen (bool aContainerOpen)
Defined at line 312 of file gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h
void SetCloseContainerReserved (bool aCloseContainerReserved)
Set whether the container should reserve the space for the
CloseContainer symbol at the point of starting / opening the
container.
Defined at line 332 of file gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h
WEAVE_ERROR WriteElementHead (TLVElementTypeelemType,uint64_ttag,uint64_tlenOrVal)
WEAVE_ERROR WriteElementWithData (TLVTypetype,uint64_ttag,const uint8_t *data,uint32_tdataLen)
WEAVE_ERROR WriteData (const uint8_t * p, uint32_t len)
Enumerations
enum (unnamed)
| Name | Value | Comments |
|---|---|---|
| kEndOfContainerMarkerSize | 1 |
Size of the EndOfContainer marker, used in reserving space. |
Defined at line 314 of file gen/third_party/openweave-core/src/include/Weave/Core/WeaveTLV.h
Friends
class TLVUpdater