32 virtual tResult
Set(
const void* pValue,
size_t szSize) = 0;
42 virtual const void*
Get()
const = 0;
100 inline static tResult
Assign(T* pAssignValue,
101 const size_t szStaticSize,
102 const void* pValueToSet,
103 const size_t szSizeToSet);
112 inline static const void*
GetPtr(
const T* pAssignValue);
121 inline static size_t GetSize(
const T* pAssignValue,
const size_t szStaticSize);
130 static tResult
Assign(adtf_util::cMemoryBlock* pAssignValue,
132 const void* pValueToSet,
133 const size_t szSizeToSet)
135 return pAssignValue->Set(pValueToSet, szSizeToSet);
138 static const void*
GetPtr(
const adtf_util::cMemoryBlock* pAssignValue)
140 return pAssignValue->GetPtr();
143 static size_t GetSize(
const adtf_util::cMemoryBlock* pAssignValue,
const size_t )
145 return static_cast<size_t>(pAssignValue->GetSize());
154 static tResult
Assign(adtf_util::cMemoryPtr* pAssignValue,
156 const void* pValueToSet,
157 const size_t szSizeToSet)
159 return pAssignValue->Assign(pValueToSet, szSizeToSet);
161 static const void*
GetPtr(
const adtf_util::cMemoryPtr* pAssignValue)
163 return pAssignValue->GetPtr();
165 static size_t GetSize(
const adtf_util::cMemoryPtr* pAssignValue,
const size_t )
167 return static_cast<size_t>(pAssignValue->GetSize());
178 static tResult
Assign(
const void* ,
183 RETURN_ERROR(ERR_ACCESS_DENIED);
185 static const void*
GetPtr(
const void* pAssignValue)
189 static size_t GetSize(
const void* ,
const size_t szStaticSize)
201 size_t m_szCurrentSize = g_npos;
203 tResult
Assign(
void* pAssignValue,
204 const size_t szStaticSize,
205 const void* pValueToSet,
206 const size_t szSizeToSet)
208 if (szSizeToSet <= szStaticSize)
210 adtf_util::cMemoryBlock::MemCopy(pAssignValue, pValueToSet, szSizeToSet);
211 m_szCurrentSize = szSizeToSet;
216 RETURN_ERROR(ERR_MEMORY);
219 static const void*
GetPtr(
const void* pAssignValue)
223 size_t GetSize(
const void* ,
const size_t szStaticSize)
const
225 if (m_szCurrentSize != g_npos)
227 return m_szCurrentSize;
244 template <
typename T,
size_t TSIZE = 0>
249 typedef T _myStorageType;
273 tResult
Set(
const void* pValue,
size_t szSize)
275 if (pValue !=
nullptr)
281 RETURN_ERROR(ERR_POINTER);
302 template <
typename T,
typename Enable =
void>
320 tResult
Set(
const void* pValue,
size_t szSize)
override
322 if (szSize > GetSize())
324 RETURN_ERROR(ERR_OUT_OF_RANGE);
327 adtf_util::cMemoryBlock::MemCopy(m_pPtr, pValue, szSize);
337 const void*
Get()
const override
343 template <
typename T>
358 tResult
Set(
const void* ,
size_t )
override
360 RETURN_ERROR(ERR_NOACCESS);
368 const void*
Get()
const override
376 using ant::adtf_memory_forward;
378 using ant::adtf_memory;
380 using ant::IRawMemory;
382 using ant::adtf_memory_buffer;
393 #define adtf_memory_intf(__utils_memblock__) adtf::base::adtf_memory<adtf_util::cMemoryBlock>(& (__utils_memblock__))
Copyright © Audi Electronics Venture GmbH.
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.
Template class implementation for the IRawMemory interface.
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 adtf_util Namespace - Within adtf this is used as adtf::util or adtf_util and also defined as A_...
Namespace for entire ADTF SDK.
static tResult Assign(adtf_util::cMemoryBlock *pAssignValue, const size_t, 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 const void * GetPtr(const adtf_util::cMemoryBlock *pAssignValue)
Gets the memory pointer to the of container class T in parameter pAssignValue.
static size_t GetSize(const adtf_util::cMemoryBlock *pAssignValue, const size_t)
Gets size in bytes of the memory pointer of container class T in parameter pAssignValue.
Concept template class which can only be specialized to use it for adtf_memory<T>.
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.