ADTF
Loading...
Searching...
No Matches
stream_type_default.h
Go to the documentation of this file.
1
7#pragma once
8
10#include "sample_codec.h"
11#include "md_sample_data.h"
12
14#include <type_traits>
15#include <string_view>
16
17namespace adtf
18{
19namespace mediadescription
20{
21namespace osborn
22{
23
33 const char* strStructName,
34 const char* strMediaDescription,
36
45 const ddl::DDStructure& type_definition,
47
56 const std::pair<std::string, std::string>& type_definition,
58
59
67 const ddl::DDStructure& type_definition);
68
78 const char* strStructName,
79 const char* strMediaDescription,
81
91ADTF3_DEPRECATED("The ADTF Media Description Service is deprecated.")
93 const char* strStructName,
94 ddl::tDataRepresentation eRep
95 = ddl::tDataRepresentation::Deserialized);
96
103std::tuple<std::string, std::string, ddl::tDataRepresentation>
104 get_media_description_from_stream_type(const adtf::streaming::IStreamType& oStreamType);
105
106
114 cSampleCodecFactory& oFactory);
115} // namespace osborn
116
117namespace quiet
118{
119
121namespace detail
122{
123
124template<typename T>
125struct is_array_like: std::false_type {};
126template<typename ValueType, size_t szArraySize>
127struct is_array_like<std::array<ValueType, szArraySize>>: std::true_type {};
128
129template<class ValueType, size_t szArraySize>
130struct is_array_like<ValueType[szArraySize]>: std::true_type {};
131
132template <typename T>
133constexpr bool is_array_like_v = is_array_like<T>::value;
134
135class cStreamTypeDefaultBase : public streaming::cStreamType
136{
137public:
138 cStreamTypeDefaultBase(std::string_view strMDStructName,
139 std::string_view strMDDescription,
140 ddl::DataRepresentation eMDDataRepresentation,
141 size_t szFixArraySize,
142 bool bValidate = false);
143
144 cStreamTypeDefaultBase(std::string_view strMDStructName,
145 ddl::DataRepresentation eMDDataRepresentation,
146 size_t szFixArraySize);
147};
148
149} // namespace detail
151
156template<typename T = void>
157class stream_type_default : public detail::cStreamTypeDefaultBase
158{
159public:
160 static_assert(!std::is_arithmetic_v<T>,
161 "stream_type_default can be used only for structured types, "
162 "use adtf::streaming::stream_type_plain<T> instead");
163 static_assert(std::is_trivially_copyable_v<T>,
164 "stream_type_default can be used only for trivial structured types");
165 static_assert(!detail::is_array_like_v<T>,
166 "stream_type_default can not used for arrays of structured types, "
167 "use adtf::mediadescription::stream_type_default_array<T> instead");
168 static_assert(has_description_v<T>,
169 "stream_type_default<T>() can only be used if ddl description was generated with adtf_mdgen! "
170 "If you have another source for the description, use stream_type_default<void>(...).");
171
178 stream_type_default(): stream_type_default(ddl::DataRepresentation::deserialized)
179 {
180 }
181
187 cStreamTypeDefaultBase(description<T>::name, description<T>::definition, eDataRep, 1)
188 {
189 }
190};
191
197template<>
198class stream_type_default<void> : public detail::cStreamTypeDefaultBase
199{
200public:
214 stream_type_default(const ddl::DDStructure& oTypeDefinition):
215 stream_type_default(oTypeDefinition, ddl::DataRepresentation::deserialized)
216 {
217 }
218
226 stream_type_default(const ddl::DDStructure& oTypeDefinition,
227 ddl::DataRepresentation eDataRep):
228 cStreamTypeDefaultBase(
229 oTypeDefinition.getStructType().getName(), oTypeDefinition.getStructDescription(), eDataRep, 1)
230 {
231 }
232
242 stream_type_default(std::string_view strMDStructName,
243 std::string_view strMDDescription):
244 stream_type_default(strMDStructName, strMDDescription, ddl::DataRepresentation::deserialized)
245 {
246 }
247
256 stream_type_default(std::string_view strMDStructName,
257 std::string_view strMDDescription,
258 ddl::DataRepresentation eDataRep):
259 cStreamTypeDefaultBase(strMDStructName, strMDDescription, eDataRep, 1, true)
260 {
261 }
262
272 ADTF3_IGNORE_DEPRECATION_WARNING_BEGIN
273 stream_type_default(std::string_view strMDStructName):
274 stream_type_default(strMDStructName, ddl::DataRepresentation::deserialized)
275 {
276 }
277 ADTF3_IGNORE_DEPRECATION_WARNING_END
286 ADTF3_DEPRECATED("This CTOR uses the ADTF Media Description Service which is deprecated.")
287 stream_type_default(std::string_view strMDStructName,
288 ddl::DataRepresentation eDataRep):
289 cStreamTypeDefaultBase(strMDStructName, eDataRep, 1)
290 {
291 }
292
302 stream_type_default(const std::string& strMDStructName,
303 const ddl::dd::DataDefinition& oDataDefinition,
304 ddl::DataRepresentation eDataRep):
306 strMDStructName, ddl::DDString::toXMLString(strMDStructName, oDataDefinition).c_str(), eDataRep)
307 {
308 }
309};
310
311/**********************************************************************************************/
312/**********************************************************************************************/
313
340template<typename T = void>
342{
343public:
345 "stream_type_default_array can be used only for std::array<T, N> and T[N] "
346 "use i.e. adtf::mediadescription::stream_type_default_array<std::array<T, N>>! "
347 "Use stream_type_default_array<void> if you have a valid media description.");
348};
349
355template<>
356class stream_type_default_array<void> : public detail::cStreamTypeDefaultBase
357{
358public:
363
375 stream_type_default_array(const ddl::DDStructure& oValueTypeDefinition,
376 size_t szArraySize):
377 stream_type_default_array(oValueTypeDefinition, szArraySize, ddl::DataRepresentation::deserialized)
378 {
379 }
380
391 stream_type_default_array(const ddl::DDStructure& oValueTypeDefinition,
392 size_t szArraySize,
393 ddl::DataRepresentation eDataRep):
394 cStreamTypeDefaultBase(oValueTypeDefinition.getStructType().getName(),
395 oValueTypeDefinition.getStructDescription(),
396 eDataRep,
397 szArraySize)
398 {
399 }
400
410 stream_type_default_array(std::string_view strMDStructName,
411 std::string_view strMDDescription,
412 size_t szArraySize):
413 stream_type_default_array(strMDStructName, strMDDescription, szArraySize, ddl::DataRepresentation::deserialized)
414 {
415 }
416
425 stream_type_default_array(std::string_view strMDStructName,
426 std::string_view strMDDescription,
427 size_t szArraySize,
428 ddl::DataRepresentation eDataRep):
429 cStreamTypeDefaultBase(strMDStructName, strMDDescription, eDataRep, szArraySize, true)
430 {
431 }
432
445 ADTF3_IGNORE_DEPRECATION_WARNING_BEGIN
446 stream_type_default_array(std::string_view strMDStructName,
447 size_t szArraySize):
448 stream_type_default_array(strMDStructName, szArraySize, ddl::DataRepresentation::deserialized)
449 {
450 }
451 ADTF3_IGNORE_DEPRECATION_WARNING_END
452
464 ADTF3_DEPRECATED("This CTOR uses the ADTF Media Description Service which is deprecated.")
465 stream_type_default_array(std::string_view strMDStructName,
466 size_t szArraySize,
467 ddl::DataRepresentation eDataRep):
468 cStreamTypeDefaultBase(strMDStructName, eDataRep, szArraySize)
469 {
470 }
471
483 stream_type_default_array(const std::string& strMDStructName,
484 size_t szArraySize,
485 const ddl::dd::DataDefinition& oDataDefinition,
486 ddl::DataRepresentation eDataRep):
487 stream_type_default_array(strMDStructName,
488 ddl::DDString::toXMLString(strMDStructName, oDataDefinition).c_str(),
489 szArraySize,
490 eDataRep)
491 {
492 }
493};
494
501template<class ValueType, size_t szArraySize>
502class stream_type_default_array<ValueType[szArraySize]> : public stream_type_default_array<void>
503{
504public:
505 static_assert(has_description_v<ValueType>,
506 "stream_type_default_array<T>() can only be used if ddl description was generated with adtf_mdgen! "
507 "If you have another source for the description, use stream_type_default_array<void>(...).");
508 static_assert(!std::is_arithmetic_v<ValueType>,
509 "stream_type_default_array can be used only for structured types, "
510 "use adtf::streaming::stream_type_plain<std::array<T, N>> instead");
511 static_assert(std::is_trivially_copyable_v<ValueType>,
512 "stream_type_default_array can be used only for trivial structured types");
513
523 stream_type_default_array(ddl::DataRepresentation::deserialized)
524 {
525 }
526
533 stream_type_default_array<void>(description<ValueType>::name, description<ValueType>::definition, szArraySize, eDataRep)
534 {
535 }
536};
537
545template<typename ValueType, size_t szArraySize>
546class stream_type_default_array<std::array<ValueType, szArraySize>> : public stream_type_default_array<ValueType[szArraySize]>
547{
548public:
549 using stream_type_default_array<ValueType[szArraySize]>::stream_type_default_array;
550};
551
552} // namespace quiet
553
556
561
563
564} //namespace mediadescription
565} //namespace adtf
#define ADTF3_DEPRECATED(_depr_message_)
Definition adtf_base_deprecated.h:27
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
Definition property_intf.h:213
stream_type_default(std::string_view strMDStructName, std::string_view strMDDescription)
CTOR. Creates an instance of the stream_meta_type_default and sets the given description.
Definition stream_type_default.h:242
stream_type_default(const ddl::DDStructure &oTypeDefinition, ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default and sets the given oTypeDefinition....
Definition stream_type_default.h:226
stream_type_default(const std::string &strMDStructName, const ddl::dd::DataDefinition &oDataDefinition, ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default and sets description by evaluating it for t...
Definition stream_type_default.h:302
stream_type_default(std::string_view strMDStructName, std::string_view strMDDescription, ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default and sets the given description.
Definition stream_type_default.h:256
ADTF3_IGNORE_DEPRECATION_WARNING_BEGIN stream_type_default(std::string_view strMDStructName)
CTOR. Creates an instance of the stream_meta_type_default and sets description by evaluating it for t...
Definition stream_type_default.h:273
stream_type_default(const ddl::DDStructure &oTypeDefinition)
CTOR. Creates an instance of the stream_meta_type_default and sets the given oTypeDefinition....
Definition stream_type_default.h:214
stream_type_default_array()
CTOR. Creates an instance of the stream_meta_type_default for the given std::array type....
Definition stream_type_default.h:522
stream_type_default_array(ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default for the given std::array type....
Definition stream_type_default.h:532
stream_type_default_array(std::string_view strMDStructName, std::string_view strMDDescription, size_t szArraySize)
CTOR. Creates an instance of the stream_meta_type_default and sets the given description.
Definition stream_type_default.h:410
ADTF3_IGNORE_DEPRECATION_WARNING_BEGIN stream_type_default_array(std::string_view strMDStructName, size_t szArraySize)
CTOR. Creates an instance of the stream_meta_type_default and sets the value type description by eval...
Definition stream_type_default.h:446
stream_type_default_array(const std::string &strMDStructName, size_t szArraySize, const ddl::dd::DataDefinition &oDataDefinition, ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default and sets description by evaluating it for t...
Definition stream_type_default.h:483
stream_type_default_array(const ddl::DDStructure &oValueTypeDefinition, size_t szArraySize, ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default and and use the given oValueTypeDefinition ...
Definition stream_type_default.h:391
stream_type_default_array(std::string_view strMDStructName, std::string_view strMDDescription, size_t szArraySize, ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default and sets the given description.
Definition stream_type_default.h:425
stream_type_default_array(const ddl::DDStructure &oValueTypeDefinition, size_t szArraySize)
CTOR. Creates an instance of the stream_meta_type_default and and use the given oValueTypeDefinition ...
Definition stream_type_default.h:375
Generator template to create an instance of the stream_meta_type_default.
Definition stream_type_default.h:342
Generator template to create an instance of the stream_meta_type_default.
Definition stream_type_default.h:158
stream_type_default(ddl::DataRepresentation eDataRep)
CTOR. Creates an instance of the stream_meta_type_default. This ctor expects a generated osborn::desc...
Definition stream_type_default.h:186
stream_type_default()
CTOR. Creates an instance of the stream_meta_type_default. This ctor expects a generated osborn::desc...
Definition stream_type_default.h:178
Defines access methods for the interface of a Stream Type.
Definition streamtype_intf.h:96
Definition streamtype.h:276
Utility class for a complete valid data definition of one StructType and its dependencies....
Definition ddstructure.h:57
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition dd.h:92
constexpr bool always_false
helper template to get a always false expression.
Definition adtf_base_type_traits.h:23
Namespace for all functionality of the ADTF Mediadescription SDK provided since v3....
Definition codec_sample_streamer.h:24
std::tuple< std::string, std::string, ddl::tDataRepresentation > get_media_description_from_stream_type(const adtf::streaming::IStreamType &oStreamType)
tResult set_media_description_properties(base::ant::IProperties &oProperties, const char *strStructName, const char *strMediaDescription, ddl::tDataRepresentation eRep=ddl::tDataRepresentation::Deserialized)
tResult set_stream_type_media_description_from_service(adtf::streaming::IStreamType &oStreamType, const char *strStructName, ddl::tDataRepresentation eRep=ddl::tDataRepresentation::Deserialized)
tResult get_codec_factory_from_stream_type(const adtf::streaming::IStreamType &oStreamType, cSampleCodecFactory &oFactory)
void set_stream_type_media_description(streaming::ant::IStreamType &oStreamType, const ddl::DDStructure &type_definition)
Namespace for all functionality of the ADTF Mediadescription SDK provided since v3....
Definition sample_codec.h:1629
Namespace for the ADTF Mediadescription SDK.
Definition codec_sample_streamer.h:22
constexpr bool has_description_v
Definition md_sample_data.h:61
Namespace for the ADTF Streaming SDK.
Definition bindingproxyinport.h:14
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
definition of the ddl namespace
Definition codec.h:21
DataRepresentation
Definition data_representation.h:25
@ Deserialized
alias names for legacy reasons
Definition data_representation.h:29
DataRepresentation tDataRepresentation
Typedef provided for compatibility reasons.
Definition data_representation.h:32
Definition md_sample_data.h:54