#pragma once template inline GlobPoolVar::GlobPoolVar(uint32_t set_id, DataSetIF* dataSet, ReadWriteMode_t setReadWriteMode): dataPoolId(set_id), valid(PoolVariableIF::INVALID), readWriteMode(setReadWriteMode) { if (dataSet != nullptr) { dataSet->registerVariable(this); } } template inline ReturnValue_t GlobPoolVar::read() { PoolEntry* read_out = ::dataPool.getData(dataPoolId, 1); if (read_out != NULL) { valid = read_out->valid; value = *(read_out->address); return HasReturnvaluesIF::RETURN_OK; } else { value = 0; valid = false; sif::error << "PoolVariable: read of DP Variable 0x" << std::hex << dataPoolId << std::dec << " failed." << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } } template inline ReturnValue_t GlobPoolVar::commit() { PoolEntry* write_back = ::dataPool.getData(dataPoolId, 1); if ((write_back != NULL) && (readWriteMode != VAR_READ)) { write_back->valid = valid; *(write_back->address) = value; return HasReturnvaluesIF::RETURN_OK; } else { return HasReturnvaluesIF::RETURN_FAILED; } } template inline GlobPoolVar::GlobPoolVar(): dataPoolId(PoolVariableIF::NO_PARAMETER), valid(PoolVariableIF::INVALID), readWriteMode(VAR_READ), value(0) {} template inline GlobPoolVar::GlobPoolVar(const GlobPoolVar& rhs) : dataPoolId(rhs.dataPoolId), valid(rhs.valid), readWriteMode( rhs.readWriteMode), value(rhs.value) {} template inline pool_rwm_t GlobPoolVar::getReadWriteMode() const { return readWriteMode; } template inline uint32_t GlobPoolVar::getDataPoolId() const { return dataPoolId; } template inline void GlobPoolVar::setDataPoolId(uint32_t poolId) { dataPoolId = poolId; } template inline bool GlobPoolVar::isValid() const { if (valid) return true; else return false; } template inline uint8_t GlobPoolVar::getValid() { return valid; } template inline void GlobPoolVar::setValid(uint8_t valid) { this->valid = valid; }