ADTF  3.18.2
cSampleCodecFactory

Factory class for ddl codecs for samples. More...

Inheritance diagram for cSampleCodecFactory:
[legend]

Public Types

typedef ddl::codec::FactoryElement< sample_codec_factory_access< const cSampleCodecFactory > > tElement
 Iterator value element type for the factory to get element information. More...
 
typedef ddl::codec::ChildElements< sample_codec_factory_access< const cSampleCodecFactory > > tElements
 Iterator container to iterate all elements of the factory. More...
 
- Public Types inherited from cCodecFactoryLegacy
typedef ddl::StructElement DefinedStructElementType
 type definition for the old access_element API.
 

Public Member Functions

 cSampleCodecFactory ()
 Empty constructor. More...
 
 cSampleCodecFactory (const char *strStructName, const char *strMediaDescription, ddl::tDataRepresentation eDefaultDataRepresentation=ddl::tDataRepresentation::Deserialized)
 Constructor that take a DDL string for initialization. More...
 
 cSampleCodecFactory (const ddl::dd::StructType &oStruct, const ddl::dd::DataDefinition &oParentDD, ddl::tDataRepresentation eDefaultDataRepresentation=ddl::tDataRepresentation::Deserialized)
 Constructor that uses an OO-DDL struct for initialization. More...
 
 cSampleCodecFactory (const std::pair< std::string, std::string > &oMDDescription, ddl::tDataRepresentation eDefaultDataRepresentation=ddl::tDataRepresentation::Deserialized)
 Construct a new c Sample Codec Factory. More...
 
 cSampleCodecFactory (const ddl::DDStructure &oTypeDefinition, ddl::tDataRepresentation eDefaultDataRepresentation=ddl::tDataRepresentation::Deserialized)
 Construct a new c Sample Codec Factory. More...
 
 cSampleCodecFactory (const streaming::ant::IStreamType &oStreamType)
 Construct a new c Sample Codec Factory. More...
 
 cSampleCodecFactory (const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pStreamType)
 Construct a new c Sample Codec Factory. More...
 
 cSampleCodecFactory (const cSampleCodecFactory &)
 Copy constructor.
 
 cSampleCodecFactory (cSampleCodecFactory &&)
 Move constructor.
 
cSampleCodecFactoryoperator= (const cSampleCodecFactory &)
 assignment operator
 
cSampleCodecFactoryoperator= (cSampleCodecFactory &&)
 Move assignment operator.
 
tResult IsValid () const
 Check if the factory is in a valid state. More...
 
