16 namespace access_element
37 value =
sizeof(test<T>(
static_cast<size_t (T::*)() const
>(
nullptr))) ==
sizeof(
char)
42 template <
typename T,
typename Enable =
void>
46 struct dispatcher<T, typename std::enable_if<!is_factory<T>::value>::type>
48 typedef typename T::DefinedStructElementType StructElementType;
49 static inline size_t GetElementCount(
const T& oType)
51 return oType.GetElementCount();
54 static inline tResult GetElement(
const T& oType,
size_t nElement,
const StructElementType*& pElement)
56 return oType.GetElement(nElement, pElement);
59 static inline const char* GetElementName(
const T& oType,
const StructElementType* pElement)
61 return oType.GetStructElementName(pElement);
67 struct dispatcher<T, typename std::enable_if<is_factory<T>::value>::type>
69 typedef typename T::DefinedStructElementType StructElementType;
70 static inline size_t GetElementCount(
const T& oType)
72 return oType.GetStaticElementCount();
75 static inline tResult GetElement(
const T& oType,
size_t nElement,
const StructElementType*& pElement)
77 return oType.GetStaticElement(nElement, pElement);
80 static inline const char* GetElementName(
const T& oType,
const StructElementType* pElement)
82 return oType.GetStaticStructElementName(pElement);
89 size_t& nIndex,
const char* strPostfix)
99 for (
size_t nElement = 0; nElement < nElementCount; ++nElement)
105 if (strElementName.StartsWith(strPrefix))
125 template <
typename T>
129 for (
size_t nElement = 0; nElement < nElementCount; ++nElement)
152 template <
typename T>
155 return detail::find_complex_index<T>(oDecoder, strStructName, nIndex,
".");
165 template <
typename T>
168 return detail::find_complex_index<T>(oDecoder, strArrayName, nIndex,
"[");
178 template <
typename T>
183 for (nIndex += 1; nIndex < nElementCount; ++nIndex)
191 if (!strElementName.StartsWith(strPrefix))
207 template <
typename T>
212 return oDecoder.GetElementValue(nElement, pValue);
222 template <
typename T>
227 return oCodec.SetElementValue(nElement, pValue);
236 template <
typename T>
243 oDecoder.GetElementValue(nElement, oResult);
255 template <
typename T>
260 return oCodec.SetElementValue(nElement, oValue);
269 template <
typename T>
273 if (
IS_OK(oDecoder.GetElementValue(nElement, oResult)))
287 template <
typename T>
293 return oDecoder.GetElementAddress(nElement);
305 template <
typename T>
311 return oCodec.GetElementAddress(nElement);
323 template <
typename Struct,
typename T>
329 return reinterpret_cast<const Struct*
>(oDecoder.GetElementAddress(nElement));
341 template <
typename Struct,
typename T>
347 return reinterpret_cast<Struct*
>(oCodec.GetElementAddress(nElement));
360 template <
typename T,
typename Codec>
363 const T* pAddress = get_struct_address<T>(oDecoder, strStructName);
380 template <
typename T,
typename Codec>
383 T* pAddress = get_struct_address<T>(oCodec, strStructName);
399 template <
typename ArrayType,
typename T>
405 return reinterpret_cast<const ArrayType*
>(oDecoder.GetElementAddress(nElement));
417 template <
typename ArrayType,
typename T>
423 return reinterpret_cast<ArrayType*
>(oCodec.GetElementAddress(nElement));
437 template <
typename Codec>
439 const void*& pStartAddress,
size_t& nSize)
441 size_t nStartIndex = 0;
443 size_t nEndIndex = nStartIndex;
446 pStartAddress = oDecoder.GetElementAddress(nStartIndex);
452 const void* pEndAddress = oDecoder.GetElementAddress(nEndIndex);
455 nSize =
static_cast<const uint8_t*
>(pEndAddress) -
456 static_cast<const uint8_t*
>(pStartAddress);
461 size_t nStartOffset =
static_cast<const uint8_t*
>(pStartAddress) -
462 static_cast<const uint8_t*
>(oDecoder.GetElementAddress(0));
463 nSize = oDecoder.GetBufferSize(oDecoder.GetRepresentation()) - nStartOffset;
476 template <
typename T,
typename Codec>
479 const void* pStartAddress =
nullptr;
497 return oCodec.SetElementValue(nElement, &nZero);
507 template <
typename T>
510 return oDecoder.GetElementValueString(nElement);
519 template <
typename T>
Copyright © Audi Electronics Venture GmbH.
#define IS_FAILED(s)
Check if result is failed.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define IS_OK(s)
Check if result is OK.
static tVoid MemCopy(tVoid *pDest, const tVoid *pSrc, tSize nCount)
Copies data from one buffer to another.
A common result class usable as return value throughout.
static tBool IsEqual(const tChar *str1, const tChar *str2, tSize nPos, tSize nLength)
This function checks if the two strings are equal (case sensitive)
Variant class which can handle all base data types.
const tChar * GetPtr() const
This function returns the current string as an array of characters (c-style)
tBool IsEmpty() const
This function checks if the string object is empty.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
tResult find_complex_index(const T &oDecoder, const A_UTILS_NS::cString &strStructName, size_t &nIndex, const char *strPostfix)
For internal use only.
const Struct * get_struct_address(const T &oDecoder, const A_UTILS_NS::cString &strStructName)
Get a pointer to a sub-structure by name.
tResult get_struct_value(const Codec &oDecoder, const A_UTILS_NS::cString &strStructName, T *pStructValue)
Copy a sub-structure out of the structure.
tResult find_struct_index(const T &oDecoder, const A_UTILS_NS::cString &strStructName, size_t &nIndex)
Find the index of the first element of a sub-structure by name.
tResult get_array(const Codec &oDecoder, const A_UTILS_NS::cString &strArrayName, const void *&pStartAddress, size_t &nSize)
Get information about an array.
tResult find_index(const T &oDecoder, const A_UTILS_NS::cString &strElementName, size_t &nIndex)
Find the index of an element by name.
tResult find_array_end_index(const T &oDecoder, const A_UTILS_NS::cString &strArrayName, size_t &nIndex)
Find the index of the first element after an array by name.
tResult reset(T &oCodec, const A_UTILS_NS::cString &strElementName)
Set the value of the requested element to zero.
tResult set_value(T &oCodec, const A_UTILS_NS::cString &strElementName, const void *pValue)
Set the value of an element by name.
tResult get_value(const T &oDecoder, const A_UTILS_NS::cString &strElementName, void *pValue)
Get the value of an element by name.
tResult get_array_value(const Codec &oDecoder, const A_UTILS_NS::cString &strArrayName, T *pArrayValue)
Copy an array out of the structure.
tResult set_struct_value(Codec &oCodec, const A_UTILS_NS::cString &strStructName, const T *pStructValue)
Copy a sub-structure into the structure.
const ArrayType * get_array_address(const T &oDecoder, const A_UTILS_NS::cString &strArrayName)
Get a pointer to an array by name.
tResult find_array_index(const T &oDecoder, const A_UTILS_NS::cString &strArrayName, size_t &nIndex)
Find the index of the first element of an array by name.
A_UTILS_NS::cString get_value_as_string(const T &oDecoder, size_t nElement)
Get the value of an element as a string, using enum value names if available.
const void * get_value_address(const T &oDecoder, const A_UTILS_NS::cString &strElementName)
Get a pointer to an element by name.
Namespace for the mainpage_pkg_ddl.
Copyright © Audi Electronics Venture GmbH.
Forwarding legacy header.