ADTF
Loading...
Searching...
No Matches
adtf::mediadescription::osborn::cSampleDecoderBase Class Reference

#include <sample_codec.h>

Inherits adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy.

Inherited by adtf::mediadescription::osborn::cSampleCodec, adtf::mediadescription::osborn::cSampleDecoder, adtf::mediadescription::osborn::cStaticSampleCodec, and adtf::mediadescription::osborn::cStaticSampleDecoder.

Public Types

typedef ddl::codec::DecoderElement< sample_decoder_access< const cSampleDecoderBase > > tElement
 
typedef ddl::codec::ChildElements< sample_decoder_access< const cSampleDecoderBase > > tElements
 
- Public Types inherited from adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy
typedef ddl::StructElement DefinedStructElementType
 type definition for the old access_element API.
 

Public Member Functions

 cSampleDecoderBase ()
 
 cSampleDecoderBase (cSampleDecoderBase &&)
 
cSampleDecoderBaseoperator= (cSampleDecoderBase &&)
 
tResult IsValid () const
 
tElement GetElement (const tCodecIndex &oCodecIndex) const
 
tElement GetElement (std::string_view strElementFullName) const
 
tElement GetChildElement (const tCodecIndex &oCodecIndex, std::string_view strElementPath) const
 
const tElementsGetElements () const
 
size_t GetElementChildCount (const tCodecIndex &oCodecIndex) const
 
std::string GetElementFullName (const tCodecIndex &oCodecIndex) const
 Retrieves the full name of the element within its main structure.
 
std::string GetElementName (const tCodecIndex &oCodecIndex) const
 Retrieves the name of the element within its structured element.
 
const std::string & GetElementBaseName (const tCodecIndex &oCodecIndex) const
 Retrieves the base name of the element within its structured element.
 
size_t GetStaticBufferSize () const
 Gets the static buffer size in bytes for the main structure.
 
size_t GetStaticBufferSize (ddl::tDataRepresentation eRep) const
 Gets the static buffer size in bytes for the main structure.
 
ddl::tDataRepresentation GetRepresentation () const
 
template<typename T>
GetElementValue (const tCodecIndex &oCodecIndex) const
 Gets the elements value as value of type T. You may use a valid codec index retrieved by the cSampleCodecFactory, but no other! This is to prepare for decoding in advance:
 
template<typename T>
GetElementValue (const penguin::tLeafCodecIndex &oLeafCodecIndex) const
 Gets the elements value as value of type T. You may use a valid codec index retrieved by the cSampleCodecFactory, but no other! This is to prepare for decoding in advance:
 
a_util::variant::Variant GetElementVariantValue (const tCodecIndex &oCodecIndex) const
 
void GetElementVariantValue (const tCodecIndex &oCodecIndex, a_util::variant::Variant &oValue) const
 
std::string GetElementStringValue (const tCodecIndex &oCodecIndex) const
 
void GetElementRawValue (const tCodecIndex &oCodecIndex, void *pValue, size_t szValueSize) const
 Copies the elements value to the given memory pointer in pValue.
 
const void * GetElementAddress (const tCodecIndex &oCodecIndex) const
 Gets the elements value memory pointer into the given data.
 
void Resolve (tCodecIndex &oCodecIndex) const
 
