ADDED old pool entry constructor
This commit is contained in:
parent
6eedb3f097
commit
d9fa13b6eb
@ -12,6 +12,17 @@ PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, uint8_t set_length,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
PoolEntry<T>::PoolEntry( T* initValue, uint8_t set_length, uint8_t set_valid ) : length(set_length), valid(set_valid) {
|
||||
this->address = new T[this->length];
|
||||
if (initValue != NULL) {
|
||||
memcpy(this->address, initValue, this->getByteSize() );
|
||||
} else {
|
||||
memset(this->address, 0, this->getByteSize() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//As the data pool is global, this dtor is only be called on program exit.
|
||||
//Warning! Never copy pool entries!
|
||||
template <typename T>
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
* \param set_valid Sets the initialization flag. It is invalid (0) by default.
|
||||
*/
|
||||
PoolEntry( std::initializer_list<T> initValue = {}, uint8_t set_length = 1, uint8_t set_valid = 0 );
|
||||
PoolEntry( T* initValue = NULL, uint8_t set_length = 1, uint8_t set_valid = 0 );
|
||||
/**
|
||||
* \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.
|
||||
|
Loading…
Reference in New Issue
Block a user