12 #include <type_traits>
93 auto strCheckPlainType = adtf::base::get_property<adtf_util::cString>(*pCheckProperties,
PlainTypeProperty);
94 auto strExpectedPlainType = adtf::base::get_property<adtf_util::cString>(*pExpectedProperties,
PlainTypeProperty);
96 if (strCheckPlainType != strExpectedPlainType)
99 "The destination plain type '%s' differs from the source plain type '%s'",
100 strCheckPlainType.GetPtr(),
101 strExpectedPlainType.GetPtr());
117 template <
typename T>
120 static_assert(base::penguin::detail::always_false<T>,
"Invalid type for stream_type_plain<T> used! "
121 "Use bool, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double or plain array T[], std::array, std::vector of them");
130 #define ADTF_DEFINE_STREAM_TYPE_PLAIN_FOR( _thetype_ , _propval_ ) \
132 class stream_type_plain<_thetype_> : public cStreamType \
135 static constexpr const char *const PlainTypeValue = _propval_; \
136 static constexpr const char* const PlainTypeName = #_thetype_; \
137 stream_type_plain() : cStreamType(stream_meta_type_plain()) \
139 adtf::ucom::object_ptr<adtf::base::ant::IProperties> pProperties; \
140 THROW_IF_FAILED(GetConfig(pProperties)); \
141 pProperties->SetProperty(adtf::base::property<adtf_util::cString>(stream_meta_type_plain::PlainTypeProperty, PlainTypeValue)); \
142 pProperties->SetProperty(adtf::base::property<adtf_util::cString>("md_definitions",\
143 adtf_util::cString::Format(R"(<struct name=")" _propval_ R"(" alignment="1" version="1">)" \
144 R"(<element name="value" arraysize="1" type=")" #_thetype_ R"(">)" \
145 R"(<deserialized alignment="1"/>)" \
146 R"(<serialized bytepos="0" byteorder="%s"/>)" \
149 PLATFORM_BYTEORDER == PLATFORM_BIG_ENDIAN_8 ? "BE" : "LE"))); \
150 pProperties->SetProperty(adtf::base::property<adtf_util::cString>("md_struct", _propval_));\
211 ADTF3_DEPRECATED(
"Use adtf::ucom::make_object_ptr<stream_type_plain<T>>() instead!")
214 return ucom::ant::make_object_ptr<ant::stream_type_plain<T>>();
237 static constexpr
const char*
const ArraySize =
"array_size";
284 const auto strCheckPlainType = adtf::base::get_property<adtf_util::cString>(*pCheckProperties,
PlainTypeProperty);
285 const auto strExpectedPlainType = adtf::base::get_property<adtf_util::cString>(*pExpectedProperties,
PlainTypeProperty);
287 if (strCheckPlainType != strExpectedPlainType)
290 "The checked plain type '%s' differs from the expected plain type '%s'",
291 strCheckPlainType.GetPtr(),
292 strExpectedPlainType.GetPtr());
295 const auto uiExpectedDataEndianess
297 if (uiCheckDataEndianess != uiExpectedDataEndianess)
299 if (strCheckPlainType !=
"UINT8" && strCheckPlainType !=
"INT8" && strCheckPlainType !=
"BOOL" && strCheckPlainType !=
"UINT8_ARRAY" && strCheckPlainType !=
"INT8_ARRAY" && strCheckPlainType !=
"BOOL_ARRAY")
302 "The checked plain type '%s' differs from the expected plain type '%s' in endianess",
303 strCheckPlainType.GetPtr(),
304 strExpectedPlainType.GetPtr());
308 const auto uiCheckArraySize = adtf::base::get_property<size_t>(*pCheckProperties,
ArraySize, 1);
309 const auto uiExpectedArraySize = adtf::base::get_property<size_t>(*pExpectedProperties,
ArraySize, 1);
310 if (uiCheckArraySize < uiExpectedArraySize)
314 "The checked plain type '%s' array size (%zu) is lower than the expected plain type '%s' array size (%zu)",
315 strCheckPlainType.GetPtr(), uiCheckArraySize, strExpectedPlainType.GetPtr(), uiExpectedArraySize);
344 pProperties->SetProperty(
357 template<
typename ValueType,
size_t szArraySize,
template<
typename,
size_t>
class T>
360 static_assert(std::is_arithmetic_v<
typename T<ValueType, szArraySize>::value_type>,
361 "std::array can only be used for arithmetic types");
377 const adtf_util::cString strMDDefValue = adtf_util::cString::Format(R
"(<struct name="%s" alignment="1" version="1">
378 <element name="value" arraysize="%zu" type="%s">
379 <deserialized alignment="1"/>
380 <serialized bytepos="0" byteorder="%s"/>
382 </struct>)", strPropValue.GetPtr(), szArraySize,
383 strPropTypeName.GetPtr(),
398 template<
class ValueType,
size_t szArraySize>
409 ADTF3_DEPRECATED(
"Use adtf::ucom::make_object_ptr<stream_type_plain<T>>() instead!")
412 return ucom::ant::make_object_ptr<penguin::stream_type_plain<T>>();
418 using penguin::stream_meta_type_plain;
421 using penguin::stream_type_plain;
Copyright © Audi Electronics Venture GmbH.
#define ADTF3_DEPRECATED(_depr_message_)
Mark a function or variable as deprecated.
Copyright © Audi Electronics Venture GmbH.
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).
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
A common result class usable as return value throughout.
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)
Default StreamType implementation.
Generator template to create an instance of a ant::IStreamType class for ant::stream_meta_type_plain ...
Generator template to create an instance of a ant::IStreamType class for penguin::stream_meta_type_pl...
Base object pointer to realize binary compatible reference counting in interface methods.
Object pointer implementation used for reference counting on objects of type IObject.
#define PLATFORM_BIG_ENDIAN_8
defines the big endianess value, that will be retrieved by
#define PLATFORM_BYTEORDER
defines a link to __get_platform_byteorder.
#define PLATFORM_LITTLE_ENDIAN_8
defines the little endianess value, that will be retrieved by
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
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".
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".
ant::object_ptr< T > object_ptr
Alias always bringing the latest version of ant::object_ptr into scope.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
#define THROW_IF_FAILED(s)
throws if the expression returns a failed tResult