ADTF
Loading...
Searching...
No Matches
type_reflection.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
15// the typereflection is move to the DDL Library ... for structure<> use ddl::DDLStructure for structure<T> use
16// DDLStructureT<T>
17#include "ddl_usage.h"
19
20namespace adtf
21{
22namespace mediadescription
23{
24namespace osborn
25{
26
49template<typename Type>
51{
52public:
53 typedef ddl::DDEnumGenerator<Type> base_type;
58 enumeration(const std::string& strName): base_type(strName)
59 {
60 }
61
66 size_t GetSize() const
67 {
69 }
70
75 size_t GetAlignment() const
76 {
78 }
79
86 enumeration& Add(const std::string& strName, Type eValue)
87 {
88 addElement(strName, eValue);
89 return *this;
90 }
91};
92
122template<typename T = void>
124{
125 static_assert(std::is_trivially_copyable<T>::value,
126 "You can only use structs without pointers or complex members.");
127
128public:
129 typedef ddl::DDStructureGenerator<T, true> base_type;
138 structure(const std::string& strName, uint32_t ui32StructVersion = 1): base_type(strName, ui32StructVersion)
139 {
140 }
141
150
155 size_t GetAlignment() const
156 {
158 }
159
166 template<typename MemberType>
167 structure& Add(const std::string& strName, MemberType T::* pMemberOffset)
168 {
169 base_type::addElement(strName, pMemberOffset);
170 return *this;
171 }
172
180 template<typename MemberType>
181 structure& Add(const std::string& strName, MemberType T::* pMemberOffset, const ddl::DDEnum& oTypeDefinition)
182 {
183 base_type::addElement(strName, pMemberOffset, oTypeDefinition);
184 return *this;
185 }
186
194 template<typename MemberType>
195 structure& Add(const std::string& strName, MemberType T::* pMemberOffset, const ddl::DDStructure& oTypeDefinition)
196 {
197 base_type::addElement(strName, pMemberOffset, oTypeDefinition);
198 return *this;
199 }
200
209 {
211 }
212
220 operator const ddl::DDStructure&() const
221 {
222 return GetStructure();
223 }
224};
225
240template<>
241class structure<void> : public ddl::DDStructure
242{
243public:
248 structure(const std::string& strName);
249
255 structure(const std::string& strName, size_t nAlignment);
256
261 size_t GetSize() const;
262
267 size_t GetAlignment() const;
268
279 structure& Add(const std::string& strName,
280 const ddl::dd::DataType& oTypeDefinition,
281 size_t nArrayCount = 1,
282 size_t nAlignment = 0,
283 int32_t nBytePosition = -1,
284 bool bLittleEndian = true);
285
295 template<typename ArithmeticType>
296 structure& Add(const std::string& strName,
297 size_t nArrayCount = 1,
298 size_t nAlignment = 0,
299 int32_t nBytePosition = -1,
300 bool bLittleEndian = true)
301 {
302 return Add(strName, ddl::DataType<ArithmeticType>(), nArrayCount, nAlignment, nBytePosition, bLittleEndian);
303 }
304
315 structure& Add(const std::string& strName,
316 const ddl::DDEnum& oTypeDefinition,
317 size_t nArrayCount = 1,
318 size_t nAlignment = 0,
319 int32_t nBytePosition = -1,
320 bool bLittleEndian = true);
321
332 structure& Add(const std::string& strName,
333 const ddl::DDStructure& oTypeDefinition,
334 size_t nArrayCount = 1,
335 size_t nAlignment = 0,
336 int32_t nBytePosition = -1,
337 bool bLittleEndian = true);
338
347 {
348 return *this;
349 }
350};
351
352} // namespace osborn
353
354using osborn::enumeration;
355using osborn::structure;
356
357} // namespace mediadescription
358} // namespace adtf
enumeration(const std::string &strName)
Definition type_reflection.h:58
DDEnumGenerator & addElement(const std::string &name, Type value)
Adds a element for the enumeration with name and value.
Definition ddenum.h:183
size_t GetAlignment() const
Definition type_reflection.h:75
enumeration(const std::string &strName)
Definition type_reflection.h:58
enumeration & Add(const std::string &strName, Type eValue)
Definition type_reflection.h:86
size_t GetSize() const
Definition type_reflection.h:66
structure & Add(const std::string &strName, const ddl::DDEnum &oTypeDefinition, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
structure & Add(const std::string &strName, const ddl::DDStructure &oTypeDefinition, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
structure & Add(const std::string &strName, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
Definition type_reflection.h:296
structure & Add(const std::string &strName, const ddl::dd::DataType &oTypeDefinition, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
structure(const std::string &strName, size_t nAlignment)
const ddl::DDStructure & GetStructure() const
Get the current valid DDStructure object.
Definition type_reflection.h:346
structure & Add(const std::string &strName, MemberType T::*pMemberOffset, const ddl::DDEnum &oTypeDefinition)
Definition type_reflection.h:181
structure(const std::string &strName, uint32_t ui32StructVersion=1)
Definition type_reflection.h:138
structure & Add(const std::string &strName, MemberType T::*pMemberOffset, const ddl::DDStructure &oTypeDefinition)
Definition type_reflection.h:195
structure & Add(const std::string &strName, MemberType T::*pMemberOffset)
Definition type_reflection.h:167
size_t GetAlignment() const
Definition type_reflection.h:155
const ddl::DDStructure & GetStructure() const
Get the current valid DDStructure object.
Definition type_reflection.h:208
size_t GetSize() const
Definition type_reflection.h:146
Definition ddenum.h:155
DDEnumGenerator & addElement(const std::string &name, Type value)
Definition ddenum.h:183
Utility class for a complete valid data definition of one EnumType and its dependencies....
Definition ddenum.h:29
size_t getTypeByteSize() const
returns the size of the underlying datatype.
size_t getAlignment() const
returns the alignment of the underlying datatype.
Creating a valid Structure Data Definition by a existing type and its member types.
Definition ddstructure_generator.h:117
const dd::StructType & getStructType() const
Definition ddstructure_generator.h:462
DDStructureGenerator & addElement(const std::string &name, MemberType T::*member_offset)
Definition ddstructure_generator.h:207
const dd::DataDefinition & getDD() const
Definition ddstructure_generator.h:449
const DDStructure & getStructure() const
Definition ddstructure_generator.h:474
std::string getStructName() const
Definition ddstructure_generator.h:437
Utility class for a complete valid data definition of one StructType and its dependencies....
Definition ddstructure.h:57
Generator template to create DataType for the plain c-types.
Definition dd_predefined_datatypes.h:38
StructTypeAccess getStructTypeAccess(const std::string &type_name) const
Get the Struct Type Access, where to enter the type and calculated element position information.
size_t getStaticStructSize() const
Get the known Static Struct Size of this instance.
OptionalSize getAlignment() const
Get the Alignment (if set)
Namespace for all functionality of the ADTF Mediadescription SDK provided since v3....
Definition codec_sample_streamer.h:24
Namespace for the ADTF Mediadescription SDK.
Definition codec_sample_streamer.h:22
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
datamodel::DataType DataType
Definition dd.h:51