33 virtual tResult Set(
const void* pValue,
size_t szSize) = 0;
43 virtual const void*
Get()
const = 0;
105 Assign(T* pAssignValue,
const size_t szStaticSize,
const void* pValueToSet,
const size_t szSizeToSet)
108 "Unsupported type T! See documentation which types are supported."
109 "adtf_memory<T> only supports trivial types unless you specialize the adtf_memory_forward<T> for "
121 inline static const void*
GetPtr(
const T* pAssignValue)
124 "Unsupported type T! See documentation which types are supported."
125 "adtf_memory<T> only supports trivial types unless you specialize the adtf_memory_forward<T> for "
137 inline static size_t GetSize(
const T* pAssignValue,
const size_t szStaticSize)
140 "Unsupported type T! See documentation which types are supported."
141 "adtf_memory<T> only supports trivial types unless you specialize the adtf_memory_forward<T> for "
154template<
typename T,
size_t TSIZE = 0>
157 typedef adtf_memory<T, TSIZE> _myType;
158 typedef T _myStorageType;
165 adtf_memory(
const adtf_memory&) =
delete;
166 adtf_memory& operator=(
const adtf_memory&) =
delete;
167 adtf_memory(adtf_memory&&) =
delete;
168 adtf_memory& operator=(adtf_memory&&) =
delete;
174 m_pAssignValue = pAssignValue;
179 m_pAssignValue =
nullptr;
184 if (pValue !=
nullptr)
195 if (m_pAssignValue !=
nullptr)
203 if (m_pAssignValue !=
nullptr)
214template<
typename T,
typename Enable =
void>
222 adtf_memory_buffer(T* pPtr,
size_t szSize): m_pPtr(pPtr), m_szSize(szSize)
233 adtf_util::cMemoryBlock::MemCopy(m_pPtr, pValue, szSize);
243 const void*
Get()
const override
253class adtf_memory_buffer<T, typename std::enable_if<std::is_const<T>::value>::type> :
public IRawMemory
260 adtf_memory_buffer(
const T* pPtr,
size_t szSize): m_pPtr(pPtr), m_szSize(szSize)
274 const void*
Get()
const override
294template<
typename T,
typename Enable =
void>
298 explicit adtf_memory_trivial_type(T* pValuePointer): m_pAssignedValue(pValuePointer)
313 if (szSize ==
sizeof(T))
315 adtf_util::cMemoryBlock::MemCopy(m_pAssignedValue, pValue, szSize);
329 if (m_pAssignedValue)
339 const void*
Get()
const override
341 return m_pAssignedValue;
345 T* m_pAssignedValue =
nullptr;
352class adtf_memory_trivial_type<T, typename std::enable_if<std::is_const<T>::value>::type> :
356 explicit adtf_memory_trivial_type(T* pValuePointer): m_pAssignedValue(pValuePointer)
377 if (m_pAssignedValue)
387 const void*
Get()
const override
389 return m_pAssignedValue;
393 T* m_pAssignedValue =
nullptr;
410template<
typename T,
size_t TSIZE = 0,
typename Enable =
void>
413 typedef adtf_memory<T, TSIZE, void> _myType;
414 typedef T _myStorageType;
421 adtf_memory(
const adtf_memory&) =
delete;
422 adtf_memory& operator=(
const adtf_memory&) =
delete;
423 adtf_memory(adtf_memory&&) =
delete;
424 adtf_memory& operator=(adtf_memory&&) =
delete;
431 explicit adtf_memory(T* pAssignValue): m_pAssignValue(pAssignValue)
439 m_pAssignValue =
nullptr;
450 constexpr auto szSizeToUse =
453 if (pValue !=
nullptr)
466 const void*
Get()
const override
468 if (m_pAssignValue !=
nullptr)
481 constexpr auto szSizeToUse =
484 if (m_pAssignValue !=
nullptr)
498class adtf_memory<T, 0, typename std::enable_if<std::is_trivially_copyable<T>::value>::type> :
503 typedef T _myStorageType;
507 explicit adtf_memory(T* pAssignValue): _myBase(pAssignValue)
Definition for type traits helper Copyright © Audi Electronics Venture GmbH. All rights reserved.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
Definition result.h:42
#define RETURN_IF_POINTER_NULL(_ptr)
Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResul...
Definition result.h:49
Definition rawmemory_base.h:23
virtual size_t GetSize() const =0
virtual tResult Set(const void *pValue, size_t szSize)=0
virtual const void * Get() const =0
const void * Get() const override
Definition rawmemory_base.h:274
tResult Set(const void *, size_t) override
Definition rawmemory_base.h:264
size_t GetSize() const override
Definition rawmemory_base.h:269
Template class implementation for the IRawMemory interface.
Definition rawmemory_base.h:216
const void * Get() const override
Definition rawmemory_base.h:243
tResult Set(const void *pValue, size_t szSize) override
Definition rawmemory_base.h:226
size_t GetSize() const override
Definition rawmemory_base.h:238
const void * Get() const
Definition rawmemory_base.h:193
size_t GetSize() const
Definition rawmemory_base.h:201
adtf_memory(T *pAssignValue)
explicit CTOR to create a IRawMemory interface rvalue
Definition rawmemory_base.h:172
virtual ~adtf_memory()
DTOR.
Definition rawmemory_base.h:177
tResult Set(const void *pValue, size_t szSize)
Definition rawmemory_base.h:182
tResult Set(const void *, size_t) override
Definition rawmemory_base.h:367
size_t GetSize() const override
Definition rawmemory_base.h:375
const void * Get() const override
Definition rawmemory_base.h:387
Definition rawmemory_base.h:296
tResult Set(const void *pValue, size_t szSize) override
Definition rawmemory_base.h:309
size_t GetSize() const override
Definition rawmemory_base.h:327
const void * Get() const override
Definition rawmemory_base.h:339
Definition rawmemory_base.h:412
const void * Get() const override
Retrieves the content of the assigned value of type T as memory pointer.
Definition rawmemory_base.h:466
virtual ~adtf_memory()
DTOR.
Definition rawmemory_base.h:437
size_t GetSize() const override
Retrieves the size of the content of the assigned value of type T.
Definition rawmemory_base.h:479
tResult Set(const void *pValue, size_t szSize) override
Sets the content of the assigned value of type T to the given memory.
Definition rawmemory_base.h:448
adtf_memory(T *pAssignValue)
explicit CTOR to create a IRawMemory interface rvalue
Definition rawmemory_base.h:431
Namespace for all functionality of the ADTF Base SDK provided since v3.0.
Definition adtf_class_version.h:16
constexpr bool always_false
helper template to get a always false expression.
Definition adtf_base_type_traits.h:23
Namespace for the ADTF Base SDK.
Definition adtf_base_type_traits.h:13
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
Definition rawmemory_base.h:91
static size_t GetSize(const T *pAssignValue, const size_t szStaticSize)
Definition rawmemory_base.h:137
static tResult Assign(T *pAssignValue, const size_t szStaticSize, const void *pValueToSet, const size_t szSizeToSet)
Definition rawmemory_base.h:105
static const void * GetPtr(const T *pAssignValue)
Definition rawmemory_base.h:121
helper template to retrieve the given size as expression.
Definition adtf_base_type_traits.h:31
helper template to retrieve the given size as expression.
Definition adtf_base_type_traits.h:41