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

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

#include <static_codec_legacy.h>

Inheritance diagram for StaticDecoder:
[legend]

Public Member Functions

 ~StaticDecoder ()=default
 virtual DTOR
 
DEV_ESSENTIAL_DEPRECATED_STATIC_DECODER StaticDecoder ()
 Default constructor.
 
 StaticDecoder (const StaticDecoder &)=delete
 Noncopyable.
 
StaticDecoderoperator= (const StaticDecoder &)=delete
 Noncopyable.
 
 StaticDecoder (StaticDecoder &&)=default
 Move constructor.
 
DEV_ESSENTIAL_DEPRECATED_STATIC_DECODER StaticDecoderoperator= (StaticDecoder &&)=default
 Move assignment operator.
 
virtual a_util::result::Result isValid () const
 
virtual size_t getElementCount () const
 
a_util::result::Result getElement (size_t index, const StructElement *&element) const
 Access information about an element.
 
a_util::result::Result getElementValue (size_t index, void *value) const
 Returns the current value of the given element by copying its data to the passed-in location.
 
a_util::result::Result getElementValue (size_t index, a_util::variant::Variant &value) const
 Returns the current value of the given element as a variant.
 
const void * getElementAddress (size_t index) const
 
size_t getStaticBufferSize (DataRepresentation rep=deserialized) const
 
DataRepresentation getRepresentation () const
 

Protected Member Functions

 StaticDecoder (std::shared_ptr< const StructLayout > layout, const void *data, size_t data_size, DataRepresentation rep)
 For internal use only.
 
 StaticDecoder (const std::shared_ptr< LegacyCodecAccess > &legacy_codec_access)
 For internal use only.
 

Protected Attributes

std::shared_ptr< LegacyCodecAccess > _legacy_access
 For internal use only.
 
const void * _compat_data
 For internal use only.
 
size_t _compat_data_size
 For internal use only.
 
const void * _compat_element_accessor
 For internal use only.
 

Detailed Description

Decoder for static structures defined by a DataDefinition definition.

Deprecated
Use the new StaticDecoder() instead.

Definition at line 39 of file static_codec_legacy.h.

Member Function Documentation

◆ getElement()

a_util::result::Result getElement ( size_t index,
const StructElement *& element ) const

Access information about an element.

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

◆ getElementAddress()

const void * getElementAddress ( size_t index) const
Parameters
[in]indexThe index of the element.
Returns
A pointer to the element or NULL in case of an error.

Referenced by Codec::getElementAddress(), and StaticCodec::getElementAddress().

◆ getElementCount()

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

Reimplemented in Decoder.

◆ getElementValue() [1/2]

a_util::result::Result getElementValue ( size_t index,
a_util::variant::Variant & value ) const

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

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

◆ getElementValue() [2/2]

a_util::result::Result getElementValue ( size_t index,
void * value ) const

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

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

◆ getRepresentation()

DataRepresentation getRepresentation ( ) const
Returns
The data representation which this decoder handles.

◆ getStaticBufferSize()

size_t getStaticBufferSize ( DataRepresentation rep = deserialized) const
Parameters
[in]repThe data representation for which the buffer size should be returned.
Returns
The size of the structure in the requested data representation.

References ddl::deserialized.

◆ isValid()

virtual a_util::result::Result isValid ( ) const
virtual
Returns
Whether or not the decoder is valid.
Return values
ERR_INVALID_ARGThe passed data is not large enough.

Reimplemented in Decoder.

Member Data Documentation

◆ _compat_data

const void* _compat_data
protected

For internal use only.

Definition at line 140 of file static_codec_legacy.h.

◆ _compat_data_size

size_t _compat_data_size
protected

For internal use only.

Definition at line 143 of file static_codec_legacy.h.

◆ _compat_element_accessor

const void* _compat_element_accessor
protected

For internal use only.

Definition at line 146 of file static_codec_legacy.h.

◆ _legacy_access

std::shared_ptr<LegacyCodecAccess> _legacy_access
protected

For internal use only.

Definition at line 137 of file static_codec_legacy.h.