ADTF
adtf_memory_forward< T >

Concept template class for non trivial penguin::adtf_memory types of type T to specialize the usage of adtf_memory<T> (see Supported types for adtf_memory<T> for writing and reading Samples). More...

Inheritance diagram for adtf_memory_forward< T >:
[legend]

Static Public Member Functions

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 parameter pAssignValue. More...
 
static const void * GetPtr (const T *pAssignValue)
 Gets the memory pointer to the of container class T in parameter pAssignValue. More...
 
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. More...
 

Detailed Description

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

Concept template class for non trivial penguin::adtf_memory types of type T to specialize the usage of adtf_memory<T> (see Supported types for adtf_memory<T> for writing and reading Samples).

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);
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.

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());
}
};
size_t tSize
type definition for a array size values, map size values etc.
ADTF adtf_util Namespace - Within adtf this is used as adtf::util or adtf_util and also defined as A_...

Definition at line 88 of file rawmemory_base.h.

Member Function Documentation

◆ Assign()

static tResult 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

Definition at line 101 of file rawmemory_base.h.

Referenced by adtf_memory< T, TSIZE >::Set(), and adtf_memory< T, TSIZE, Enable >::Set().

◆ GetPtr()

static const void* 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.

Definition at line 119 of file rawmemory_base.h.

Referenced by adtf_memory< T, TSIZE >::Get(), and adtf_memory< T, TSIZE, Enable >::Get().

◆ GetSize()

static size_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.

Definition at line 134 of file rawmemory_base.h.

Referenced by adtf_memory< T, TSIZE >::GetSize(), and adtf_memory< T, TSIZE, Enable >::GetSize().