ADTF  3.18.3
sample_codec_access_legacy.h
Go to the documentation of this file.
1 
7 #pragma once
8 
11 #include <adtf_base_deprecated.h>
12 
13 #include <utility>
14 #include <string>
15 
16 namespace adtf
17 {
18 namespace mediadescription
19 {
20 namespace osborn
21 {
22 namespace adtf_ddl_access
23 {
29 {
30 public:
35 
36 public:
37  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
45  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
46  tCodecIndex Resolve(tCodecLeafIndex nElementLeafIndex) const;
47 
55  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
56  adtf_util::cVariant GetElementValue(tCodecLeafIndex nElementLeafIndex) const;
65  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
66  tResult GetElementValue(tCodecLeafIndex nElementLeafIndex, adtf_util::cVariant& oValue) const;
75  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
76  tResult GetElementValue(const char* strElementName, adtf_util::cVariant& oValue) const;
86  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
87  tResult GetElementValue(tCodecLeafIndex nElementLeafIndex, void* pValue) const;
96  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
97  tResult GetElementValue(const char* strElementName, void* pValue) const;
105  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
115  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
116  tResult GetElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement*& pElement) const;
117 
126  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElement!")
127  const void* GetElementAddress(tCodecLeafIndex nElementIndex) const;
128 
134  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElements!")
135  size_t GetElementCount() const;
136 
143  static const char* GetStructElementName(const ddl::StructElement* pElement);
144 
145  #endif //NO_ADTF_MEDIA_DESCRIPTION_LEGACY
146 protected:
152  virtual const ddl::codec::StaticDecoder* getDecoder() const = 0;
153 };
154 
155 namespace detail
156 {
157  void set_adtf_util_variant(ddl::codec::StaticCodec* codec, const tCodecIndex& oCodecIndex, const adtf_util::cVariant& oVariant);
158  void set_adtf_util_variant(ddl::codec::Codec* codec, const tCodecIndex& oCodecIndex, const adtf_util::cVariant& oVariant);
159 } // namespace detail
160 
167 template<typename CodecType>
169 {
170 public:
171  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
180  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodec::GetElement!")
181  tResult SetElementValue(tCodecLeafIndex nElementLeafIndex, const adtf_util::cVariant& oValue)
182  {
183  try
184  {
185  auto oCodecIndex = getCodec()->resolve(nElementLeafIndex);
186  detail::set_adtf_util_variant(getCodec(), oCodecIndex, oValue);
188  }
189  catch(const std::exception&)
190  {
191  return adtf::base::current_exception_to_result();
192  }
193  }
194 
203  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodec::GetElement!")
204  tResult SetElementValue(const char* strElementName, const adtf_util::cVariant& oValue)
205  {
206  try
207  {
208  auto oCodecIndex = getCodec()->getElement(strElementName).getIndex();
209  detail::set_adtf_util_variant(getCodec(), oCodecIndex, oValue);
211  }
212  catch (const std::exception&)
213  {
214  return adtf::base::current_exception_to_result();
215  }
216  }
217 
225  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodec::GetElement!")
226  void* GetElementAddress(tCodecLeafIndex nElementLeafIndex)
227  {
228  try
229  {
230  auto oCodecIndex = getCodec()->resolve(nElementLeafIndex);
231  return getCodec()->getElementAddress(oCodecIndex);
232  }
233  catch (const std::exception&)
234  {
235  return nullptr;
236  }
237  }
238  #endif // NO_ADTF_MEDIA_DESCRIPTION_LEGACY
239 
240 protected:
246  virtual CodecType* getCodec() = 0;
247 };
248 
255 {
256 public:
261 
262  #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
270  tCodecIndex Resolve(tCodecLeafIndex nElementIndex) const;
275  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodecFactory::GetElements!")
276  size_t GetStaticElementCount() const;
283  ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodecFactory::GetElement!")
284  tResult GetStaticElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement*& pElement) const;
285 
291  static const char* GetStaticStructElementName(const ddl::StructElement* pElement);
298  tCodecLeafIndex FindIndex(const char* strElementName) const;
305  tCodecLeafIndex FindArrayIndex(const char* strArrayName) const;
312  tCodecLeafIndex FindStructIndex(const char* strStructName) const;
313 
314  #endif // NO_ADTF_MEDIA_DESCRIPTION_LEGACY
315 protected:
317  virtual const ddl::codec::CodecFactory* getFactory() const = 0;
318 };
319 
320 } // namespace adtf_access
321 } // namespace osborn
322 } // namespace mediadescription
323 } // namespace adtf
Copyright © Audi Electronics Venture GmbH.
#define ADTF3_DEPRECATED(_depr_message_)
Mark a function or variable as deprecated.
Copyright © Audi Electronics Venture GmbH.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
tResult GetStaticElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
Legacy: Access information about an element.
tCodecLeafIndex FindIndex(const char *strElementName) const
Legacy: Retrieves the leaf index of the first element in the given element path.
ddl::StructElement DefinedStructElementType
type definition for the old access_element API.
tCodecIndex Resolve(tCodecLeafIndex nElementIndex) const
Legacy: Retrieves a codec index with element information for the given leaf index.
tCodecLeafIndex FindStructIndex(const char *strStructName) const
Legacy: Retrieves the leaf index of the first element in the given element path.
virtual const ddl::codec::CodecFactory * getFactory() const =0
For internal use only.
size_t GetStaticElementCount() const
Legacy: Gets the leaf count.
static const char * GetStaticStructElementName(const ddl::StructElement *pElement)
Legacy helper funtion to support old adtf_ddl::element_access::find_* functions.
tCodecLeafIndex FindArrayIndex(const char *strArrayName) const
Legacy: Retrieves the leaf index of the first element in the given element path.
Legacy class for cSampleCodec and cStaticSampleCodec.
void * GetElementAddress(tCodecLeafIndex nElementLeafIndex)
Legacy:Get the Element Address object.
tResult SetElementValue(tCodecLeafIndex nElementLeafIndex, const adtf_util::cVariant &oValue)
Legacy: Set the Element Value.
Legacy Base Class to Support adtf_ddl::access_element API.
adtf_util::cString GetElementValueString(tCodecLeafIndex nElementLeafIndex) const
Legacy: Get the Element Value as string (resolved to the enum element name if is enum type)
size_t GetElementCount() const
Legacy: Get the Element Leaf count.
const void * GetElementAddress(tCodecLeafIndex nElementIndex) const
Legacy: Get the Element StructElement information.
adtf_util::cVariant GetElementValue(tCodecLeafIndex nElementLeafIndex) const
Legacy: Get the Element Value.
ddl::StructElement DefinedStructElementType
type definition for the old access_element API.
tResult GetElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
Get the Element StructElement information.
static const char * GetStructElementName(const ddl::StructElement *pElement)
Legacy: Get the Struct Element Name for access_element legacy support.
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:946
Decoder for samples with static and/or dynamic data.
Definition: sample_codec.h:605
Fast Access Index Type for the coders.
Definition: codec_index.h:132
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
size_t tCodecLeafIndex
Leaf Index Type for the coders (is between 0 and getElementCount()).
ADTF adtf_util Namespace - Within adtf this is used as adtf::util or adtf_util and also defined as A_...
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.