29 const void* pValueToSet,
30 const size_t szSizeToSet)
32 return pAssignValue->Set(pValueToSet, szSizeToSet);
35 static const void*
GetPtr(
const adtf_util::cMemoryBlock* pAssignValue)
37 return pAssignValue->GetPtr();
40 static size_t GetSize(
const adtf_util::cMemoryBlock* pAssignValue,
const size_t )
42 return static_cast<tSize
>(pAssignValue->GetSize());
54 const void* pValueToSet,
55 const size_t szSizeToSet)
57 return pAssignValue->Assign(pValueToSet, szSizeToSet);
59 static const void*
GetPtr(
const adtf_util::cMemoryPtr* pAssignValue)
61 return pAssignValue->GetPtr();
63 static size_t GetSize(
const adtf_util::cMemoryPtr* pAssignValue,
const size_t )
65 return static_cast<tSize
>(pAssignValue->GetSize());
83 static const void*
GetPtr(
const void* pAssignValue)
87 static size_t GetSize(
const void* ,
const size_t szStaticSize)
99 size_t m_szCurrentSize = g_npos;
102 tResult Assign(
void* pAssignValue,
const size_t szStaticSize,
const void* pValueToSet,
const size_t szSizeToSet)
104 if (szSizeToSet <= szStaticSize)
106 adtf_util::cMemoryBlock::MemCopy(pAssignValue, pValueToSet, szSizeToSet);
107 m_szCurrentSize = szSizeToSet;
115 static const void*
GetPtr(
const void* pAssignValue)
119 size_t GetSize(
const void* ,
const size_t szStaticSize)
const
121 if (m_szCurrentSize != g_npos)
123 return m_szCurrentSize;
143 static const void*
GetPtr(
const std::string* pAssignValue)
145 return static_cast<const void*
>(pAssignValue->data());
147 static size_t GetSize(
const std::string* pAssignValue,
const size_t )
150 return pAssignValue->size();
168 static const void*
GetPtr(
const std::u16string* pAssignValue)
170 return static_cast<const void*
>(pAssignValue->data());
172 static size_t GetSize(
const std::u16string* pAssignValue,
const size_t )
174 return pAssignValue->size() *
sizeof(
typename std::u16string::value_type);
186 const void* pValueToSet,
187 const size_t szSizeToSet)
191 const auto pValuePtr =
static_cast<const typename std::string::value_type*
>(pValueToSet);
192 pAssignValue->reserve(szSizeToSet);
193 pAssignValue->assign(pValuePtr, szSizeToSet);
197 static const void*
GetPtr(
const std::string* pAssignValue)
199 return static_cast<const void*
>(pAssignValue->data());
201 static size_t GetSize(
const std::string* pAssignValue,
const size_t )
204 return pAssignValue->size();
216 const void* pValueToSet,
217 const size_t szSizeToSet)
221 const auto pValuePtr =
static_cast<const typename std::u16string::value_type*
>(pValueToSet);
222 pAssignValue->reserve(szSizeToSet /
sizeof(
typename std::u16string::value_type));
223 pAssignValue->assign(pValuePtr, szSizeToSet /
sizeof(
typename std::u16string::value_type));
227 static const void*
GetPtr(
const std::u16string* pAssignValue)
229 return static_cast<const void*
>(pAssignValue->data());
231 static size_t GetSize(
const std::u16string* pAssignValue,
const size_t )
234 return pAssignValue->size() *
sizeof(
typename std::u16string::value_type);
240template<
typename... Args>
246 const void* pValueToSet,
247 const size_t szSizeToSet)
249 static_assert(std::is_trivially_copyable<
typename std::vector<Args...>::value_type>::value,
250 "only trivial types are allowed for adtf_memory_forward with vector");
251 pAssignValue->resize(szSizeToSet /
sizeof(
typename std::vector<Args...>::value_type));
252 if (pAssignValue->size() *
sizeof(
typename std::vector<Args...>::value_type) == szSizeToSet)
254 adtf_util::cMemoryBlock::MemCopy(pAssignValue->data(), pValueToSet, szSizeToSet);
262 static const void*
GetPtr(
const std::vector<Args...>* pAssignValue)
264 return pAssignValue->data();
266 static size_t GetSize(
const std::vector<Args...>* pAssignValue,
const size_t )
268 return pAssignValue->size() *
sizeof(
typename std::vector<Args...>::value_type);
275template<
typename... Args>
286 static const void*
GetPtr(
const std::vector<Args...>* pAssignValue)
288 static_assert(std::is_trivially_copyable<
typename std::vector<Args...>::value_type>::value,
289 "only trivial types are allowed for adtf_memory_forward with vector");
290 return static_cast<const void*
>(pAssignValue->data());
292 static size_t GetSize(
const std::vector<Args...>* pAssignValue,
const size_t )
294 return pAssignValue->size() *
sizeof(
typename std::vector<Args...>::value_type);
308 cRawMemoryRedirect(std::function<
tResult(
const IRawMemory&)> fnForward): m_fnForward(std::move(fnForward))
322 const void*
Get()
const override
333using spider::cRawMemoryRedirect;
344#define adtf_memory_intf(__utils_memblock__) adtf::base::adtf_memory<adtf_util::cMemoryBlock>(&(__utils_memblock__))
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
Definition rawmemory_base.h:23
Template class implementation for the IRawMemory interface.
Definition rawmemory_base.h:216
const void * Get() const override
Definition rawmemory_intf.h:322
tResult Set(const void *pValue, size_t szSize) override
Definition rawmemory_intf.h:312
size_t GetSize() const override
Definition rawmemory_intf.h:317
Namespace for all functionality of the ADTF Base SDK provided since v3.0.
Definition adtf_class_version.h:16
Namespace for all functionality of the ADTF Base SDK provided since v3.18.
Definition properties_v2.h:24
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
static size_t GetSize(const adtf_util::cMemoryBlock *pAssignValue, const size_t)
Definition rawmemory_intf.h:40
static tResult Assign(adtf_util::cMemoryBlock *pAssignValue, const size_t, const void *pValueToSet, const size_t szSizeToSet)
Definition rawmemory_intf.h:27
static const void * GetPtr(const adtf_util::cMemoryBlock *pAssignValue)
Definition rawmemory_intf.h:35
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