9#include "adtf_base_type_traits.h"
33 virtual tResult Set(
const void* pValue,
size_t szSize) = 0;
43 virtual const void*
Get()
const = 0;
102 const size_t szStaticSize,
103 const void* pValueToSet,
104 const size_t szSizeToSet)
107 "Unsupported type T! See documentation which types are supported."
108 "adtf_memory<T> only supports trivial types unless you specialize the adtf_memory_forward<T> for the type T!");
119 inline static const void*
GetPtr(
const T* pAssignValue)
122 "Unsupported type T! See documentation which types are supported."
123 "adtf_memory<T> only supports trivial types unless you specialize the adtf_memory_forward<T> for the type T!");
119 inline static const void*
GetPtr(
const T* pAssignValue) {
…}
134 inline static size_t GetSize(
const T* pAssignValue,
const size_t szStaticSize)
137 "Unsupported type T! See documentation which types are supported."
138 "adtf_memory<T> only supports trivial types unless you specialize the adtf_memory_forward<T> for the type T!");
134 inline static size_t GetSize(
const T* pAssignValue,
const size_t szStaticSize) {
…}
149template<
typename T,
size_t TSIZE = 0>
152 typedef adtf_memory<T, TSIZE> _myType;
153 typedef T _myStorageType;
179 if (pValue !=
nullptr)
206template<
typename T,
typename Enable =
void>
207class adtf_memory_buffer :
215 adtf_memory_buffer(T* pPtr,
size_t szSize):
228 adtf_util::cMemoryBlock::MemCopy(m_pPtr, pValue, szSize);
238 const void*
Get()
const override
238 const void*
Get()
const override {
…}
207class adtf_memory_buffer : {
…};
245class adtf_memory_buffer<T, typename std::enable_if<std::is_const<T>::value>::type> :
253 adtf_memory_buffer(
const T* pPtr,
size_t szSize):
269 const void*
Get()
const override
269 const void*
Get()
const override {
…}
245class adtf_memory_buffer<T, typename std::enable_if<std::is_const<T>::value>::type> : {
…};
291template<
typename T,
typename Enable =
void>
295 explicit adtf_memory_trivial_type(T* pValuePointer):
296 m_pAssignedValue(pValuePointer)
311 if (szSize ==
sizeof(T))
313 adtf_util::cMemoryBlock::MemCopy(m_pAssignedValue, pValue, szSize);
337 const void*
Get()
const override
339 return m_pAssignedValue;
337 const void*
Get()
const override {
…}
343 T* m_pAssignedValue =
nullptr;
347class adtf_memory_trivial_type<T, typename std::enable_if<std::is_const<T>::value>::type>
351 explicit adtf_memory_trivial_type(T* pValuePointer):
352 m_pAssignedValue(pValuePointer)
373 if (m_pAssignedValue)
383 const void*
Get()
const override
385 return m_pAssignedValue;
383 const void*
Get()
const override {
…}
388 T* m_pAssignedValue =
nullptr;
347class adtf_memory_trivial_type<T, typename std::enable_if<std::is_const<T>::value>::type> {
…};
406template<
typename T,
size_t TSIZE = 0,
typename Enable=
void>
409 typedef adtf_memory<T, TSIZE, void> _myType;
410 typedef T _myStorageType;
447 constexpr auto szSizeToUse = std::conditional<std::is_void<T>::value,
450 if (pValue !=
nullptr)
463 const void*
Get()
const override
463 const void*
Get()
const override {
…}
478 constexpr auto szSizeToUse = std::conditional<std::is_void<T>::value,
495class adtf_memory<T, 0, typename std::enable_if<std::is_trivially_copyable<T>::value>::type>
500 typedef T _myStorageType;
505 _myBase(pAssignValue)
Copyright © Audi Electronics Venture GmbH.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define RETURN_IF_POINTER_NULL(_ptr)
Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResul...
The IRawMemory interface provides methods for getting and setting memory values through abstract inte...
virtual tResult Set(const void *pValue, size_t szSize)=0
Sets the Raw pointer memory.
virtual size_t GetSize() const =0
Returns the size in bytes of the memory.
virtual const void * Get() const =0
Returns the raw memory pointer.
tResult Set(const void *, size_t) override
Sets the Raw pointer memory.
size_t GetSize() const override
Returns the size in bytes of the memory.
const void * Get() const override
Returns the raw memory pointer.
tResult Set(const void *pValue, size_t szSize) override
Sets the Raw pointer memory.
size_t GetSize() const override
Returns the size in bytes of the memory.
const void * Get() const override
Returns the raw memory pointer.
Legacy template class for adtf_memory usage.
size_t GetSize() const
Returns the size in bytes of the memory.
adtf_memory(T *pAssignValue)
explicit CTOR to create a IRawMemory interface rvalue
virtual ~adtf_memory()
DTOR.
tResult Set(const void *pValue, size_t szSize)
Sets the Raw pointer memory.
const void * Get() const
Returns the raw memory pointer.
tResult Set(const void *, size_t) override
Sets the Raw pointer memory.
size_t GetSize() const override
Returns the size in bytes of the memory.
const void * Get() const override
Returns the raw memory pointer.
Template class implementation for the IRawMemory interface for trivial types.
tResult Set(const void *pValue, size_t szSize) override
Sets the Raw pointer memory.
size_t GetSize() const override
Returns the size in bytes of the memory.
const void * Get() const override
Returns the raw memory pointer.
Template class implementation for the IRawMemory interface (see Supported types for adtf_memory<T> fo...
adtf_memory(T *pAssignValue)
explicit CTOR to create a IRawMemory interface rvalue
virtual ~adtf_memory()
DTOR.
tResult Set(const void *pValue, size_t szSize) override
Sets the content of the assigned value of type T to the given memory.
size_t GetSize() const override
Retrieves the size of the content of the assigned value of type T.
const void * Get() const override
Retrieves the content of the assigned value of type T as memory pointer.
Namespace for all functionality of the ADTF Base SDK provided since v3.0.
constexpr bool always_false
helper template to get a always false expression.
Namespace for the ADTF Base SDK.
Namespace for entire ADTF SDK.
Concept template class for non trivial adtf_memory types of type T to specialize the usage of adtf_me...
static tResult Assign(T *pAssignValue, const size_t szStaticSize, const void *pValueToSet, const size_t szSizeToSet)
Sets (copy) the memory value pValueToSet of size in bytes szSizeToSet to the of container class T in ...
static size_t GetSize(const T *pAssignValue, const size_t szStaticSize)
Gets size in bytes of the memory pointer of container class T in parameter pAssignValue.
static const void * GetPtr(const T *pAssignValue)
Gets the memory pointer to the of container class T in parameter pAssignValue.
helper template to retrieve the given size as expression.
helper template to retrieve the given size as expression.