WIP: somethings wrong.. #19
@ -2,12 +2,13 @@
|
|||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
PoolEntry<T>::PoolEntry( T* initValue, uint8_t set_length, uint8_t set_valid ) : length(set_length), valid(set_valid) {
|
PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, uint8_t set_length, uint8_t set_valid ) : length(set_length), valid(set_valid) {
|
||||||
this->address = new T[this->length];
|
this->address = new T[this->length];
|
||||||
if (initValue != NULL) {
|
if(initValue.size() == 0) {
|
||||||
memcpy(this->address, initValue, this->getByteSize() );
|
memset(this->address, 0, this->getByteSize());
|
||||||
} else {
|
}
|
||||||
memset(this->address, 0, this->getByteSize() );
|
else {
|
||||||
|
memcpy(this->address, initValue.begin(), this->getByteSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <framework/datapool/PoolEntryIF.h>
|
#include <framework/datapool/PoolEntryIF.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <initializer_list>
|
||||||
/**
|
/**
|
||||||
* \brief This is a small helper class that defines a single data pool entry.
|
* \brief This is a small helper class that defines a single data pool entry.
|
||||||
*
|
*
|
||||||
@ -31,7 +32,7 @@ public:
|
|||||||
* \param set_length Defines the array length of this entry.
|
* \param set_length Defines the array length of this entry.
|
||||||
* \param set_valid Sets the initialization flag. It is invalid (0) by default.
|
* \param set_valid Sets the initialization flag. It is invalid (0) by default.
|
||||||
*/
|
*/
|
||||||
PoolEntry( T* initValue = NULL, uint8_t set_length = 1, uint8_t set_valid = 0 );
|
PoolEntry( std::initializer_list<T> initValue = {}, uint8_t set_length = 1, uint8_t set_valid = 0 );
|
||||||
/**
|
/**
|
||||||
* \brief The allocated memory for the variable is freed in the destructor.
|
* \brief The allocated memory for the variable is freed in the destructor.
|
||||||
* \details As the data pool is global, this dtor is only called on program exit.
|
* \details As the data pool is global, this dtor is only called on program exit.
|
||||||
|
Loading…
Reference in New Issue
Block a user