ADTF
Loading...
Searching...
No Matches
adtf::base::adtf_memory_forward< T > Struct Template Reference

bring latest ant::adtf_memory_forward to users scope More...

#include <rawmemory_base.h>

Inherited by adtf::base::ant::adtf_memory< T, TSIZE > [protected], adtf::base::penguin::adtf_memory< T, TSIZE, void > [protected], , and adtf::base::ant::adtf_memory< T, TSIZE > [protected].

Static Public Member Functions

static tResult Assign (T *pAssignValue, const size_t szStaticSize, const void *pValueToSet, const size_t szSizeToSet)
 
static const void * GetPtr (const T *pAssignValue)
 
static size_t GetSize (const T *pAssignValue, const size_t szStaticSize)
 

Detailed Description

template<typename T>
struct adtf::base::adtf_memory_forward< T >

bring latest ant::adtf_memory_forward to users scope

Concept template class for non trivial penguin::adtf_memory types of type T to specialize the usage of adtf_memory<T>.

Template Parameters
TType to specialize adtf_memory_forward for.
Remarks
If no specialization exists for your type T the usage of penguin::adtf_memory and adtf_memory_intf will fail!

Following methods needs to be implemented:

static tResult Assign(T* pAssignValue,
const size_t szStaticSize,
const void* pValueToSet,
const size_t szSizeToSet);
static const void* GetPtr(const T* pAssignValue);
static size_t GetSize(const T* pAssignValue, const size_t szStaticSize);
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
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

Example for the adtf_util::cMemoryBlock :

template <>
struct adtf_memory_forward<adtf_util::cMemoryBlock>
{
public:
static tResult Assign(adtf_util::cMemoryBlock* pAssignValue,
const size_t szStaticSize,
const void* pValueToSet,
const size_t szSizeToSet)
{
return pAssignValue->Set(pValueToSet, szSizeToSet);
}
static const void* GetPtr(const adtf_util::cMemoryBlock* pAssignValue)
{
return pAssignValue->GetPtr();
}
static size_t GetSize(const adtf_util::cMemoryBlock* pAssignValue, const size_t szStaticSize)
{
return static_cast<tSize>(pAssignValue->GetSize());
}
};
static tResult Assign(T *pAssignValue, const size_t szStaticSize, const void *pValueToSet, const size_t szSizeToSet)
Definition rawmemory_base.h:105
Definition rawmemory_base.h:91

Member Function Documentation

◆ Assign()

template<typename T>
static tResult adtf::base::ant::adtf_memory_forward< T >::Assign ( T * pAssignValue,
const size_t szStaticSize,
const void * pValueToSet,
const size_t szSizeToSet )
inlinestatic

Sets (copy) the memory value pValueToSet of size in bytes szSizeToSet to the of container class T in parameter pAssignValue. Usually this implementation creates a deep copy.

Parameters
[in]pAssignValuepointer to the container class T. Must be a valid constructed object.
[in]szStaticSizeimplementation details: max size of static pre allocated memory within AssignValue. if set no dynamic allocation possible.
[in]pValueToSetraw pointer to the memory to set
[in]szSizeToSetsize in bytes of pValueToSet
Returns
Standard Result Code

◆ GetPtr()

template<typename T>
static const void * adtf::base::ant::adtf_memory_forward< T >::GetPtr ( const T * pAssignValue)
inlinestatic

Gets the memory pointer to the of container class T in parameter pAssignValue.

Parameters
[in]pAssignValuepointer to the container class T. Must be a valid constructed object.
Returns
valid raw memory pointer to the mamory with pAssignValue.
Remarks
Make sure the pointer is still valid after function returned.

◆ GetSize()

template<typename T>
static size_t adtf::base::ant::adtf_memory_forward< T >::GetSize ( const T * pAssignValue,
const size_t szStaticSize )
inlinestatic

Gets size in bytes of the memory pointer of container class T in parameter pAssignValue.

Parameters
[in]pAssignValuepointer to the container class T. Must be a valid constructed object.
[in]szStaticSizesize of the pointers buffer if container class is a static sized type
Returns
the size in bytes.

The documentation for this struct was generated from the following file: