datapoollocal updates

This commit is contained in:
Robin Müller 2020-06-06 23:15:05 +02:00
parent ea548dea5b
commit 8216b26fde
4 changed files with 30 additions and 11 deletions

View File

@ -131,11 +131,9 @@ protected:
ReturnValue_t commitWithoutLock() override;
// std::ostream is the type for object std::cout
// friend std::ostream& operator<< (std::ostream &out,
// const LocalPoolVar &var) {
// out << static_cast<int>(value);
// return out;
// }
template <typename U>
friend std::ostream& operator<< (std::ostream &out,
const LocalPoolVar<U> &var);
private:
//! @brief Pool ID of pool entry inside the used local pool.

View File

@ -151,11 +151,11 @@ inline ReturnValue_t LocalPoolVar<T>::deSerialize(const uint8_t** buffer,
return AutoSerializeAdapter::deSerialize(&value, buffer, size, bigEndian);
}
//template<typename T>
//inline friend std::ostream& LocalPoolVar<T>::operator<< (std::ostream &out,
// const LocalPoolVar &var) {
// out << static_cast<int>(out);
//}
template<typename T>
inline std::ostream& operator<< (std::ostream &out,
const LocalPoolVar<T> &var) {
out << var.value;
return out;
}
#endif

View File

@ -5,6 +5,7 @@
#include <framework/datapool/PoolEntry.h>
#include <framework/datapool/PoolVariableIF.h>
#include <framework/serialize/SerializeAdapter.h>
#include <framework/housekeeping/HousekeepingManager.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
@ -179,6 +180,11 @@ private:
ReadWriteMode_t readWriteMode;
//! @brief Pointer to the class which manages the HK pool.
HousekeepingManager* hkManager;
// std::ostream is the type for object std::cout
template <typename U, uint16_t otherSize>
friend std::ostream& operator<< (std::ostream &out,
const LocalPoolVector<U, otherSize> &var);
};
#include <framework/datapoollocal/LocalPoolVector.tpp>

View File

@ -15,6 +15,7 @@ inline LocalPoolVector<T, vectorSize>::LocalPoolVector(lp_id_t poolId,
"NO_PARAMETER value!" << std::endl;
}
memset(this->value, 0, vectorSize * sizeof(T));
hkManager = hkOwner->getHkManagerHandle();
if (dataSet != nullptr) {
dataSet->registerVariable(this);
}
@ -182,4 +183,18 @@ inline bool LocalPoolVector<T, vectorSize>::isValid() const {
return valid;
}
template<typename T, uint16_t vectorSize>
inline std::ostream& operator<< (std::ostream &out,
const LocalPoolVector<T, vectorSize> &var) {
out << "Vector: [";
for(int i = 0;i < vectorSize; i++) {
out << var.value[i];
if(i < vectorSize - 1) {
out << ", ";
}
}
out << "]";
return out;
}
#endif