ADTF  3.14.3
sample_codec.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #ifdef USE_ADTF_MEDIA_DESCRIPTION_LEGACY
10  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
12  #endif
13 #endif
14 
19 
20 #include <utility>
21 #include <string>
22 #include <type_traits>
23 
24 namespace adtf
25 {
26 namespace mediadescription
27 {
28 namespace osborn
29 {
30 
35 {
36 public:
45  tResult IsValid() const;
46  //get legacy methods into scope
47  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
52  #endif //NO_ADTF_MEDIA_DESCRIPTION_LEGACY
58  typedef ddl::codec::DecoderElement<sample_decoder_access<const cSampleDecoderBase>> tElement;
79  tElement GetElement(const tCodecIndex& oCodecIndex) const;
87  tElement GetElement(const std::string& strElementFullName) const;
100  const tElements& GetElements() const;
108  size_t GetElementChildCount(const tCodecIndex& oCodecIndex) const;
119  std::string GetElementFullName(const tCodecIndex& oCodecIndex) const;
130  std::string GetElementName(const tCodecIndex& oCodecIndex) const;
141  const std::string& GetElementBaseName(const tCodecIndex& oCodecIndex) const;
147  size_t GetStaticBufferSize() const;
182  template<typename T>
183  T GetElementValue(const tCodecIndex& oCodecIndex) const
184  {
185  try
186  {
187  return getDecoder()->template getElementValue<T>(oCodecIndex);
188  }
189  catch (const std::exception&)
190  {
191  throw adtf::base::current_exception_to_result();
192  }
193  }
207  void GetElementVariantValue(const tCodecIndex& oCodecIndex, a_util::variant::Variant& oValue) const;
215  std::string GetElementStringValue(const tCodecIndex& oCodecIndex) const;
216 
225  void GetElementRawValue(const tCodecIndex& oCodecIndex, void* pValue, size_t szValueSize) const;
233  const void* GetElementAddress(const tCodecIndex& oCodecIndex) const;
234 
239  void Resolve(tCodecIndex& oCodecIndex) const;
240 
241 protected:
242  void ResetFirst();
243 
244 private:
245  tElement m_oFirstElement;
246 };
247 
252 {
253 public:
257  cStaticSampleDecoder() = default;
258 
267 
268 private:
269  friend class cSampleCodecFactory;
273  m_oStaticDecoder(std::move(oDecoder)),
274  m_pBuffer(std::move(pBuffer))
275  {
276  cSampleDecoderBase::ResetFirst();
277  }
279  const ddl::codec::StaticDecoder* getDecoder() const override;
280 
281 private:
286 };
287 
292  public adtf_ddl_access::cCodecLegacy<ddl::codec::StaticCodec>
293 {
294 public:
307 
308  //get cSampleDecoderBase API into scope
312 
313  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
314  //gets cCodecLegacy into scope
317  #endif //NO_ADTF_MEDIA_DESCRIPTION_LEGACY
318 
345  tElement GetElement(const tCodecIndex& oCodecIndex);
353  tElement GetElement(const std::string& strElementFullName);
367 
393  template<typename T>
394  void SetElementValue(const tCodecIndex& oCodecIndex, const T& oValue)
395  {
396  try
397  {
398  getCodec()->template setElementValue<T>(oCodecIndex, oValue);
399  }
400  catch(const std::exception&)
401  {
402  throw adtf::base::current_exception_to_result();
403  }
404  }
412  void SetElementVariantValue(const tCodecIndex& oCodecIndex, const a_util::variant::Variant& oValue);
421  void SetElementStringValue(const tCodecIndex& oCodecIndex, const std::string& strValue);
444  void SetElementRawValue(const tCodecIndex& oCodecIndex, const void* pValue, size_t szValueSize);
452  void* GetElementAddress(const tCodecIndex& oCodecIndex);
460  void* GetElementAddress(const std::string& strElementFullName);
461 
462 private:
463  friend class cSampleCodecFactory;
467  m_oStaticCodec(std::move(oDecoder)),
468  m_pBuffer(std::move(pBuffer)),
469  m_oFirstElement(tCodecIndex(), *this)
470  {
471  cSampleDecoderBase::ResetFirst();
472  }
474  const ddl::codec::StaticDecoder* getDecoder() const override;
481  tElement m_oFirstElement;
482 };
483 
488 {
489 public:
493  cSampleDecoder() = default;
494 
508  size_t GetBufferSize() const;
516 
517 private:
518  friend class cSampleCodecFactory;
522  m_oDecoder(std::move(oDecoder)),
523  m_pBuffer(std::move(pBuffer))
524  {
525  cSampleDecoderBase::ResetFirst();
526  }
528  const ddl::codec::StaticDecoder* getDecoder() const override;
533 };
534 
539  public adtf_ddl_access::cCodecLegacy<ddl::codec::Codec>
540 {
541 public:
546 
555 
556  //gets cSampleDecoderBase into scope
560 
561  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
562  //gets cCodecLegacy into scope
565  #endif //NO_ADTF_MEDIA_DESCRIPTION_LEGACY
592  template<typename T>
593  void SetElementValue(const tCodecIndex& oCodecIndex, const T& oValue)
594  {
595  try
596  {
597  getCodec()->setElementValue<T>(oCodecIndex, oValue);
598  }
599  catch (const std::exception&)
600  {
601  throw adtf::base::current_exception_to_result();
602  }
603  }
611  void SetElementVariantValue(const tCodecIndex& oCodecIndex, const a_util::variant::Variant& oValue);
620  void SetElementStringValue(const tCodecIndex& oCodecIndex, const std::string& strValue);
643  void SetElementRawValue(const tCodecIndex& oCodecIndex, const void* pValue, size_t szValueSize);
650  void* GetElementAddress(const tCodecIndex& oCodecIndex);
677  tElement GetElement(const tCodecIndex& oCodecIndex);
685  tElement GetElement(const std::string& strElementFullName);
706  void* GetElementAddress(const std::string& strElementFullName);
707 
708 private:
709  friend class cSampleCodecFactory;
713  m_oCodec(std::move(oDecoder)),
714  m_pBuffer(std::move(pBuffer)),
715  m_oFirstElement(tCodecIndex(), *this)
716  {
717  cSampleDecoderBase::ResetFirst();
718  }
720  const ddl::codec::StaticDecoder* getDecoder() const override;
726  tElement m_oFirstElement;
727 };
728 
729 
734 {
735 public:
741 
750  cSampleCodecFactory(const char* strStructName,
751  const char* strMediaDescription,
761  const ddl::dd::DataDefinition& oParentDD,
763 
770  cSampleCodecFactory(const std::pair<std::string, std::string>& oMDDescription,
778  cSampleCodecFactory(const ddl::DDStructure& oTypeDefinition,
808 
809  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
811  #endif //NO_ADTF_MEDIA_DESCRIPTION_LEGACY
816  tResult IsValid() const;
825  ddl::tDataRepresentation eDataRepresentation) const;
834  ddl::tDataRepresentation eDataRepresentation) const;
843  ddl::tDataRepresentation eDataRepresentation) const;
852  ddl::tDataRepresentation eDataRepresentation) const;
866  tElement GetElement(const tCodecIndex& oCodecIndex) const;
874  tElement GetElement(const std::string& strElementFullName) const;
888  const tElements& GetElements() const;
896  size_t GetElementChildCount(const tCodecIndex& oCodecIndex) const;
907  std::string GetElementFullName(const tCodecIndex& oCodecIndex) const;
918  std::string GetElementName(const tCodecIndex& oCodecIndex) const;
929  const std::string& GetElementBaseName(const tCodecIndex& oCodecIndex) const;
937 
943 
944 public: // convenience methods
952  ddl::tDataRepresentation eDataRepresentation) const
953  {
954  return MakeStaticDecoderFor(*pSample.Get(), eDataRepresentation);
955  }
964  ddl::tDataRepresentation eDataRepresentation) const
965  {
966  return MakeDecoderFor(*pSample.Get(), eDataRepresentation);
967  }
975  ddl::tDataRepresentation eDataRepresentation) const
976  {
977  return MakeStaticCodecFor(*pSample.Get(), eDataRepresentation);
978  }
986  ddl::tDataRepresentation eDataRepresentation) const
987  {
988  return MakeCodecFor(*pSample.Get(), eDataRepresentation);
989  }
996  {
998  }
1005  {
1006  return MakeDecoderFor(*pSample.Get(), m_eDefaultDataRepresentation);
1007  }
1014  {
1016  }
1023  {
1024  return MakeCodecFor(*pSample.Get(), m_eDefaultDataRepresentation);
1025  }
1033  {
1035  }
1043  {
1045  }
1053  {
1055  }
1063  {
1064  return MakeCodecFor(oSample, m_eDefaultDataRepresentation);
1065  }
1070  void Resolve(tCodecIndex& oCodecIndex) const;
1071 
1072 private:
1074  const ddl::codec::CodecFactory* getFactory() const override;
1079  tElement m_oFirstElement;
1080 };
1081 
1120 template<typename ElementsType>
1121 void for_each_leaf_element(ElementsType& oElements,
1122  const std::function<void(std::conditional_t<std::is_const<ElementsType>::value,
1123  const typename ElementsType::element_type,
1124  typename ElementsType::element_type>&)>& fnCallback)
1125 {
1126  for (auto& oCurrentElement : oElements)
1127  {
1128  if (oCurrentElement.hasChildren())
1129  {
1130  if (oCurrentElement.isArray())
1131  {
1132  for (size_t szArrayPos = 0; szArrayPos < oCurrentElement.getArraySize(); ++szArrayPos)
1133  {
1134  auto oArrayElement = oCurrentElement.getArrayElement(szArrayPos);
1135  auto& children = oArrayElement.getChildElements();
1136  for_each_leaf_element(children, fnCallback);
1137  }
1138  }
1139  else
1140  {
1141  auto& children = oCurrentElement.getChildElements();
1142  for_each_leaf_element(children, fnCallback);
1143  }
1144  }
1145  else
1146  {
1147  if (oCurrentElement.isArray())
1148  {
1149  for (size_t szArrayPos = 0; szArrayPos < oCurrentElement.getArraySize(); ++szArrayPos)
1150  {
1151  auto oArrayElement = oCurrentElement.getArrayElement(szArrayPos);
1152  fnCallback(oArrayElement);
1153  }
1154  }
1155  else
1156  {
1157  fnCallback(oCurrentElement);
1158  }
1159  }
1160  }
1161 }
1169 template<typename T>
1170 std::vector<tCodecIndex> get_codec_indices(const T& oDecoderOrFactory)
1171 {
1172  std::vector<tCodecIndex> oIndices;
1173  for_each_leaf_element(oDecoderOrFactory.GetElements(),
1174  [&oIndices](const auto& oElement) {
1175  oIndices.push_back(oElement.getIndex());
1176  });
1177  return oIndices;
1178 }
1179 
1225 template<typename ElementsType>
1226 void for_each_element(ElementsType& oElements,
1227  const std::function<void(std::conditional_t<std::is_const<ElementsType>::value,
1228  const typename ElementsType::element_type,
1229  typename ElementsType::element_type>&)>& fnCallback)
1230 {
1231  for (auto& oCurrentElement : oElements)
1232  {
1233  fnCallback(oCurrentElement);
1234  if (oCurrentElement.hasChildren())
1235  {
1236  for_each_element(oCurrentElement.getChildElements(), fnCallback);
1237  }
1238  }
1239 }
1240 
1250 template<typename T>
1251 adtf_util::cVariant get_value_as_variant(const T& oDecoder, const tCodecIndex& oCodecIndex)
1252 {
1253  switch (oCodecIndex.getType())
1254  {
1256  return oDecoder.template GetElementValue<bool>(oCodecIndex);
1258  return oDecoder.template GetElementValue<tInt8>(oCodecIndex);
1260  return oDecoder.template GetElementValue<tUInt8>(oCodecIndex);
1262  return oDecoder.template GetElementValue<tInt16>(oCodecIndex);
1264  return oDecoder.template GetElementValue<tUInt16>(oCodecIndex);
1266  return oDecoder.template GetElementValue<tInt32>(oCodecIndex);
1268  return oDecoder.template GetElementValue<tUInt32>(oCodecIndex);
1270  return oDecoder.template GetElementValue<tInt64>(oCodecIndex);
1272  return oDecoder.template GetElementValue<tUInt64>(oCodecIndex);
1274  return oDecoder.template GetElementValue<tFloat32>(oCodecIndex);
1276  return oDecoder.template GetElementValue<tFloat64>(oCodecIndex);
1277  default:
1278  break;
1279  }
1280  return adtf_util::cVariant();
1281 }
1282 
1283 } //namespace osborn
1284 using osborn::cStaticSampleDecoder;
1285 using osborn::cStaticSampleCodec;
1286 using osborn::cSampleDecoder;
1287 using osborn::cSampleCodec;
1288 using osborn::cSampleCodecFactory;
1289 
1294 
1295 } //namespace mediadescription
1296 } //namespace adtf
1297 
Container type, able to store any primitive data type (and arrays thereof)
tCodecIndex Resolve(tCodecLeafIndex nElementIndex) const
Legacy: Retrieves a codec index with element information for the given leaf index.
Legacy class for cSampleCodec and cStaticSampleCodec.
Legacy Base Class to Support adtf_ddl::access_element API.
const void * GetElementAddress(tCodecLeafIndex nElementIndex) const
Legacy: Get the Element StructElement information.
adtf_util::cVariant GetElementValue(tCodecLeafIndex nElementLeafIndex) const
Legacy: Get the Element Value.
tResult GetElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
Get the Element StructElement information.
virtual const ddl::codec::StaticDecoder * getDecoder() const =0
Get the base ddl::Decoder.
tCodecIndex Resolve(tCodecLeafIndex nElementLeafIndex) const
Legacy: Retrieves a codec index with element information for the given leaf index.
Factory class for ddl codecs for samples.
Definition: sample_codec.h:734
const ddl::codec::CodecFactory * getFactory() const override
For internal use only.
cSampleCodecFactory & operator=(const cSampleCodecFactory &)
assignment operator
cSampleCodecFactory(const char *strStructName, const char *strMediaDescription, ddl::tDataRepresentation eDefaultDataRepresentation=ddl::tDataRepresentation::Deserialized)
Constructor that take a DDL string for initialization.
cSampleDecoder MakeDecoderFor(const adtf::streaming::ISample &oSample, ddl::tDataRepresentation eDataRepresentation) const
Creates a decoder for the given sample.
cSampleCodecFactory(cSampleCodecFactory &&)
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.
std::string GetElementName(const tCodecIndex &oCodecIndex) const
Retrieves the name of the element within its structured element.
cSampleDecoder MakeDecoderFor(const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
Creates a decoder for the given sample.
Definition: sample_codec.h:963
const tElements & GetElements() const
Retrieves the elements of the factory to get element information.
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, ddl::tDataRepresentation eDataRepresentation) const
Creates a static codec for the given sample.
cSampleCodecFactory(const ddl::DDStructure &oTypeDefinition, ddl::tDataRepresentation eDefaultDataRepresentation=ddl::tDataRepresentation::Deserialized)
Construct a new c Sample Codec Factory.
const std::string & GetElementBaseName(const tCodecIndex &oCodecIndex) const
Retrieves the base name of the element within its structured element.
cStaticSampleDecoder MakeStaticDecoderFor(const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
Creates a static decoder for the given sample.
Definition: sample_codec.h:951
tElement GetElement(const std::string &strElementFullName) const
Retrieves an element for the given name.
cStaticSampleDecoder MakeStaticDecoderFor(const adtf::streaming::ISample &oSample) const
Creates a static decoder for the given sample using the default data representation.
tElement GetElement(const tCodecIndex &oCodecIndex) const
Retrieves an element for the codec index.
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.
Definition: sample_codec.h:995
ddl::codec::FactoryElement< sample_codec_factory_access< const cSampleCodecFactory > > tElement
Iterator value element type for the factory to get element information.
Definition: sample_codec.h:858
cSampleCodecFactory(const streaming::ant::IStreamType &oStreamType)
Construct a new c Sample Codec Factory.
void Resolve(tCodecIndex &oCodecIndex) const
retrieves the lyoutinformation for the given codec index.
cSampleCodecFactory(const cSampleCodecFactory &)
Copy constructor.
size_t GetElementChildCount(const tCodecIndex &oCodecIndex) const
Retrieves the amount of child elements for the given codec index.
std::string GetElementFullName(const tCodecIndex &oCodecIndex) const
Retrieves the full name of the element within its main structure.
ddl::codec::ChildElements< sample_codec_factory_access< const cSampleCodecFactory > > tElements
Iterator container to iterate all elements of the factory.
Definition: sample_codec.h:881
cStaticSampleCodec MakeStaticCodecFor(adtf::streaming::ISample &oSample) const
Creates a static codec for the given sample using the default data representation.
cStaticSampleCodec MakeStaticCodecFor(const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
Creates a static codec for the given sample.
Definition: sample_codec.h:974
cSampleDecoder MakeDecoderFor(const adtf::streaming::ISample &oSample) const
Creates a decoder for the given sample using the default data representation.
cSampleCodecFactory(const std::pair< std::string, std::string > &oMDDescription, ddl::tDataRepresentation eDefaultDataRepresentation=ddl::tDataRepresentation::Deserialized)
Construct a new c Sample Codec Factory.
ddl::tDataRepresentation m_eDefaultDataRepresentation
For internal use only.
cSampleCodec MakeCodecFor(adtf::streaming::ISample &oSample, ddl::tDataRepresentation eDataRepresentation) const
Creates a codec for the given sample.
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.
cStaticSampleDecoder MakeStaticDecoderFor(const adtf::streaming::ISample &oSample, ddl::tDataRepresentation eDataRepresentation) const
Creates a static decoder for the given sample.
ddl::tDataRepresentation GetDefaultDataRepresentation() const
Returns the current default data representation whuke creating codec or decoder.
size_t GetStaticBufferSize(ddl::tDataRepresentation eRep=ddl::tDataRepresentation::Deserialized) const
Gets the static buffer size in bytes for the structure.
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(const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pStreamType)
Construct a new c Sample Codec Factory.
cSampleCodecFactory & operator=(cSampleCodecFactory &&)
Move assignment operator.
cSampleCodec MakeCodecFor(const adtf::ucom::iobject_ptr< adtf::streaming::ISample > &pSample, ddl::tDataRepresentation eDataRepresentation) const
Creates a codec for the given sample.
Definition: sample_codec.h:985
ddl::codec::CodecFactory m_oFactory
For internal use only.
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.
Definition: sample_codec.h:540
void * GetElementAddress(const std::string &strElementFullName)
Gets the elements value memory pointer into the given data for writing access.
ddl::codec::Codec * getCodec() override
Get the Codec.
ddl::codec::ChildElements< sample_codec_access< cSampleCodec > > tElements
Iterator container to iterate all elements of the codec.
Definition: sample_codec.h:691
adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
Definition: sample_codec.h:725
void SetElementVariantValue(const tCodecIndex &oCodecIndex, const a_util::variant::Variant &oValue)
Sets the current value of the given element from the given variant.
void SetElementRawValue(const tCodecIndex &oCodecIndex, const void *pValue, size_t szValueSize)
Sets the elements value by copy the memory from pValue.
cSampleCodec(ddl::codec::Codec &&oDecoder, adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
Definition: sample_codec.h:711
const ddl::codec::StaticDecoder * getDecoder() const override
For internal use only.
void * GetElementAddress(const tCodecIndex &oCodecIndex)
Gets the elements value memory pointer into the given data for writig access.
tElements & GetElements()
Retrieves the elements of the codec to get element information, to get and set the values.
ddl::codec::Codec m_oCodec
For internal use only.
Definition: sample_codec.h:723
ddl::codec::CodecElement< sample_codec_access< cSampleCodec > > tElement
Iterator value element type for the codec to get value, set value and get element information.
Definition: sample_codec.h:656
tElement GetElement(const tCodecIndex &oCodecIndex)
Retrieves an element for the codec index.
void SetElementStringValue(const tCodecIndex &oCodecIndex, const std::string &strValue)
Sets the current value of the given element from the given string.
tElement GetElement(const std::string &strElementFullName)
Retrieves an element for the given name.
cSampleCodec(cSampleCodec &&)
Move constructor.
void SetElementValue(const tCodecIndex &oCodecIndex, const T &oValue)
Sets the elements value from the given oValue.
Definition: sample_codec.h:593
cSampleCodec & operator=(cSampleCodec &&)
Move assignment operator.
std::string GetElementName(const tCodecIndex &oCodecIndex) const
Retrieves the name of the element within its structured element.
const tElements & GetElements() const
Retrieves the elements of the decoder to get element information and the values.
ddl::tDataRepresentation GetRepresentation() const
Returns the current data representation the decoder decodes from.
const void * GetElementAddress(const tCodecIndex &oCodecIndex) const
Gets the elements value memory pointer into the given data.
ddl::codec::ChildElements< sample_decoder_access< const cSampleDecoderBase > > tElements
Iterator container to iterate all elements of the decoder.
Definition: sample_codec.h:93
T GetElementValue(const tCodecIndex &oCodecIndex) const
Gets the elements value as value of type T.
Definition: sample_codec.h:183
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.
tElement GetElement(const std::string &strElementFullName) const
Retrieves an element for the given name.
tResult IsValid() const
Returns the validation state of the coder.
tElement GetElement(const tCodecIndex &oCodecIndex) const
Retrieves an element for the codec index.
a_util::variant::Variant GetElementVariantValue(const tCodecIndex &oCodecIndex) const
Returns the current value of the given element as a variant.
void Resolve(tCodecIndex &oCodecIndex) const
retrieves the lyoutinformation for the given codec index.
void GetElementVariantValue(const tCodecIndex &oCodecIndex, a_util::variant::Variant &oValue) const
Returns the current value of the given element as a variant.
size_t GetElementChildCount(const tCodecIndex &oCodecIndex) const
Retrieves the amount of child elements for the given codec index.
std::string GetElementFullName(const tCodecIndex &oCodecIndex) const
Retrieves the full name of the element within its main structure.
void GetElementRawValue(const tCodecIndex &oCodecIndex, void *pValue, size_t szValueSize) const
Copies the elements value to the given memory pointer in @pValue.
size_t GetStaticBufferSize(ddl::tDataRepresentation oRep) const
Gets the static buffer size in bytes for the main structure.
std::string GetElementStringValue(const tCodecIndex &oCodecIndex) const
Returns the current value of the given element as a string.
Decoder for samples with static and/or dynamic data.
Definition: sample_codec.h:488
cSampleDecoder(cSampleDecoder &&)
Move constructor.
cSampleDecoder(ddl::codec::Decoder &&oDecoder, adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
Definition: sample_codec.h:520
ddl::codec::Decoder m_oDecoder
For internal use only.
Definition: sample_codec.h:530
size_t GetBufferSize() const
Gets the buffer size in bytes for the main structure.
const ddl::codec::StaticDecoder * getDecoder() const override
For internal use only.
cSampleDecoder()=default
Default constructor.
size_t GetBufferSize(ddl::tDataRepresentation eRep) const
Gets the buffer size in bytes for the main structure.
cSampleDecoder & operator=(cSampleDecoder &&)
Move assignment operator.
adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
Definition: sample_codec.h:532
Codec for samples with static data content.
Definition: sample_codec.h:293
void * GetElementAddress(const std::string &strElementFullName)
Gets the elements value memory pointer into the given data for writing access.
adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
Definition: sample_codec.h:480
cStaticSampleCodec(ddl::codec::StaticCodec &&oDecoder, adtf::ucom::object_ptr_locked< adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
Definition: sample_codec.h:465
void SetElementVariantValue(const tCodecIndex &oCodecIndex, const a_util::variant::Variant &oValue)
Sets the current value of the given element from the given variant.
void SetElementRawValue(const tCodecIndex &oCodecIndex, const void *pValue, size_t szValueSize)
Sets the elements value by copy the memory from pValue.
const ddl::codec::StaticDecoder * getDecoder() const override
For internal use only.
ddl::codec::ChildElements< sample_codec_access< cStaticSampleCodec > > tElements
Iterator container to iterate all elements of the codec.
Definition: sample_codec.h:359
void * GetElementAddress(const tCodecIndex &oCodecIndex)
Gets the elements value memory pointer into the given data for writing access.
tElements & GetElements()
Retrieves the elements of the codec to get element information, to get and set the values.
ddl::codec::CodecElement< sample_codec_access< cStaticSampleCodec > > tElement
Iterator value element type for the codec to get value, set value and get element information.
Definition: sample_codec.h:324
tElement GetElement(const tCodecIndex &oCodecIndex)
Get a single element of the codec.
ddl::codec::StaticCodec m_oStaticCodec
For internal use only.
Definition: sample_codec.h:478
void SetElementStringValue(const tCodecIndex &oCodecIndex, const std::string &strValue)
Sets the current value of the given element from the given string.
tElement GetElement(const std::string &strElementFullName)
Retrieves an element for the given name.
cStaticSampleCodec(cStaticSampleCodec &&)
Move constructor.
cStaticSampleCodec & operator=(cStaticSampleCodec &&)
Move assignment operator.
void SetElementValue(const tCodecIndex &oCodecIndex, const T &oValue)
Sets the elements value from the given oValue.
Definition: sample_codec.h:394
ddl::codec::StaticCodec * getCodec() override
For internal use only.
Decoder for samples with static data content.
Definition: sample_codec.h:252
cStaticSampleDecoder & operator=(cStaticSampleDecoder &&)
Move assignment operator.
cStaticSampleDecoder(cStaticSampleDecoder &&)
Move constructor.
const ddl::codec::StaticDecoder * getDecoder() const override
For internal use only.
ddl::codec::StaticDecoder m_oStaticDecoder
For internal use only.
Definition: sample_codec.h:283
adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > m_pBuffer
For internal use only.
Definition: sample_codec.h:285
cStaticSampleDecoder(ddl::codec::StaticDecoder &&oDecoder, adtf::ucom::object_ptr_shared_locked< const adtf::streaming::ISampleBuffer > &&pBuffer)
For internal use only.
Definition: sample_codec.h:271
cStaticSampleDecoder()=default
Default constructor.
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.
Utility class for a complete valid data definition of one StructType and its dependencies.
Definition: ddstructure.h:61
Iteratable container type for the given Element type in ElementAccessType::element_type.
A CodecElement to get and set values.
Decoder for dynamic structures defined by a DataDefinition definition.
void setElementValue(const CodecIndex &codec_index, const T &value)
Sets the current value of the given element from given value in type T.
Fast Access Index Type for the coders.
Definition: codec_index.h:135
ElementType getType() const
Get the elements type if CodecIndex is valid.
Decoder for dynamic structures defined by a DataDefinition definition.
Codec for static structures defined by a DataDefinition definition.
Decoder for static structures defined by a DataDefinition definition.
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition: dd.h:93
observable DataDefinition object class to describe StructType.
adtf_util::cVariant get_value_as_variant(const T &oDecoder, const tCodecIndex &oCodecIndex)
Get value as variant.
std::vector< tCodecIndex > get_codec_indices(const T &oDecoderOrFactory)
Get the codec indices object.
void for_each_leaf_element(ElementsType &oElements, const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &fnCallback)
Iterates ALL leaf elements within ALL array elements.
void for_each_element(ElementsType &oElements, const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &fnCallback)
Iterates elements without array elements (also structures).
Namespace for entire ADTF SDK.
@ cet_bool
Variant type is bool.
@ cet_uint64
Variant type is std::uint64_t.
@ cet_int64
Variant type is std::int64_t.
@ cet_float
Variant type is float.
@ cet_uint16
Variant type is std::uint16_t.
@ cet_int8
Variant type is std::int8_t.
@ cet_uint8
Variant type is std::uint8_t.
@ cet_int32
Variant type is std::int32_t.
@ cet_int16
Variant type is std::int16_t.
@ cet_uint32
Variant type is std::uint32_t.
@ cet_double
Variant type is double.
DataRepresentation
Enumeration for the data representation.
@ Deserialized
alias names for legacy reasons
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)