cStaticSampleDecoder MakeStaticDecoderFor (const adtf::streaming::ISample &oSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a static decoder for the given sample. More...
 
cStaticSampleCodec MakeStaticCodecFor (adtf::streaming::ISample &oSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a static codec for the given sample. More...
 
cSampleDecoder MakeDecoderFor (const adtf::streaming::ISample &oSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a decoder for the given sample. More...
 
cSampleCodec MakeCodecFor (adtf::streaming::ISample &oSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a codec for the given sample. More...
 
tElement GetElement (const tCodecIndex &oCodecIndex) const
 Retrieves an element for the codec index. More...
 
tElement GetElement (const std::string &strElementFullName) const
 Retrieves an element for the given name. More...
 
const tElementsGetElements () const
 Retrieves the elements of the factory to get element information. More...
 
size_t GetElementChildCount (const tCodecIndex &oCodecIndex) const
 Retrieves the amount of child elements for the given codec index. More...
 
std::string GetElementFullName (const tCodecIndex &oCodecIndex) const
 Retrieves the full name of the element within its main structure. More...
 
std::string GetElementName (const tCodecIndex &oCodecIndex) const
 Retrieves the name of the element within its structured element. More...
 
const std::string & GetElementBaseName (const tCodecIndex &oCodecIndex) const
 Retrieves the base name of the element within its structured element. More...
 
size_t GetStaticBufferSize (ddl::tDataRepresentation eRep=ddl::tDataRepresentation::Deserialized) const
 Gets the static buffer size in bytes for the structure. More...
 
ddl::tDataRepresentation GetDefaultDataRepresentation () const
 Returns the current default data representation whuke creating codec or decoder. More...
 
cStaticSampleDecoder MakeStaticDecoderFor (const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a static decoder for the given sample. More...
 
cSampleDecoder MakeDecoderFor (const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a decoder for the given sample. More...
 
cStaticSampleCodec MakeStaticCodecFor (const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a static codec for the given sample. More...
 
cSampleCodec MakeCodecFor (const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
 Creates a codec for the given sample. More...
 
cStaticSampleDecoder MakeStaticDecoderFor (const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample) const
 Creates a static decoder for the given sample using the default data representation. More...
 
cSampleDecoder MakeDecoderFor (const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample) const
 Creates a decoder for the given sample using the default data representation. More...
 
cStaticSampleCodec MakeStaticCodecFor (const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample) const
 Creates a static codec for the given sample using the default data representation. More...
 
cSampleCodec MakeCodecFor (const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample) const
 Creates a codec for the given sample using the default data representation. More...
 
cStaticSampleDecoder MakeStaticDecoderFor (const adtf::streaming::ISample &oSample) const
 Creates a static decoder for the given sample using the default data representation. More...
 
cSampleDecoder MakeDecoderFor (const adtf::streaming::ISample &oSample) const
 Creates a decoder for the given sample using the default data representation. More...
 
cStaticSampleCodec MakeStaticCodecFor (adtf::streaming::ISample &oSample) const
 Creates a static codec for the given sample using the default data representation. More...
 
cSampleCodec MakeCodecFor (adtf::streaming::ISample &oSample) const
 Creates a codec for the given sample using the default data representation. More...
 
void Resolve (tCodecIndex &oCodecIndex) const
 retrieves the lyoutinformation for the given codec index. More...
 
- Public Member Functions inherited from cCodecFactoryLegacy
tCodecIndex Resolve (tCodecLeafIndex nElementIndex) const
 Legacy: Retrieves a codec index with element information for the given leaf index. More...
 
size_t GetStaticElementCount () const
 Legacy: Gets the leaf count. More...
 
tResult GetStaticElement (tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
 Legacy: Access information about an element. More...
 
tCodecLeafIndex FindIndex (const char *strElementName) const
 Legacy: Retrieves the leaf index of the first element in the given element path. More...
 
tCodecLeafIndex FindArrayIndex (const char *strArrayName) const
 Legacy: Retrieves the leaf index of the first element in the given element path. More...
 
tCodecLeafIndex FindStructIndex (const char *strStructName) const
 Legacy: Retrieves the leaf index of the first element in the given element path. More...
 

Private Member Functions

const ddl::codec::CodecFactorygetFactory () const override
 For internal use only.
 

Private Attributes

ddl::tDataRepresentation m_eDefaultDataRepresentation = ddl::tDataRepresentation::Deserialized
 For internal use only.
 
ddl::codec::CodecFactory m_oFactory
 For internal use only.
 
tElement m_oFirstElement
 

Additional Inherited Members

- Static Public Member Functions inherited from cCodecFactoryLegacy
static const char * GetStaticStructElementName (const ddl::StructElement *pElement)
 Legacy helper funtion to support old adtf_ddl::element_access::find_* functions. More...
 

Detailed Description

Factory class for ddl codecs for samples.

Definition at line 945 of file sample_codec.h.

Member Typedef Documentation

◆ tElement

Iterator value element type for the factory to get element information.

See also
for_each_leaf_element, for_each_element
ddl::codec::FactoryElement

Definition at line 1070 of file sample_codec.h.

◆ tElements

Constructor & Destructor Documentation

◆ cSampleCodecFactory() [1/7]

Empty constructor.

This exists to enable uninitialized member variables of this type that are move-assigned later on.

◆ cSampleCodecFactory() [2/7]

cSampleCodecFactory ( const char *  strStructName,
const char *  strMediaDescription,
ddl::tDataRepresentation  eDefaultDataRepresentation = ddl::tDataRepresentation::Deserialized 
)

Constructor that take a DDL string for initialization.

Parameters
[in]strStructNameThe name of the struct for which codecs should be generated.
[in]strMediaDescriptionThe DDL description.
[in]eDefaultDataRepresentationThe representation used for the Make* factory methods without an parameter for the data representation.

◆ cSampleCodecFactory() [3/7]

cSampleCodecFactory ( const ddl::dd::StructType oStruct,
const ddl::dd::DataDefinition oParentDD,
ddl::tDataRepresentation  eDefaultDataRepresentation = ddl::tDataRepresentation::Deserialized 
)

Constructor that uses an OO-DDL struct for initialization.

Parameters
[in]pStructThe struct definition.
[in]eDefaultDataRepresentationThe representation used for the Make* factory methods without an parameter for the data representation.

◆ cSampleCodecFactory() [4/7]

cSampleCodecFactory ( const std::pair< std::string, std::string > &  oMDDescription,
ddl::tDataRepresentation  eDefaultDataRepresentation = ddl::tDataRepresentation::Deserialized 
)

Construct a new c Sample Codec Factory.

Parameters
oMDDescriptionString pair of "struct_name", "data_description".
eDefaultDataRepresentationDefault data representation if creting a codec without representation value

◆ cSampleCodecFactory() [5/7]

cSampleCodecFactory ( const ddl::DDStructure oTypeDefinition,
ddl::tDataRepresentation  eDefaultDataRepresentation = ddl::tDataRepresentation::Deserialized 
)

Construct a new c Sample Codec Factory.

Parameters
oTypeDefinitionData definition defined within a DDStructure.
eDefaultDataRepresentationDefault data representation if creting a codec without representation value

◆ cSampleCodecFactory() [6/7]

Construct a new c Sample Codec Factory.

Parameters
oStreamTypeStreamtype with set properties "md_struct" and "md_description".

◆ cSampleCodecFactory() [7/7]

Construct a new c Sample Codec Factory.

Parameters
pStreamTypeStreamtype with set properties "md_struct" and "md_description".

Member Function Documentation

◆ GetDefaultDataRepresentation()

ddl::tDataRepresentation GetDefaultDataRepresentation ( ) const

Returns the current default data representation whuke creating codec or decoder.

Returns
The default data representation.

◆ GetElement() [1/2]

tElement GetElement ( const std::string &  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 factory exists.
Exceptions
throwstResult if not found.

◆ GetElement() [2/2]

tElement GetElement ( const tCodecIndex oCodecIndex) const

Retrieves an element for the codec index.

Parameters
[in]oCodecIndexThe codec index.
Returns
tElement the element
Remarks
The element is only valid as long as the factory exists.
Exceptions
throwstResult if not found.

◆ GetElementBaseName()

const std::string& 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 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 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 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.

◆ GetElements()

const tElements& GetElements ( ) const

Retrieves the elements of the factory to get element information.

Returns
tElements The elements iterator container.
See also
for_each_leaf_element, for_each_element
cSampleCodecFactory::tElement, The Codec Index and the Element Iterator

◆ GetStaticBufferSize()

size_t GetStaticBufferSize ( ddl::tDataRepresentation  eRep = ddl::tDataRepresentation::Deserialized) const

Gets the static buffer size in bytes for the 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 IsValid ( ) const

Check if the factory is in a valid state.

Returns
Any errors during construction.

Referenced by md_sample_data_factory< T >::md_sample_data_factory().

◆ MakeCodecFor() [1/4]

cSampleCodec MakeCodecFor ( adtf::streaming::ISample oSample) const
inline

Creates a codec for the given sample using the default data representation.

Parameters
[in]oSampleThe sample.
Returns
a codec.

Definition at line 1274 of file sample_codec.h.

References cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeCodecFor().

◆ MakeCodecFor() [2/4]

cSampleCodec MakeCodecFor ( adtf::streaming::ISample oSample,
ddl::tDataRepresentation  eDataRepresentation 
) const

Creates a codec for the given sample.

Parameters
[out]oSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a codec.

Referenced by cSampleCodecFactory::MakeCodecFor(), and encoding_sample_writer< WriterImplementation >::MakeSample().

◆ MakeCodecFor() [3/4]

cSampleCodec MakeCodecFor ( const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &  pSample) const
inline

Creates a codec for the given sample using the default data representation.

Parameters
[in]pSampleThe sample.
Returns
a codec.

Definition at line 1234 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeCodecFor().

◆ MakeCodecFor() [4/4]

cSampleCodec MakeCodecFor ( const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &  pSample,
ddl::tDataRepresentation  eDataRepresentation 
) const
inline

Creates a codec for the given sample.

Parameters
[out]pSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a codec.

Definition at line 1197 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), and cSampleCodecFactory::MakeCodecFor().

◆ MakeDecoderFor() [1/4]

cSampleDecoder MakeDecoderFor ( const adtf::streaming::ISample oSample) const
inline

Creates a decoder for the given sample using the default data representation.

Parameters
[in]oSampleThe sample.
Returns
a decoder.

Definition at line 1254 of file sample_codec.h.

References cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeDecoderFor().

◆ MakeDecoderFor() [2/4]

cSampleDecoder MakeDecoderFor ( const adtf::streaming::ISample oSample,
ddl::tDataRepresentation  eDataRepresentation 
) const

Creates a decoder for the given sample.

Parameters
[in]oSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a decoder.

Referenced by decoding_sample_reader< ReaderImplementation >::GetLastDecoder(), decoding_sample_reader< ReaderImplementation >::GetNextDecoder(), md_sample_data_factory< T >::Make(), and cSampleCodecFactory::MakeDecoderFor().

◆ MakeDecoderFor() [3/4]

cSampleDecoder MakeDecoderFor ( const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &  pSample) const
inline

Creates a decoder for the given sample using the default data representation.

Parameters
[in]pSampleThe sample.
Returns
a decoder.

Definition at line 1216 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeDecoderFor().

◆ MakeDecoderFor() [4/4]

cSampleDecoder MakeDecoderFor ( const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &  pSample,
ddl::tDataRepresentation  eDataRepresentation 
) const
inline

Creates a decoder for the given sample.

Parameters
[in]pSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a decoder.

Definition at line 1175 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), and cSampleCodecFactory::MakeDecoderFor().

◆ MakeStaticCodecFor() [1/4]

cStaticSampleCodec MakeStaticCodecFor ( adtf::streaming::ISample oSample) const
inline

Creates a static codec for the given sample using the default data representation.

Parameters
[in]oSampleThe sample.
Returns
a static codec.

Definition at line 1264 of file sample_codec.h.

References cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeStaticCodecFor().

◆ MakeStaticCodecFor() [2/4]

cStaticSampleCodec MakeStaticCodecFor ( adtf::streaming::ISample oSample,
ddl::tDataRepresentation  eDataRepresentation 
) const

Creates a static codec for the given sample.

Parameters
[out]oSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a static codec.

Referenced by cSampleCodecFactory::MakeStaticCodecFor().

◆ MakeStaticCodecFor() [3/4]

cStaticSampleCodec MakeStaticCodecFor ( const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &  pSample) const
inline

Creates a static codec for the given sample using the default data representation.

Parameters
[in]pSampleThe sample.
Returns
a static codec.

Definition at line 1225 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeStaticCodecFor().

◆ MakeStaticCodecFor() [4/4]

cStaticSampleCodec MakeStaticCodecFor ( const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &  pSample,
ddl::tDataRepresentation  eDataRepresentation 
) const
inline

Creates a static codec for the given sample.

Parameters
[out]pSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a static codec.

Definition at line 1186 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), and cSampleCodecFactory::MakeStaticCodecFor().

◆ MakeStaticDecoderFor() [1/4]

cStaticSampleDecoder MakeStaticDecoderFor ( const adtf::streaming::ISample oSample) const
inline

Creates a static decoder for the given sample using the default data representation.

Parameters
[in]oSampleThe sample.
Returns
a static decoder.

Definition at line 1244 of file sample_codec.h.

References cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeStaticDecoderFor().

◆ MakeStaticDecoderFor() [2/4]

cStaticSampleDecoder MakeStaticDecoderFor ( const adtf::streaming::ISample oSample,
ddl::tDataRepresentation  eDataRepresentation 
) const

Creates a static decoder for the given sample.

Parameters
[in]oSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a static decoder.

Referenced by cSampleCodecFactory::MakeStaticDecoderFor().

◆ MakeStaticDecoderFor() [3/4]

cStaticSampleDecoder MakeStaticDecoderFor ( const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &  pSample) const
inline

Creates a static decoder for the given sample using the default data representation.

Parameters
[in]pSampleThe sample.
Returns
a static decoder.

Definition at line 1207 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), cSampleCodecFactory::m_eDefaultDataRepresentation, and cSampleCodecFactory::MakeStaticDecoderFor().

◆ MakeStaticDecoderFor() [4/4]

cStaticSampleDecoder MakeStaticDecoderFor ( const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &  pSample,
ddl::tDataRepresentation  eDataRepresentation 
) const
inline

Creates a static decoder for the given sample.

Parameters
[in]pSampleThe sample.
[in]eDataRepresentationThe data representation that the sample is in.
Returns
a static decoder.

Definition at line 1163 of file sample_codec.h.

References iobject_ptr_base< T >::Get(), and cSampleCodecFactory::MakeStaticDecoderFor().

◆ Resolve()

void Resolve ( tCodecIndex oCodecIndex) const

retrieves the lyoutinformation for the given codec index.

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