ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cStaticDecoder

Decoder for static structures defined by a DDL definition. More...

#include <static_codec.h>

Inheritance diagram for cStaticDecoder:
[legend]

Public Types

typedef adtf_ddl::tStructElement DefinedStructElementType
 

Public Member Functions

 cStaticDecoder ()
 Default constructor.
 
 cStaticDecoder (cStaticDecoder &&)=default
 Move constructor.
 
cStaticDecoderoperator= (cStaticDecoder &&)=default
 Move assignment operator.
 
virtual tResult IsValid () const
 
virtual size_t GetElementCount () const
 
tResult GetElement (size_t nIndex, const tStructElement *&pElement) const
 Access information about an element.
 
tResult GetElementValue (size_t nIndex, void *pValue) const
 Returns the current value of the given element by copying its data to the passed-in location.
 
tResult GetElementValue (size_t nIndex, A_UTILS_NS::cVariant &oValue) const
 Returns the current value of the given element as a variant.
 
const void * GetElementAddress (size_t nIndex) const
 
size_t GetStaticBufferSize (tDataRepresentation eRep=tDataRepresentation::Deserialized) const
 
tDataRepresentation GetRepresentation () const
 
A_UTILS_NS::cString GetElementValueString (size_t nIndex) const
 Returns the current value of the given element as a string.
 

Static Public Member Functions

static const char * GetStructElementName (const tStructElement *pElement)
 Access information about an element.
 

Protected Member Functions

 cStaticDecoder (std::shared_ptr< const cStructLayout > pLayout, const void *pData, size_t nDataSize, tDataRepresentation eRep)
 For internal use only.
 
virtual const tStructLayoutElement * GetLayoutElement (size_t nIndex) const
 For internal use only.
 

Protected Attributes

std::shared_ptr< const cStructLayout > m_pLayout
 For internal use only.
 
const void * m_pData
 For internal use only.
 
size_t m_nDataSize
 For internal use only.
 
const cElementAccessor * m_pElementAccessor
 For internal use only.
 

Detailed Description

Decoder for static structures defined by a DDL definition.

Definition at line 20 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/extern/pkg_ddl/include/adtfddl/codec/static_codec.h.

Member Typedef Documentation

◆ DefinedStructElementType

Member Function Documentation

◆ GetElement()

tResult GetElement ( size_t nIndex,
const tStructElement *& pElement ) const

Access information about an element.

Parameters
[in]nIndexThe index of the element.
[out]pElementPointer that will be updated to point to the element information.
Return values
ERR_INVALID_INDEXInvalid element index.

Referenced by cSampleDecoder::operator=().

◆ GetElementAddress()

const void * GetElementAddress ( size_t nIndex) const
Parameters
[in]nIndexThe index of the element.
Returns
A pointer to the element or nullptr in case of an error.

Referenced by cCodec::GetElementAddress(), and cStaticCodec::GetElementAddress().

◆ GetElementCount()

virtual size_t GetElementCount ( ) const
virtual
Returns
The amount of elements contained in the data structure.

Reimplemented in cDecoder.

◆ GetElementValue() [1/2]

tResult GetElementValue ( size_t nIndex,
A_UTILS_NS::cVariant & oValue ) const

Returns the current value of the given element as a variant.

Parameters
[in]nIndexThe index of the element.
[out]oValueThe will be set to the current value.
Return values
ERR_INVALID_INDEXInvalid element index.

◆ GetElementValue() [2/2]

tResult GetElementValue ( size_t nIndex,
void * pValue ) const

Returns the current value of the given element by copying its data to the passed-in location.

Parameters
[in]nIndexThe index of the element.
[out]pValueThe location where the value should be copied to.
Return values
ERR_INVALID_INDEXInvalid element index.

Referenced by cSampleDecoder::operator=().

◆ GetElementValueString()

A_UTILS_NS::cString GetElementValueString ( size_t nIndex) const

Returns the current value of the given element as a string.

Parameters
[in]nIndexThe index of the element.
Return values
A_UTILS_NS::cStringValue as string or empty if not found.

◆ GetLayoutElement()

virtual const tStructLayoutElement * GetLayoutElement ( size_t nIndex) const
protectedvirtual

For internal use only.

Reimplemented in cDecoder.

◆ GetRepresentation()

tDataRepresentation GetRepresentation ( ) const
Returns
The data representation which this decoder handles.

◆ GetStaticBufferSize()

size_t GetStaticBufferSize ( tDataRepresentation eRep = tDataRepresentation::Deserialized) const
Parameters
[in]eRepThe data representation for which the buffer size should be returned.
Returns
The size of the structure in the requested data representation.

◆ GetStructElementName()

static const char * GetStructElementName ( const tStructElement * pElement)
static

Access information about an element.

Parameters
[in]pElementpointer to the element to retriev the name from
Return values
ERR_INVALID_INDEXInvalid element index.

◆ IsValid()

virtual tResult IsValid ( ) const
virtual
Returns
Whether or not the decoder is valid.
Return values
ERR_INVALID_ARGThe passed data is not large enough.

Reimplemented in cDecoder.

Member Data Documentation

◆ m_nDataSize

size_t m_nDataSize
protected

◆ m_pData

const void* m_pData
protected

◆ m_pElementAccessor

const cElementAccessor* m_pElementAccessor
protected

◆ m_pLayout

std::shared_ptr<const cStructLayout> m_pLayout
protected