10 #include "adtf_base_type_traits.h"
38 template <
typename TYPE>
43 static_assert(adtf::base::penguin::detail::always_false<TYPE>,
"Unsupported type! Use bool, int8_t, uint8_t, .. float, double or adtf_util::cString."
44 "Otherwise specialize this property_type_conversion template!");
49 static_assert(adtf::base::penguin::detail::always_false<TYPE>,
"Unsupported type! Use bool, int8_t, uint8_t, .. float, double or adtf_util::cString."
50 "Otherwise specialize this property_type_conversion template!");
55 static_assert(adtf::base::penguin::detail::always_false<TYPE>,
"Unsupported type! Use bool, int8_t, uint8_t, .. float, double or adtf_util::cString."
56 "Otherwise specialize this property_type_conversion template!");
59 static tResult ToRaw(
const void* pData,
const size_t szDataSize,
IRawMemory& oToMem)
61 static_assert(adtf::base::penguin::detail::always_false<TYPE>,
"Unsupported type! Use bool, int8_t, uint8_t, .. float, double or adtf_util::cString."
62 "Otherwise specialize this property_type_conversion template!");
65 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
const size_t szDataSize)
67 static_assert(adtf::base::penguin::detail::always_false<TYPE>,
"Unsupported type! Use bool, int8_t, uint8_t, .. float, double or adtf_util::cString."
68 "Otherwise specialize this property_type_conversion template!");
81 adtf::util::cStringUtil::ToType(strValue, bValue);
88 std::string_view strHelper(strValue.GetPtr());
89 if (strHelper.empty())
97 oValue = string_conversion::to_number<T>(strHelper, 0);
99 catch (
const std::overflow_error&)
101 if (strHelper.front() !=
'-')
103 oValue = std::numeric_limits<T>::max();
107 oValue = std::numeric_limits<T>::lowest();
110 catch (
const std::exception&)
112 bool bHelper =
false;
113 adtf::util::cStringUtil::ToType(strValue.GetPtr(), bHelper);
114 oValue =
static_cast<T
>(bHelper);
122 strValue.Set(adtf_util::cString::FromType(oValue));
126 template <
typename TYPE>
135 oValue.Set(strValue);
141 strValue.Set(oValue);
144 static tResult ToRaw(
const void* pData,
const size_t szSizeOfData,
IRawMemory& oToMem);
145 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
const size_t szSizeOfData);
166 template <
typename TYPE>
171 return cPropertyConvert::Convert(oProp, oValue);
176 return cPropertyConvert::ToString(oValue, strValue);
181 return cPropertyConvert::FromString(strValue, oValue);
184 static tResult ToRaw(
const void* pData,
const size_t szSizeOfData,
IRawMemory& oToMem)
186 return cPropertyConvert::ToRaw(pData, szSizeOfData, oToMem);
189 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
const size_t szSizeOfData)
191 return cPropertyConvert::FromRaw(oFromMem, pData, szSizeOfData);
205 static tResult ToRaw(
const void* pData,
const size_t szDataSize,
IRawMemory& oToMem);
206 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
const size_t szDataSize);
219 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
const size_t szSizeOfData);
236 static tResult ToRaw(
const void* pData,
const size_t szSizeOfData,
IRawMemory& oToMem);
237 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
const size_t szSizeOfData);
244 template <
typename TYPE>
287 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
size_t szDataSize);
300 static tResult FromRaw(
const IRawMemory& oFromMem,
void* pData,
size_t szDataSize);
#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.
The IPropertyValue interface provides methods for getting and setting property values.
The IRawMemory interface provides methods for getting and setting memory values through abstract inte...
cString to_string(const tResult &i_oResult, eResultFormatFlags i_eFormatFlags=eResultFormatFlags::RFF_DisableNone, const tChar *i_strFormat=nullptr)
Copy all information of an assigned result object to a (formatted) string.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Conversion type used for adtf::base::ant::property<cFilename> and adtf::base::ant::property<cFilepath...
Conversion type used for adtf::base::ant::property<cFilenameList> and adtf::base::ant::property<cFile...
Adtf build in conversion type implementation used by property_type_default_conversion.
Conversion type used for property<cString>
Concept template to define the conversion type for the given type TYPE of a property.
Default conversion type used for all build in property types of adtf.
Conversion type used for property<tNanoSeconds>
Conversion type used for adtf::base::ant::property<std::string>
A timestamp with nanosecond precision.
Public API for compatibility to C++11 <chrono>