ADTF  3.18.2
sample_codec_access_types.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "ddl_usage.h"
10 #include <string>
11 
12 namespace adtf
13 {
14 namespace mediadescription
15 {
16 namespace osborn
17 {
18 
25 using tCodecLeafIndex = size_t;
26 
36 
42 template<typename AccessType>
44 {
45 public:
49  typedef AccessType access_type;
65  static element_type getElement(access_type& access, const std::string& full_element_name)
66  {
67  return access.GetElement(full_element_name);
68  };
76  static element_type getElement(access_type& access, const index_type& index)
77  {
78  return access.GetElement(index);
79  };
87  static size_t getChildCount(access_type& access, const index_type& index)
88  {
89  return access.GetElementChildCount(index);
90  };
100  static std::string getFullName(access_type& access, const index_type& index)
101  {
102  return access.GetElementFullName(index);
103  };
113  static std::string getName(access_type& access, const index_type& index)
114  {
115  return access.GetElementName(index);
116  };
126  static std::string getBaseName(access_type& access, const index_type& index)
127  {
128  return access.GetElementBaseName(index);
129  };
139  template<typename T>
140  static T getValue(access_type& access, const index_type& index)
141  {
142  return access.template GetElementValue<T>(index);
143  };
152  {
153  return access.GetElementVariantValue(index);
154  };
163  static std::string getStringValue(access_type& access, const index_type& index)
164  {
165  return access.GetElementStringValue(index);
166  };
175  static void getRawValue(access_type& access, const index_type& index, void* value, size_t value_size)
176  {
177  access.GetElementRawValue(index, value, value_size);
178  };
186  static const void* getAddress(access_type& access, const index_type& index)
187  {
188  return access.GetElementAddress(index);
189  };
190 
198  static void resolve(access_type& access, index_type& index)
199  {
200  return access.Resolve(index);
201  };
202 };
203 
209 template<typename AccessType>
210 class sample_codec_access : public sample_decoder_access<AccessType>
211 {
212 public:
216  typedef AccessType access_type;
232  static element_type getElement(access_type& access, const std::string& full_element_name)
233  {
234  return access.GetElement(full_element_name);
235  };
243  static element_type getElement(access_type& access, const index_type& index)
244  {
245  return access.GetElement(index);
246  };
256  template<typename T>
257  static void setValue(access_type& access, const index_type& index, const T& value)
258  {
259  access.template SetElementValue<T>(index, value);
260  };
268  static void setVariantValue(access_type& access, const index_type& index, const a_util::variant::Variant& value)
269  {
270  access.SetElementVariantValue(index, value);
271  };
279  static void setStringValue(access_type& access, const index_type& index, const std::string& value)
280  {
281  access.SetElementStringValue(index, value);
282  };
283 
292  static void setRawValue(access_type& access, const index_type& index, const void* value, size_t value_size)
293  {
294  access.SetElementRawValue(index, value, value_size);
295  };
303  static void* getAddress(access_type& access, const index_type& index)
304  {
305  return access.GetElementAddress(index);
306  };
307 };
308 
314 template<typename AccessType>
316 {
317 public:
321  typedef AccessType access_type;
337  static element_type getElement(const access_type& access, const std::string& full_element_name)
338  {
339  return access.GetElement(full_element_name);
340  };
348  static element_type getElement(const access_type& access, const index_type& index)
349  {
350  return access.GetElement(index);
351  };
359  static size_t getChildCount(const access_type& access, const index_type& index)
360  {
361  return access.GetElementChildCount(index);
362  };
372  static std::string getFullName(access_type& access, const index_type& index)
373  {
374  return access.GetElementFullName(index);
375  };
385  static std::string getName(const access_type& access, const index_type& index)
386  {
387  return access.GetElementName(index);
388  };
398  static std::string getBaseName(const access_type& access, const index_type& index)
399  {
400  return access.GetElementBaseName(index);
401  };
402 
410  static void resolve(access_type& access, index_type& index)
411  {
412  return access.Resolve(index);
413  };
414 };
415 
416 } //namespace osborn
417 
418 using tCodecLeafIndex = osborn::tCodecLeafIndex;
419 using tCodecIndex = osborn::tCodecIndex;
420 
421 } //namespace mediadescription
422 } //namespace adtf
423 
Implementation for codec access concept (ddl::codec::CodecElementAccess).
static void setRawValue(access_type &access, const index_type &index, const void *value, size_t value_size)
Set the value by copying from a value buffer.
static void setVariantValue(access_type &access, const index_type &index, const a_util::variant::Variant &value)
Sets the value from value as variant.
static element_type getElement(access_type &access, const std::string &full_element_name)
Get a element object for the given full_element_name.
static void * getAddress(access_type &access, const index_type &index)
Get the address (with write access)
static void setValue(access_type &access, const index_type &index, const T &value)
Set the value from the given value.
static void setStringValue(access_type &access, const index_type &index, const std::string &value)
Sets the value from value as string.
ddl::codec::CodecElement< sample_codec_access< AccessType > > element_type
supported element type.
static element_type getElement(access_type &access, const index_type &index)
Get a element object for the given index.
Implementation for codec access concept (ddl::codec::FactoryElementAccess).
static std::string getName(const access_type &access, const index_type &index)
Get the name of the element within its level structure.
ddl::codec::FactoryElement< sample_codec_factory_access< AccessType > > element_type
supported element type.
static std::string getFullName(access_type &access, const index_type &index)
Get the full name of the element within its main structure.
static std::string getBaseName(const access_type &access, const index_type &index)
Get the name of the element within its level structure.
static void resolve(access_type &access, index_type &index)
Resolves the given CodecIndex and set the layout information.
static size_t getChildCount(const access_type &access, const index_type &index)
Get the Child Count.
static element_type getElement(const access_type &access, const std::string &full_element_name)
Get a element object for the given full_element_name.
static element_type getElement(const access_type &access, const index_type &index)
Get a element object for the given index.
Implementation for decoder access concept (ddl::codec::DecoderElementAccess).
static size_t getChildCount(access_type &access, const index_type &index)
Get the Child Count.
static const void * getAddress(access_type &access, const index_type &index)
Get the address.
static element_type getElement(access_type &access, const std::string &full_element_name)
Get a element object for the given full_element_name.
ddl::codec::DecoderElement< sample_decoder_access< AccessType > > element_type
supported element type.
static std::string getFullName(access_type &access, const index_type &index)
Get the full name of the element within its main structure.
static std::string getStringValue(access_type &access, const index_type &index)
Get the value as string.
static a_util::variant::Variant getVariantValue(access_type &access, const index_type &index)
Get the value as variant.
static void resolve(access_type &access, index_type &index)
Resolves the given CodecIndex and set the layout information.
static std::string getBaseName(access_type &access, const index_type &index)
Get the base name of the element within its level structure.
static std::string getName(access_type &access, const index_type &index)
Get the name of the element within its level structure.
static element_type getElement(access_type &access, const index_type &index)
Get a element object for the given index.
static void getRawValue(access_type &access, const index_type &index, void *value, size_t value_size)
Get the value by copy to the given value buffer.
static T getValue(access_type &access, const index_type &index)
Get the value.
A CodecElement to get and set values.
Fast Access Index Type for the coders.
Definition: codec_index.h:132
A DecoderElement to get values.
Copyright © Audi Electronics Venture GmbH.
ddl::codec::CodecIndex tCodecIndex
Fast Access Index Type for the coders.
size_t tCodecLeafIndex
Leaf Index Type for the coders (is between 0 and getElementCount()).
Namespace for entire ADTF SDK.