ADTF  3.14.3
streammetatypeplain.h
Go to the documentation of this file.
1 
7 #pragma once
8 #include "streamtype.h"
9 #include <adtfucom3/adtf_ucom3.h>
10 #include <adtfbase/adtf_base.h>
11 #include <type_traits>
12 
13 namespace adtf
14 {
15 namespace streaming
16 {
17 namespace ant
18 {
19 
28 {
30  static constexpr const tChar *const MetaTypeName = "adtf/plaintype";
47  static constexpr const tChar *const PlainTypeProperty = "c-type";
48 
53  {
54  pProperties->SetProperty(adtf::base::property<adtf_util::cString>(PlainTypeProperty, ""));
55  }
56 
72  static tResult IsCompatible(const adtf::streaming::IStreamType& oTypeToCheck,
73  const adtf::streaming::IStreamType& oTypeExpected)
74  {
76  RETURN_IF_FAILED(oTypeToCheck.GetConfig(pCheckProperties));
78  RETURN_IF_FAILED(oTypeExpected.GetConfig(pExpectedProperties));
79 
80  auto strCheckPlainType = adtf::base::get_property<adtf_util::cString>(*pCheckProperties, PlainTypeProperty);
81  auto strExpectedPlainType = adtf::base::get_property<adtf_util::cString>(*pExpectedProperties, PlainTypeProperty);
82 
83  if (strCheckPlainType != strExpectedPlainType)
84  {
85  RETURN_ERROR_DESC(ERR_FAILED,
86  "The destination plain type '%s' differs from the source plain type '%s'",
87  strCheckPlainType.GetPtr(),
88  strExpectedPlainType.GetPtr());
89  }
90 
91  RETURN_NOERROR;
92  }
93 };
94 
105 template <typename T>
107 {
108 public:
111  {
112  //static_assert(tFalse, "invalid_type");
113  }
114 };
115 
122 #define ADTF_DEFINE_STREAM_TYPE_PLAIN_FOR( _thetype_ , _propval_ ) \
123 template <> \
124 class stream_type_plain<_thetype_> : public cStreamType \
125 { \
126 public: \
127  static constexpr const char *const PlainTypeValue = _propval_; \
128  stream_type_plain() : cStreamType(stream_meta_type_plain()) \
129  { \
130  adtf::ucom::object_ptr<adtf::base::ant::IProperties> pProperties; \
131  GetConfig(pProperties); \
132  if (pProperties) \
133  { \
134  pProperties->SetProperty(adtf::base::property<adtf_util::cString>(stream_meta_type_plain::PlainTypeProperty, PlainTypeValue)); \
135  pProperties->SetProperty(adtf::base::property<adtf_util::cString>("md_definitions",\
136  R"(<struct name=")" _propval_ R"(" alignment="1" version="1">)" \
137  R"(<element name="value" arraysize="1" type=")" #_thetype_ R"(">)" \
138  R"(<deserialized alignment="1"/>)" \
139  R"(<serialized bytepos="0" byteorder="LE"/>)" \
140  "</element>" \
141  "</struct>")); \
142  pProperties->SetProperty(adtf::base::property<adtf_util::cString>("md_struct", _propval_));\
143  } \
144  } \
145 }
146 
151 
192 
193 } //namespace ant
194 
195 namespace lucky
196 {
202 template<typename T>
204 {
205  return ucom::ant::make_object_ptr<ant::stream_type_plain<T>>();
206 }
207 }
208 
210 using ant::stream_meta_type_plain;
211 
213 using ant::stream_type_plain;
214 
217 
218 } //namespace streaming
219 } //namespace adtf
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Property property implementation template.
Definition: property.h:373
Defines access methods for the interface of a Stream Type - see also Stream Type and Stream Meta Type...
virtual tResult GetConfig(ucom::ant::iobject_ptr< base::ant::IProperties > &pProperties)=0
Get all properties of a Stream Type (read/write)
Generator template to create an instance of a IStreamType class for stream_meta_type_plain ("adtf/pla...
Base object pointer to realize binary compatible reference counting in interface methods.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:158
ADTF_DEFINE_STREAM_TYPE_PLAIN_FOR(tBool, "BOOL")
defines a stream_type_plain for the c-type bool
ucom::ant::object_ptr< ant::IStreamType > create_adtf_plain_stream_type()
Convenience functionality to create a stream type plain - see Stream Meta Type "adtf/plaintype".
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Use this Stream Meta Type if your sample data will be any of this type: bool, uint8_t,...
static constexpr const tChar *const PlainTypeProperty
c-type Property for plaintype Stream Meta Type
static void SetProperties(const adtf::ucom::iobject_ptr< adtf::base::IProperties > &pProperties)
Property setter for plaintype.
static constexpr const tChar *const MetaTypeName
StreamMetaTypeName for plaintype.
static tResult IsCompatible(const adtf::streaming::IStreamType &oTypeToCheck, const adtf::streaming::IStreamType &oTypeExpected)
Compares the oTypeExpected Stream Type with the oTypeToCheck - see Default Stream Meta Types in ADTF ...
#define RETURN_IF_FAILED(s)
returns if the expression returns a failed tResult or throws an exception.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)