tResult GetElement (tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
 Get the Element StructElement information.
 
adtf_util::cVariant GetElementValue (tCodecLeafIndex nElementLeafIndex) const
 Legacy: Get the Element Value.
 
tResult GetElementValue (tCodecLeafIndex nElementLeafIndex, adtf_util::cVariant &oValue) const
 Legacy: Get the Element Value.
 
tResult GetElementValue (const char *strElementName, adtf_util::cVariant &oValue) const
 Legacy: Get the Element Value.
 
tResult GetElementValue (tCodecLeafIndex nElementLeafIndex, void *pValue) const
 Legacy: Copies the Element Value memory into the memory pointer. Keep in MIND this function is UNSAFE in case of value memory is biger than the given one.
 
tResult GetElementValue (const char *strElementName, void *pValue) const
 Legacy: Get the Element Value pointer.
 
const void * GetElementAddress (tCodecLeafIndex nElementLeafIndex) const
 Legacy: Get the Element StructElement information.
 
tCodecIndex Resolve (tCodecLeafIndex nElementLeafIndex) const
 
- Public Member Functions inherited from adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy
tCodecIndex Resolve (tCodecLeafIndex nElementLeafIndex) const
 
adtf_util::cVariant GetElementValue (tCodecLeafIndex nElementLeafIndex) const
 Legacy: Get the Element Value.
 
tResult GetElementValue (tCodecLeafIndex nElementLeafIndex, adtf_util::cVariant &oValue) const
 Legacy: Get the Element Value.
 
tResult GetElementValue (const char *strElementName, adtf_util::cVariant &oValue) const
 Legacy: Get the Element Value.
 
tResult GetElementValue (tCodecLeafIndex nElementLeafIndex, void *pValue) const
 Legacy: Copies the Element Value memory into the memory pointer. Keep in MIND this function is UNSAFE in case of value memory is biger than the given one.
 
tResult GetElementValue (const char *strElementName, void *pValue) const
 Legacy: Get the Element Value pointer.
 
adtf_util::cString GetElementValueString (tCodecLeafIndex nElementLeafIndex) const
 Legacy: Get the Element Value as string (resolved to the enum element name if is enum type)
 
tResult GetElement (tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
 Get the Element StructElement information.
 
const void * GetElementAddress (tCodecLeafIndex nElementLeafIndex) const
 Legacy: Get the Element StructElement information.
 
size_t GetElementCount () const
 Legacy: Get the Element Leaf count.
 

Protected Member Functions

void ResetFirst ()
 
- Protected Member Functions inherited from adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy
virtual const ddl::codec::StaticDecodergetDecoder () const =0
 Get the base ddl::Decoder.
 

Additional Inherited Members

- Static Public Member Functions inherited from adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy
static const char * GetStructElementName (const ddl::StructElement *pElement)
 Legacy: Get the Struct Element Name for access_element legacy support.
 

Detailed Description

Decoder Base Class.

Member Typedef Documentation

◆ tElement

Iterator value element type for the codec to get value, set value and get element information.

See also
for_each_leaf_element
ddl::codec::DecoderElement

◆ tElements

Constructor & Destructor Documentation

◆ cSampleDecoderBase() [1/2]

adtf::mediadescription::osborn::cSampleDecoderBase::cSampleDecoderBase ( )

Default constructor

◆ cSampleDecoderBase() [2/2]

adtf::mediadescription::osborn::cSampleDecoderBase::cSampleDecoderBase ( cSampleDecoderBase && )

Move constructor

Member Function Documentation

◆ GetChildElement()

tElement adtf::mediadescription::osborn::cSampleDecoderBase::GetChildElement ( const tCodecIndex & oCodecIndex,
std::string_view strElementPath ) const

Retrieves an element for the given name that is a child of given index.

Parameters
[in]oCodecIndexThe codec index of the parent element.
[in]strElementPathThe full name of the element in point notation (i.e. "element1.child_element[4].element_value").
Returns
tElement the child element found
Remarks
The element is only valid as long as the decoder exists.
Exceptions
throwstResult if not found.

◆ GetElement() [1/3]

tElement adtf::mediadescription::osborn::cSampleDecoderBase::GetElement ( const tCodecIndex & oCodecIndex) const

Retrieves an element for the codec index. You may use a valid codec index retrieved by the cSampleCodecFactory, but no other! This is to prepare for decoding in advance:

//use a sample factory to retrieve all codec indices
cSampleCodecFactory oMyFactory("mystruct", oMyDescription);
auto oCodecIndexOfInterest = oMyFactory.GetElement("my_element_to_decode").getIndex();
//...
auto oDecoder = oMyFactory.MakeStaticDecoderFor(pMySample);
auto oElementOfInterest = oDecoder.GetElement(oCodecIndexOfInterest);
Parameters
[in]oCodecIndexThe codec index retrieved by the used cSampleCodecFactory for this decoder.
Returns
tElement the element
Remarks
The element is only valid as long as the decoder exists.
Exceptions
throwstResult if not found.

◆ GetElement() [2/3]

tElement adtf::mediadescription::osborn::cSampleDecoderBase::GetElement ( std::string_view strElementFullName) const

Retrieves an element for the given name.

Parameters
[in]strElementFullNameThe full name of the element in point notation (i.e. "element1.child_element[4].element_value").
Returns
tElement the element
Remarks
The element is only valid as long as the decoder exists.
Exceptions
throwstResult if not found.

◆ GetElement() [3/3]

tResult adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::GetElement ( tCodecLeafIndex nElementLeafIndex,
const ddl::StructElement *& pElement ) const

Get the Element StructElement information.

Parameters
nElementLeafIndexThe leaf index (between 0 and GetElementCount())
pElementThe legacy StructElement
Returns
tResult
Remarks
This function does not throw! DO NOT STORE and reuse after another GetElement call!
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

◆ GetElementAddress() [1/2]

const void * adtf::mediadescription::osborn::cSampleDecoderBase::GetElementAddress ( const tCodecIndex & oCodecIndex) const

Gets the elements value memory pointer into the given data.

Parameters
[in]oCodecIndexThe codec index of the element.
Returns
The elements value memory pointer into the given data.
Exceptions
throwstResult if not found.

◆ GetElementAddress() [2/2]

const void * adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::GetElementAddress ( tCodecLeafIndex nElementLeafIndex) const

Legacy: Get the Element StructElement information.

Parameters
nElementLeafIndexThe leaf index (between 0 and GetElementCount())
Returns
tResult
Remarks
This function does not throw! DO NOT STORE and reuse after another GetElement call!
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

◆ GetElementBaseName()

const std::string & adtf::mediadescription::osborn::cSampleDecoderBase::GetElementBaseName ( const tCodecIndex & oCodecIndex) const

Retrieves the base name of the element within its structured element.

If the element is an array you get the elements base name respresentation : "element_name" for each array element. If the element is not an array you get the elements name respresentation is also the base name respresentation: "element_name" .

Parameters
[in]oCodecIndexThe codec index of the element.
Returns
The base name of the element.
Exceptions
throwstResult if not found.

◆ GetElementChildCount()

size_t adtf::mediadescription::osborn::cSampleDecoderBase::GetElementChildCount ( const tCodecIndex & oCodecIndex) const

Retrieves the amount of child elements for the given codec index.

Parameters
[in]oCodecIndexThe codec index of the element.
Return values
0has no children. May be a leaf element.
>0has children. May be a structured element.
Exceptions
throwstResult if not found.

◆ GetElementFullName()

std::string adtf::mediadescription::osborn::cSampleDecoderBase::GetElementFullName ( const tCodecIndex & oCodecIndex) const

Retrieves the full name of the element within its main structure.

If the element is an array you get the elements array name respresentation: "main_element.element_name[0]" or main_element.element_name[1] ... etc. If the element is not an array you get the elements name respresentation: "main_element.element_name".

Parameters
[in]oCodecIndexThe codec index of the element.
Returns
The full name of the element in array representation depending on array size.
Exceptions
throwstResult if not found.

◆ GetElementName()

std::string adtf::mediadescription::osborn::cSampleDecoderBase::GetElementName ( const tCodecIndex & oCodecIndex) const

Retrieves the name of the element within its structured element.

If the element is an array you get the elements array name respresentation: "element_name[0]" or element_name[1] ... etc. If the element is not an array you get the elements name respresentation: "element_name".

Parameters
[in]oCodecIndexThe codec index of the element.
Returns
The name of the element in array representation depending on array size.
Exceptions
throwstResult if not found.

◆ GetElementRawValue()

void adtf::mediadescription::osborn::cSampleDecoderBase::GetElementRawValue ( const tCodecIndex & oCodecIndex,
void * pValue,
size_t szValueSize ) const

Copies the elements value to the given memory pointer in pValue.

Parameters
[in]oCodecIndexThe codec index of the element.
[out]pValueThe memory pointer to copy the value memory to.
[in]szValueSizesize in bytes of the memory in pValue (if szValueSize is set to 0 there is no check for memory size.)
Exceptions
throwstResult if not found or szValueSize is lower then elment value memory.

◆ GetElements()

const tElements & adtf::mediadescription::osborn::cSampleDecoderBase::GetElements ( ) const

Retrieves the elements of the decoder to get element information and the values.

Returns
tElements The elements iterator container.
See also
for_each_leaf_element
cSampleDecoderBase::tElement

◆ GetElementStringValue()

std::string adtf::mediadescription::osborn::cSampleDecoderBase::GetElementStringValue ( const tCodecIndex & oCodecIndex) const

Returns the current value of the given element as a string. If this element is a enum type the enum types element name will be set.

Parameters
[in]oCodecIndexThe index of the element.
Returns
std::string String to return the current value to, if enum, enum value name will be set.
Exceptions
throwstResult if not found.

◆ GetElementValue() [1/7]

tResult adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::GetElementValue ( const char * strElementName,
adtf_util::cVariant & oValue ) const

Legacy: Get the Element Value.

Parameters
strElementNameThe full element name
oValueThe result value to retrieve to
Returns
tResult
Remarks
This function does not throw! Use the new function with std::string parameter!
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

◆ GetElementValue() [2/7]

tResult adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::GetElementValue ( const char * strElementName,
void * pValue ) const

Legacy: Get the Element Value pointer.

Parameters
strElementNameThe full element name
pValueThe result value pointer to retrieve to
Returns
tResult
Remarks
This function does not throw! Use the new function with std::string parameter!
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

◆ GetElementValue() [3/7]

template<typename T>
T adtf::mediadescription::osborn::cSampleDecoderBase::GetElementValue ( const penguin::tLeafCodecIndex & oLeafCodecIndex) const
inline

Gets the elements value as value of type T. You may use a valid codec index retrieved by the cSampleCodecFactory, but no other! This is to prepare for decoding in advance:

//use a sample factory to retrieve all codec indices
cSampleCodecFactory oMyFactory("mystruct", oMyDescription);
auto oCodecIndexOfInterest = oMyFactory.GetElement("my_element_to_decode").getIndex();
//...
auto oDecoder = oMyFactory.MakeStaticDecoderFor(pMySample);
auto oValueOfInterest = oDecoder.GetElementValue<tFloat64>(oCodecIndexOfInterest);
Parameters
[in]oLeafCodecIndexThe leaf codec index of the element.
Template Parameters
TThe type of the value to return.
Returns
value in type T (supported types: all int types, bool, float, double, std::string)
Remarks
for T = std::string the value is returned as element name in case of enum type
Exceptions
throwstResult if not found.

◆ GetElementValue() [4/7]

template<typename T>
T adtf::mediadescription::osborn::cSampleDecoderBase::GetElementValue ( const tCodecIndex & oCodecIndex) const
inline

Gets the elements value as value of type T. You may use a valid codec index retrieved by the cSampleCodecFactory, but no other! This is to prepare for decoding in advance:

//use a sample factory to retrieve all codec indices
cSampleCodecFactory oMyFactory("mystruct", oMyDescription);
auto oCodecIndexOfInterest = oMyFactory.GetElement("my_element_to_decode").getIndex();
//...
auto oDecoder = oMyFactory.MakeStaticDecoderFor(pMySample);
auto oValueOfInterest = oDecoder.GetElementValue<tFloat64>(oCodecIndexOfInterest);
Parameters
[in]oCodecIndexThe codec index of the element.
Template Parameters
TThe type of the value to return.
Returns
value in type T (supported types: all int types, bool, float, double, std::string)
Remarks
for T = std::string the value is returned as element name in case of enum type
Exceptions
throwstResult if not found.

◆ GetElementValue() [5/7]

adtf_util::cVariant adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::GetElementValue ( tCodecLeafIndex nElementLeafIndex) const

Legacy: Get the Element Value.

Parameters
nElementLeafIndexThe leaf index (between 0 and GetElementCount())
Returns
adtf_util::cVariant
Exceptions
Throwsa tResult if not found.
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

◆ GetElementValue() [6/7]

tResult adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::GetElementValue ( tCodecLeafIndex nElementLeafIndex,
adtf_util::cVariant & oValue ) const

Legacy: Get the Element Value.

Parameters
nElementLeafIndexThe leaf index (between 0 and GetElementCount())
oValueThe result value to retrieve to
Returns
tResult
Remarks
This function does not throw!
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

◆ GetElementValue() [7/7]

tResult adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::GetElementValue ( tCodecLeafIndex nElementLeafIndex,
void * pValue ) const

Legacy: Copies the Element Value memory into the memory pointer. Keep in MIND this function is UNSAFE in case of value memory is biger than the given one.

Parameters
nElementLeafIndexThe leaf index (between 0 and GetElementCount())
pValueThe result value pointer to retrieve to
Returns
tResult
Remarks
This function does not throw! Use the new function with std::string parameter!
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

◆ GetElementVariantValue() [1/2]

a_util::variant::Variant adtf::mediadescription::osborn::cSampleDecoderBase::GetElementVariantValue ( const tCodecIndex & oCodecIndex) const

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

Parameters
[in]oCodecIndexThe index of the element.
Returns
a_util::variant::Variant Variant to return the current value to, type will be set.
Exceptions
throwstResult if not found.

◆ GetElementVariantValue() [2/2]

void adtf::mediadescription::osborn::cSampleDecoderBase::GetElementVariantValue ( const tCodecIndex & oCodecIndex,
a_util::variant::Variant & oValue ) const

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

Parameters
[in]oCodecIndexThe index of the element.
[out]oValueVariant to return the current value to, type will be set.
Exceptions
throwstResult if not found.

◆ GetRepresentation()

ddl::tDataRepresentation adtf::mediadescription::osborn::cSampleDecoderBase::GetRepresentation ( ) const

Returns the current data representation the decoder decodes from.

Returns
The data representation which this decoder handles.

◆ GetStaticBufferSize() [1/2]

size_t adtf::mediadescription::osborn::cSampleDecoderBase::GetStaticBufferSize ( ) const

Gets the static buffer size in bytes for the main structure.

Return values
size_tsize in bytes of the structure depending on the current representation (GetRepresentation)

◆ GetStaticBufferSize() [2/2]

size_t adtf::mediadescription::osborn::cSampleDecoderBase::GetStaticBufferSize ( ddl::tDataRepresentation eRep) const

Gets the static buffer size in bytes for the main structure.

Parameters
eRepoption to retrieve size in bytes for the deserialized or serialized representation.
Return values
size_tsize in bytes of the structure depending on the given representation eRep

◆ IsValid()

tResult adtf::mediadescription::osborn::cSampleDecoderBase::IsValid ( ) const

Returns the validation state of the coder.

Return values
ERR_NOERRORif everything is okay
errorcode + error description.

◆ operator=()

cSampleDecoderBase & adtf::mediadescription::osborn::cSampleDecoderBase::operator= ( cSampleDecoderBase && )

Move assignment operator

◆ ResetFirst()

void adtf::mediadescription::osborn::cSampleDecoderBase::ResetFirst ( )
protected

Resets the first element to be retrieved by the GetElement functions to the first element of the main structure.

◆ Resolve() [1/2]

void adtf::mediadescription::osborn::cSampleDecoderBase::Resolve ( tCodecIndex & oCodecIndex) const

retrieves the lyoutinformation for the given codec index.

Parameters
[in]oCodecIndexThe codec index of the element to retrieve.

◆ Resolve() [2/2]

tCodecIndex adtf::mediadescription::osborn::adtf_ddl_access::cDecoderLegacy::Resolve ( tCodecLeafIndex nElementLeafIndex) const

Legacy: Retrieves a codec index with element information for the given leaf index.

Parameters
nElementLeafIndexThe leaf index (between 0 and GetElementCount())
Returns
The codec index for this element.
Exceptions
throwstResult if not found.
Deprecated
This is only provided for legacy reason. Use adtf::mediadescription::cSampleDecoder::GetElement instead

The documentation for this class was generated from the following file: