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)
106 static_assert(penguin::detail::always_false<T>,
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)
121 static_assert(penguin::detail::always_false<T>,
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!");
134 inline static size_t GetSize(
const T* pAssignValue,
const size_t szStaticSize)
136 static_assert(penguin::detail::always_false<T>,
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!");
149 template<
typename T,
size_t TSIZE = 0>
153 typedef T _myStorageType;
179 if (pValue !=
nullptr)
206 template<
typename T,
typename Enable =
void>
228 adtf_util::cMemoryBlock::MemCopy(m_pPtr, pValue, szSize);
238 const void*
Get()
const override
269 const void*
Get()
const override
291 template<
typename T,
typename Enable =
void>
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;
343 T* m_pAssignedValue =
nullptr;
352 m_pAssignedValue(pValuePointer)
373 if (m_pAssignedValue)
383 const void*
Get()
const override
385 return m_pAssignedValue;
388 T* m_pAssignedValue =
nullptr;
406 template<
typename T,
size_t TSIZE = 0,
typename Enable=
void>
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
478 constexpr
auto szSizeToUse = std::conditional<std::is_void<T>::value,
495 class adtf_memory<T, 0, typename std::enable_if<std::is_trivially_copyable<T>::value>::type>
500 typedef T _myStorageType;
Copyright © Audi Electronics Venture GmbH.
#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...
A common result class usable as return value throughout.
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.
T * m_pAssignValue
Reference pointer to the T constructed with explict adtf_memory.
tResult Set(const void *pValue, size_t szSize)
Sets the Raw pointer memory.
const void * Get() const
Returns the raw memory pointer.
adtf memory class template specialization for trivial types
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 ant::IRawMemory interface (see Supported types for adtf_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) 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.
T * m_pAssignValue
Reference pointer to the T constructed with explict adtf_memory.
const void * Get() const override
Retrieves the content of the assigned value of type T as memory pointer.
Namespace for entire ADTF SDK.
Concept template class for non trivial penguin::adtf_memory types of type T to specialize the usage o...
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.