ADTF  3.18.2
sample_codec_legacy.h
Go to the documentation of this file.
1 
7 #pragma once
10 #include "type_reflection_legacy.h"
11 #ifdef ADTF3_NO_DEPRECATED_WARNING
12  #ifndef PKG_ADTF_DDL_NO_DEPRECATED_WARNING
13  #define PKG_ADTF_DDL_NO_DEPRECATED_WARNING
14  #endif
15 #endif
16 #include <pkg_ddl.h>
17 
18 namespace adtf
19 {
20 namespace mediadescription
21 {
22 namespace ant
23 {
28 {
29 public:
33  cStaticSampleDecoder() = default;
34 
43 
44 private:
45  friend class cSampleCodecFactory;
49  cStaticDecoder(std::move(oDecoder)),
50  m_pBuffer(std::move(pBuffer))
51  {
52  }
53 
54 private:
57 };
58 
63 {
64 public:
68  cStaticSampleCodec() = default;
69 
78 
79 private:
80  friend class cSampleCodecFactory;
84  cStaticCodec(std::move(oCodec)),
85  m_pBuffer(std::move(pBuffer))
86  {
87  }
88 
89 private:
92 };
93 
98 {
99 public:
103  cSampleDecoder() = default;
104 
113 
115  adtf::util::cVariant GetElementValue(size_t nElementIndex) const;
116  adtf::util::cVariant GetElementValue(const char* strElementName) const;
117  adtf::util::cString GetElementValueString(size_t nElementIndex) const;
118  adtf::util::cString GetElementValueString(const char* strElementName) const;
119 
121  const adtf_ddl::tStructElement& GetElement(size_t nElementIndex) const;
122 
123 private:
124  friend class cSampleCodecFactory;
128  cDecoder(std::move(oDecoder)),
129  m_pBuffer(std::move(pBuffer))
130  {
131  }
132 
133 private:
136 };
137 
142 {
143 public:
147  cSampleCodec() = default;
148 
157 
159  void SetElementValue(const char* strElementName, const adtf::util::cVariant& oValue);
160 
161 private:
162  friend class cSampleCodecFactory;
166  cCodec(std::move(oCodec)),
167  m_pBuffer(std::move(pBuffer))
168  {
169  }
170 
171 private:
174 };
175 
180 {
181 public:
186  cSampleCodecFactory() = default;
187 
196  cSampleCodecFactory(const char* strStructName,
197  const char* strMediaDescription,
208 
213 
214  #ifndef WIN32
215  // the missing const above was an oversight and lead to problems with older GCCs when storing
216  // cSampleCodecFactory in STL containers and pairs.
221  #endif
222 
227 
232 
237 
242  tResult IsValid() const;
243 
252  adtf_ddl::tDataRepresentation eDataRepresentation) const;
253 
262  adtf_ddl::tDataRepresentation eDataRepresentation) const;
263 
272  adtf_ddl::tDataRepresentation eDataRepresentation) const;
273 
282  adtf_ddl::tDataRepresentation eDataRepresentation) const;
283 
287  size_t GetStaticElementCount() const;
288 
295  tResult GetStaticElement(size_t nIndex, const adtf_ddl::tStructElement*& pElement) const;
296 
302 
307 
308 public: // convenience methods
317  adtf_ddl::tDataRepresentation eDataRepresentation) const
318  {
319  return MakeStaticDecoderFor(*pSample.Get(), eDataRepresentation);
320  }
321 
330  adtf_ddl::tDataRepresentation eDataRepresentation) const
331  {
332  return MakeDecoderFor(*pSample.Get(), eDataRepresentation);
333  }
334 
343  adtf_ddl::tDataRepresentation eDataRepresentation) const
344  {
345  return MakeStaticCodecFor(*pSample.Get(), eDataRepresentation);
346  }
347 
356  adtf_ddl::tDataRepresentation eDataRepresentation) const
357  {
358  return MakeCodecFor(*pSample.Get(), eDataRepresentation);
359  }
360 
368  {
370  }
371 
379  {
380  return MakeDecoderFor(*pSample.Get(), m_eDefaultDataRepresentation);
381  }
382 
390  {
392  }
393 
401  {
402  return MakeCodecFor(*pSample.Get(), m_eDefaultDataRepresentation);
403  }
404 
412  {
414  }
415 
423  {
425  }
426 
434  {
436  }
437 
445  {
447  }
448 
449 private:
454 };
455 
456 } // namespace ant
457 
458 namespace flash
459 {
461 {
462 public:
464 
465  cSampleCodecFactory() = default;
467 
468  cSampleCodecFactory(const cStructureType& oTypeDefinition);
471 
472  size_t FindIndex(const char* strElementName) const;
473  size_t FindArrayIndex(const char* strArrayName) const;
474  size_t FindStructIndex(const char* strStructName) const;
475 
477  const adtf_ddl::tStructElement& GetStaticElement(size_t nElementIndex) const;
479  static const char* GetStaticStructElementName(const adtf_ddl::tStructElement* pElement);
480 };
481 
482 } // namespace flash
483 
484 namespace adtf_ddl_legacy
485 {
486 using flash::cType;
488 using flash::enumeration;
490 using flash::structure;
491 
494 using ant::cSampleDecoder;
495 using ant::cSampleCodec;
497 } // namespace adtf_ddl_legacy
498 } // namespace mediadescription
499 } // namespace adtf
Factory class for ddl codecs for samples.
cSampleCodecFactory(const cSampleCodecFactory &)=default
Copy constructor.
cSampleCodecFactory(cSampleCodecFactory &&)=default
Move constructor.
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.
cSampleCodecFactory()=default
Empty constructor.
cSampleCodec MakeCodecFor(const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a codec for the given sample.
adtf_ddl::tDataRepresentation GetDefaultDataRepresentation() const
cSampleCodec MakeCodecFor(adtf::streaming::ISample &oSample) const
Creates a codec for the given sample using the default data representation.
cStaticSampleCodec MakeStaticCodecFor(adtf::streaming::ISample &oSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a static codec for the given sample.
cStaticSampleCodec MakeStaticCodecFor(const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a static codec for the given sample.
cStaticSampleDecoder MakeStaticDecoderFor(const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a static decoder for the given sample.
cSampleCodecFactory(const char *strStructName, const char *strMediaDescription, adtf_ddl::tDataRepresentation eDefaultDataRepresentation=adtf_ddl::tDataRepresentation::Deserialized)
Constructor that take a DDL string for initialization.
adtf_ddl::cCodecFactory m_oFactory
For internal use only.
tResult IsValid() const
Check if the factory is in a valid state.
cStaticSampleDecoder MakeStaticDecoderFor(const adtf::streaming::ISample &oSample) const
Creates a static decoder for the given sample using the default data representation.
cSampleCodecFactory(cSampleCodecFactory &)=default
Copy constructor.
cSampleCodecFactory(const adtf_ddl::cDDLComplex *pStruct, adtf_ddl::tDataRepresentation eDefaultDataRepresentation=adtf_ddl::tDataRepresentation::Deserialized)
Constructor that uses an OO-DDL struct for initialization.
size_t GetStaticBufferSize(adtf_ddl::tDataRepresentation eRep=adtf_ddl::tDataRepresentation::Deserialized) const
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.
tResult GetStaticElement(size_t nIndex, const adtf_ddl::tStructElement *&pElement) const
Access information about an element.
cStaticSampleDecoder MakeStaticDecoderFor(const adtf::streaming::ISample &oSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a static decoder for the given sample.
adtf_ddl::tDataRepresentation m_eDefaultDataRepresentation
For internal use only.
cSampleCodecFactory & operator=(cSampleCodecFactory &&)=default
Move assignment operator.
cStaticSampleCodec MakeStaticCodecFor(adtf::streaming::ISample &oSample) const
Creates a static codec for the given sample using the default data representation.
cSampleDecoder MakeDecoderFor(const adtf::streaming::ISample &oSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a decoder for the given sample.
cSampleDecoder MakeDecoderFor(const adtf::streaming::ISample &oSample) const
Creates a decoder for the given sample using the default data representation.
cSampleDecoder MakeDecoderFor(const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a decoder for the given sample.
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.
cSampleCodecFactory & operator=(cSampleCodecFactory &)=default
assignment operator
cSampleCodec MakeCodecFor(adtf::streaming::ISample &oSample, adtf_ddl::tDataRepresentation eDataRepresentation) const
Creates a codec for the given sample.
cSampleCodec MakeCodecFor(const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample) const
Creates a codec for the given sample using the default data representation.
Codec for samples with static and/or dynamic data.
cSampleCodec(cSampleCodec &&)=default
Move constructor.
adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
cSampleCodec & operator=(cSampleCodec &&)=default
Move assignment operator.
cSampleCodec()=default
Default constructor.
cSampleCodec(adtf_ddl::cCodec &&oCodec, adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
Decoder for samples with static and/or dynamic data.
cSampleDecoder & operator=(cSampleDecoder &&)=default
Move assignment operator.
cSampleDecoder(cSampleDecoder &&)=default
Move constructor.
cSampleDecoder()=default
Default constructor.
cSampleDecoder(adtf_ddl::cDecoder &&oDecoder, adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
cStaticSampleCodec()=default
Default constructor.
cStaticSampleCodec & operator=(cStaticSampleCodec &&)=default
Move assignment operator.
adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
cStaticSampleCodec(cStaticSampleCodec &&)=default
Move constructor.
cStaticSampleCodec(adtf_ddl::cStaticCodec &&oCodec, adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
Decoder for samples with static data.
cStaticSampleDecoder(cStaticSampleDecoder &&)=default
Move constructor.
cStaticSampleDecoder(adtf_ddl::cStaticDecoder &&oDecoder, adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
cStaticSampleDecoder & operator=(cStaticSampleDecoder &&)=default
Move assignment operator.
adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
cStaticSampleDecoder()=default
Default constructor.
static const char * GetStaticStructElementName(const adtf_ddl::tStructElement *pElement)
add for legacy reason
This is used to create an enumeration ytpe from an existing c++ enum.
This is used to create a structure type from an existing c++ struct definition.
The ISample interface sets and retrieves properties on samples .
Definition: sample_intf.h:35
Defines access methods for the interface of a Stream Type - see also Stream Type and Stream Meta Type...
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
Implementation for a exclusive lock guard.
Implementation for a shared lock guard.
cCodec()=default
Default constructor.
tResult SetElementValue(size_t nIndex, const void *pValue)
Sets the current value of the given element by copying its data from the passed-in location.
Representation for a complex datatype inside a DDL specification.
Definition: ddlcomplex.h:35
cDecoder()=default
Default constructor.
cStaticCodec()=default
Default constructor.
tResult GetElement(size_t nIndex, const tStructElement *&pElement) const
Access information about an element.
cStaticDecoder()
Default constructor.
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.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.