19 namespace mediadescription
27 template <
typename Type>
30 #define DDL_DEFINE_ARITHMETIC_TYPE_NAME(__type, __name) \
32 struct arithmetic_type_name<__type> \
34 static constexpr const char* name = __name; \
37 DDL_DEFINE_ARITHMETIC_TYPE_NAME(
tBool,
"tBool")
38 DDL_DEFINE_ARITHMETIC_TYPE_NAME(
tChar, "
tChar")
43 DDL_DEFINE_ARITHMETIC_TYPE_NAME(
tInt8, "
tInt8")
50 template<typename T, typename Enable =
void>
53 static constexpr
size_t value = 1;
57 struct array_count<T, typename std::enable_if<std::is_array<T>::value>::type>
59 static constexpr
size_t value =
sizeof(T) /
sizeof(
typename std::remove_pointer<
typename std::decay<T>::type>::type);
62 inline bool is_little_endian()
70 return sTest.aBytes[0] == 1;
73 template <
typename T,
typename MemberType>
74 size_t member_pointer_to_offset(MemberType T::* pMember)
77 return reinterpret_cast<size_t>(&(pStart->*pMember));
109 template <
typename Type>
114 static_assert(std::is_arithmetic<Type>::value,
"Type is not an arithmetic type");
129 return alignof(Type);
144 int64_t nAssignedValue;
153 cEnumerationType(
const std::string& strName,
const std::shared_ptr<cType>& pUnderlyingType);
178 std::string m_strName;
179 std::shared_ptr<cType> m_pUnderlyingType;
180 std::vector<tValue> m_oValues;
199 template <
typename Type,
typename Enable =
void>
208 std::make_shared<
arithmetic_type<typename std::underlying_type<Type>::type>>())
235 template <
typename UnderlyingType>
237 typename std::enable_if<std::is_arithmetic<UnderlyingType>::value>::type>:
public cEnumerationType
316 operator std::pair<std::string, std::string>()
const
329 std::string m_strName;
332 std::vector<member> m_oMembers;
364 template <
typename T =
void>
367 static_assert(std::is_trivially_copyable<T>::value,
368 "You can only use structs without pointers or complex members.");
386 template <
typename MemberType>
388 MemberType T::* pMemberOffset)
391 m_nCurrentSerializedOffset,
392 detail::is_little_endian(),
396 std::make_shared<
arithmetic_type<
typename std::remove_pointer<
typename std::decay<MemberType>::type>::type>>()});
397 m_nCurrentSerializedOffset +=
sizeof(MemberType);
408 template <
typename MemberType>
412 m_nCurrentSerializedOffset,
413 detail::is_little_endian(),
414 sizeof(
typename std::underlying_type<MemberType>::type),
417 std::make_shared<cEnumerationType>(oTypeDefinition)});
418 m_nCurrentSerializedOffset +=
sizeof(
typename std::underlying_type<MemberType>::type);
429 template <
typename MemberType>
433 m_nCurrentSerializedOffset,
434 detail::is_little_endian(),
438 std::make_shared<cStructureType>(oTypeDefinition)});
439 m_nCurrentSerializedOffset +=
sizeof(MemberType);
444 size_t m_nCurrentSerializedOffset = 0;
471 structure(const std::
string& strName,
size_t nAlignment = 0);
485 template <typename ArithmeticType>
486 typename std::enable_if<std::is_arithmetic<ArithmeticType>::value,
structure>::type&
487 Add(const std::
string& strName,
488 size_t nArrayCount = 1,
489 size_t nAlignment = 0,
490 int32_t nBytePosition = -1,
491 bool bLittleEndian = true)
509 size_t nArrayCount = 1,
510 size_t nAlignment = 0,
511 int32_t nBytePosition = -1,
512 bool bLittleEndian =
true);
526 size_t nArrayCount = 1,
527 size_t nAlignment = 0,
528 int32_t nBytePosition = -1,
529 bool bLittleEndian =
true);
532 void Add(
const std::string& strName,
535 int32_t nBytePosition,
537 const std::shared_ptr<cType>& oTypeDefinition);
539 size_t Align(
size_t nOffset,
size_t nAlignment)
const;
540 void AlignOffset(
size_t nAlignment);
543 size_t m_nCurrentOffset = 0;
544 size_t m_nCurrentSerializedOffset = 0;
545 size_t m_nMaxAlignment = 1;
Copyright © Audi Electronics Venture GmbH.
#define ADTF3_DEPRECATED(_depr_message_)
Mark a function or variable as deprecated.
Copyright © Audi Electronics Venture GmbH.
uint8_t tUInt8
type definition for unsigned integer values (8bit) (platform and compiler independent type).
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
int64_t tInt64
type definition for signed integer values (64bit) (platform and compiler independent type).
int16_t tInt16
type definition for signed integer values (16bit) (platform and compiler independent type).
int32_t tInt32
type definition for signed integer values (32bit) (platform and compiler independent type).
float tFloat32
type definition for Float32 (32bit float values) (platform and compiler independent type).
uint16_t tUInt16
type definition for unsigned integer values (16bit) (platform and compiler independent type).
double tFloat64
type definition for Float64 (64bit double values) (platform and compiler independent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
int8_t tInt8
type definition for signed integer values (8bit) (platform and compiler independent type).
uint64_t tUInt64
type definition for unsigned integer values (64bit) (platform and compiler independent type).
Namespace for entire ADTF SDK.