ADTF  3.13.2
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 
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 
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 tChar *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
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:157
Copyright © Audi Electronics Venture GmbH.
static constexpr const tChar *const PlainTypeProperty
c-type Property for plaintype Stream Meta Type
uint8_t tUInt8
type definition for unsigned integer values (8bit) (platform and compiler independent type)...
int8_t tInt8
type definition for signed integer values (8bit) (platform and compiler independent type)...
A common result class usable as return value throughout.
Definition: result.h:23
static tVoid SetProperties(const adtf::ucom::iobject_ptr< adtf::base::IProperties > &pProperties)
Property setter for plaintype.
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description...
Definition: error.h:47
ADTF_DEFINE_STREAM_TYPE_PLAIN_FOR(tBool, "BOOL")
defines a stream_type_plain for the c-type tBool
uint16_t tUInt16
type definition for unsigned integer values (16bit) (platform and compiler independent type)...
Namespace for entire ADTF SDK.
static constexpr const tChar *const MetaTypeName
StreamMetaTypeName for plaintype.
Generator template to create an instance of a IStreamType class for stream_meta_type_plain ("adtf/pla...
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".
int16_t tInt16
type definition for signed integer values (16bit) (platform and compiler independent type)...
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type)...
float tFloat32
type definition for Float32 (32bit float values) (platform and compiler independent type)...
Copyright © Audi Electronics Venture GmbH.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function&#39;s return type to be tResult...
Definition: error.h:35
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent)...
Copyright © Audi Electronics Venture GmbH.
int32_t tInt32
type definition for signed integer values (32bit) (platform and compiler independent type)...
Property property implementation template.
Definition: property.h:372
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type)...
virtual tResult GetConfig(ucom::ant::iobject_ptr< base::ant::IProperties > &pProperties)=0
Get all properties of a Stream Type (read/write)
int64_t tInt64
type definition for signed integer values (64bit) (platform and compiler independent type)...
Base object pointer to realize binary compatible reference counting in interface methods.
Use this Stream Meta Type if your sample data will be any of this type: tBool, tUInt8, tInt8, tUInt16, tInt16, tUInt32, tInt32, tUInt64, tInt64, tFloat32 or tFloat64.
#define RETURN_IF_FAILED(s)
returns if the expression returns a failed tResult or throws an exception.
Defines access methods for the interface of a Stream Type - see also Stream Type and Stream Meta Type...
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 ...
double tFloat64
type definition for Float64 (64bit double values) (platform and compiler independent type)...
uint64_t tUInt64
type definition for unsigned integer values (64bit) (platform and compiler independent type)...

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Tue Nov 16 2021 by doxygen 1.8.14)