removed old poolVar file
This commit is contained in:
parent
9da0b0b2b2
commit
71f1722b88
@ -1,294 +0,0 @@
|
|||||||
/*
|
|
||||||
* \file PoolVariable.h
|
|
||||||
*
|
|
||||||
* \brief This file contains the PoolVariable class, which locally represents a non-array data pool variable.
|
|
||||||
*
|
|
||||||
* \date 10/17/2012
|
|
||||||
*
|
|
||||||
* \author Bastian Baetz
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef POOLVARIABLE_H_
|
|
||||||
#define POOLVARIABLE_H_
|
|
||||||
|
|
||||||
#include <framework/datapool/DataSetIF.h>
|
|
||||||
#include <framework/datapool/PoolEntry.h>
|
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
|
||||||
|
|
||||||
template<typename T, uint8_t n_var> class PoolVarList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief This is the access class for non-array data pool entries.
|
|
||||||
*
|
|
||||||
* \details To ensure safe usage of the data pool, operation is not done directly on the data pool
|
|
||||||
* entries, but on local copies. This class provides simple type-safe access to single
|
|
||||||
* data pool entries (i.e. entries with length = 1).
|
|
||||||
* The class can be instantiated as read-write and read only.
|
|
||||||
* It provides a commit-and-roll-back semantic, which means that the variable's value in
|
|
||||||
* the data pool is not changed until the commit call is executed.
|
|
||||||
* \tparam T The template parameter sets the type of the variable. Currently, all plain data types
|
|
||||||
* are supported, but in principle any type is possible.
|
|
||||||
* \ingroup data_pool
|
|
||||||
*/
|
|
||||||
template<typename T>
|
|
||||||
class PoolVariable: public PoolVariableIF {
|
|
||||||
template<typename U, uint8_t n_var> friend class PoolVarList;
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* \brief To access the correct data pool entry on read and commit calls, the data pool id
|
|
||||||
* is stored.
|
|
||||||
*/
|
|
||||||
uint32_t dataPoolId;
|
|
||||||
/**
|
|
||||||
* \brief The valid information as it was stored in the data pool is copied to this attribute.
|
|
||||||
*/
|
|
||||||
uint8_t valid;
|
|
||||||
/**
|
|
||||||
* \brief The information whether the class is read-write or read-only is stored here.
|
|
||||||
*/
|
|
||||||
ReadWriteMode_t readWriteMode;
|
|
||||||
/**
|
|
||||||
* \brief This is a call to read the value from the global data pool.
|
|
||||||
* \details When executed, this operation tries to fetch the pool entry with matching
|
|
||||||
* data pool id from the global data pool and copies the value and the valid
|
|
||||||
* information to its local attributes. In case of a failure (wrong type or
|
|
||||||
* pool id not found), the variable is set to zero and invalid.
|
|
||||||
* The operation does NOT provide any mutual exclusive protection by itself.
|
|
||||||
*/
|
|
||||||
ReturnValue_t read() {
|
|
||||||
PoolEntry<T>* read_out = ::dataPool.getData<T>(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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* \brief The commit call writes back the variable's value to the data pool.
|
|
||||||
* \details It checks type and size, as well as if the variable is writable. If so,
|
|
||||||
* the value is copied and the valid flag is automatically set to "valid".
|
|
||||||
* The operation does NOT provide any mutual exclusive protection by itself.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
ReturnValue_t commit() {
|
|
||||||
PoolEntry<T>* write_back = ::dataPool.getData<T>(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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Empty ctor for List initialization
|
|
||||||
*/
|
|
||||||
PoolVariable() :
|
|
||||||
dataPoolId(PoolVariableIF::NO_PARAMETER), valid(
|
|
||||||
PoolVariableIF::INVALID), readWriteMode(VAR_READ), value(0) {
|
|
||||||
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* \brief This is the local copy of the data pool entry.
|
|
||||||
* \details The user can work on this attribute
|
|
||||||
* just like he would on a simple local variable.
|
|
||||||
*/
|
|
||||||
T value;
|
|
||||||
/**
|
|
||||||
* \brief In the constructor, the variable can register itself in a DataSet (if not NULL is
|
|
||||||
* passed).
|
|
||||||
* \details It DOES NOT fetch the current value from the data pool, but sets the value
|
|
||||||
* attribute to default (0). The value is fetched within the read() operation.
|
|
||||||
* \param set_id This is the id in the global data pool this instance of the access class
|
|
||||||
* corresponds to.
|
|
||||||
* \param dataSet The data set in which the variable shall register itself. If NULL,
|
|
||||||
* the variable is not registered.
|
|
||||||
* \param setReadWriteMode
|
|
||||||
*/
|
|
||||||
PoolVariable(uint32_t set_id, DataSetIF* dataSet,
|
|
||||||
ReadWriteMode_t setReadWriteMode) :
|
|
||||||
dataPoolId(set_id), valid(PoolVariableIF::INVALID), readWriteMode(
|
|
||||||
setReadWriteMode), value(0) {
|
|
||||||
if (dataSet != NULL) {
|
|
||||||
dataSet->registerVariable(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Copy ctor to copy classes containing Pool Variables.
|
|
||||||
*/
|
|
||||||
PoolVariable(const PoolVariable& rhs) :
|
|
||||||
dataPoolId(rhs.dataPoolId), valid(rhs.valid), readWriteMode(
|
|
||||||
rhs.readWriteMode), value(rhs.value) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief The classes destructor is empty.
|
|
||||||
* \details If commit() was not called, the local value is
|
|
||||||
* discarded and not written back to the data pool.
|
|
||||||
*/
|
|
||||||
~PoolVariable() {
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* \brief This operation returns the data pool id of the variable.
|
|
||||||
*/
|
|
||||||
uint32_t getDataPoolId() const {
|
|
||||||
return dataPoolId;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This operation sets the data pool id of the variable.
|
|
||||||
* The method is necessary to set id's of data pool member variables with bad initialization.
|
|
||||||
*/
|
|
||||||
void setDataPoolId(uint32_t poolId) {
|
|
||||||
dataPoolId = poolId;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This method returns if the variable is write-only, read-write or read-only.
|
|
||||||
*/
|
|
||||||
ReadWriteMode_t getReadWriteMode() const {
|
|
||||||
return readWriteMode;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* \brief With this call, the valid information of the variable is returned.
|
|
||||||
*/
|
|
||||||
bool isValid() const {
|
|
||||||
if (valid)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t getValid() {
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setValid(uint8_t valid) {
|
|
||||||
this->valid = valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator T() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator T() const {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
PoolVariable<T> &operator=(T newValue) {
|
|
||||||
value = newValue;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
PoolVariable<T> &operator=(PoolVariable<T> newPoolVariable) {
|
|
||||||
value = newPoolVariable.value;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
|
||||||
const size_t max_size, bool bigEndian) const {
|
|
||||||
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
|
|
||||||
bigEndian);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual size_t getSerializedSize() const {
|
|
||||||
return SerializeAdapter<T>::getSerializedSize(&value);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
|
||||||
bool bigEndian) {
|
|
||||||
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef PoolVariable<uint8_t> db_uint8_t;
|
|
||||||
typedef PoolVariable<uint16_t> db_uint16_t;
|
|
||||||
typedef PoolVariable<uint32_t> db_uint32_t;
|
|
||||||
typedef PoolVariable<int8_t> db_int8_t;
|
|
||||||
typedef PoolVariable<int16_t> db_int16_t;
|
|
||||||
typedef PoolVariable<int32_t> db_int32_t;
|
|
||||||
typedef PoolVariable<uint8_t> db_bool_t;
|
|
||||||
typedef PoolVariable<float> db_float_t;
|
|
||||||
typedef PoolVariable<double> db_double_t;
|
|
||||||
//Alternative (but I thing this is not as useful: code duplication, differences too small):
|
|
||||||
|
|
||||||
//template <typename T>
|
|
||||||
//class PoolReader : public PoolVariableIF {
|
|
||||||
//private:
|
|
||||||
// uint32_t parameter_id;
|
|
||||||
// uint8_t valid;
|
|
||||||
//public:
|
|
||||||
// T value;
|
|
||||||
// PoolReader( uint32_t set_id, DataSetIF* set ) : parameter_id(set_id), valid(false), value(0) {
|
|
||||||
// set->registerVariable( this );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// ~PoolReader() {};
|
|
||||||
//
|
|
||||||
// uint8_t commit() {
|
|
||||||
// return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// uint8_t read() {
|
|
||||||
// PoolEntry<T>* read_out = ::dataPool.getData<T>( parameter_id, 1 );
|
|
||||||
// if ( read_out != NULL ) {
|
|
||||||
// valid = read_out->valid;
|
|
||||||
// value = *(read_out->address);
|
|
||||||
// return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
// } else {
|
|
||||||
// value = 0;
|
|
||||||
// valid = false;
|
|
||||||
// return CHECKOUT_FAILED;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// uint32_t getParameterId() { return parameter_id; }
|
|
||||||
// bool isWritable() { return false; };
|
|
||||||
// bool isValid() { if (valid) return true; else return false; }
|
|
||||||
//};
|
|
||||||
//
|
|
||||||
//template <typename T>
|
|
||||||
//class PoolWriter : public PoolVariableIF {
|
|
||||||
//private:
|
|
||||||
// uint32_t parameter_id;
|
|
||||||
//public:
|
|
||||||
// T value;
|
|
||||||
// PoolWriter( uint32_t set_id, DataSetIF* set ) : parameter_id(set_id), value(0) {
|
|
||||||
// set->registerVariable( this );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// ~PoolWriter() {};
|
|
||||||
//
|
|
||||||
// uint8_t commit() {
|
|
||||||
// PoolEntry<T>* write_back = ::dataPool.getData<T>( parameter_id, 1 );
|
|
||||||
// if ( write_back != NULL ) {
|
|
||||||
// write_back->valid = true;
|
|
||||||
// *(write_back->address) = value;
|
|
||||||
// return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
// } else {
|
|
||||||
// return CHECKOUT_FAILED;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// uint8_t read() {
|
|
||||||
// PoolEntry<T>* read_out = ::dataPool.getData<T>( parameter_id, 1 );
|
|
||||||
// if ( read_out != NULL ) {
|
|
||||||
// value = *(read_out->address);
|
|
||||||
// return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
// } else {
|
|
||||||
// value = 0;
|
|
||||||
// return CHECKOUT_FAILED;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// uint32_t getParameterId() { return parameter_id; }
|
|
||||||
// bool isWritable() { return true; };
|
|
||||||
// bool isValid() { return false; }
|
|
||||||
//};
|
|
||||||
|
|
||||||
#endif /* POOLVARIABLE_H_ */
|
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef POOLVARIABLE_H_
|
#ifndef GLOBALPOOLVARIABLE_H_
|
||||||
#define POOLVARIABLE_H_
|
#define GLOBALPOOLVARIABLE_H_
|
||||||
|
|
||||||
#include <framework/datapool/DataSetIF.h>
|
#include <framework/datapool/DataSetIF.h>
|
||||||
#include <framework/datapool/PoolVariableIF.h>
|
#include <framework/datapool/PoolVariableIF.h>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#ifndef GLOBALPOOLVARIABLE_TPP_
|
||||||
|
#define GLOBALPOOLVARIABLE_TPP_
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline GlobPoolVar<T>::GlobPoolVar(uint32_t set_id,
|
inline GlobPoolVar<T>::GlobPoolVar(uint32_t set_id,
|
||||||
@ -82,3 +83,5 @@ template <class T>
|
|||||||
inline void GlobPoolVar<T>::setValid(uint8_t valid) {
|
inline void GlobPoolVar<T>::setValid(uint8_t valid) {
|
||||||
this->valid = valid;
|
this->valid = valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -111,7 +111,6 @@ public:
|
|||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const override;
|
const size_t max_size, bool bigEndian) const override;
|
||||||
virtual size_t getSerializedSize() const override;
|
virtual size_t getSerializedSize() const override;
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) override;
|
bool bigEndian) override;
|
||||||
protected:
|
protected:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <framework/devicehandlers/AcceptsDeviceResponsesIF.h>
|
#include <framework/devicehandlers/AcceptsDeviceResponsesIF.h>
|
||||||
|
|
||||||
#include <framework/datapoolglob/GlobalDataSet.h>
|
#include <framework/datapoolglob/GlobalDataSet.h>
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include <framework/datapoolglob/GlobalPoolVariable.h>
|
||||||
#include <framework/devicehandlers/DeviceTmReportingWrapper.h>
|
#include <framework/devicehandlers/DeviceTmReportingWrapper.h>
|
||||||
#include <framework/globalfunctions/CRC.h>
|
#include <framework/globalfunctions/CRC.h>
|
||||||
#include <framework/subsystem/SubsystemBase.h>
|
#include <framework/subsystem/SubsystemBase.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "InternalErrorReporter.h"
|
#include "InternalErrorReporter.h"
|
||||||
|
|
||||||
#include <framework/datapoolglob/GlobalDataSet.h>
|
#include <framework/datapoolglob/GlobalDataSet.h>
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include <framework/datapoolglob/GlobalPoolVariable.h>
|
||||||
#include <framework/ipc/MutexFactory.h>
|
#include <framework/ipc/MutexFactory.h>
|
||||||
|
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <framework/datapoolglob/GlobalDataSet.h>
|
#include <framework/datapoolglob/GlobalDataSet.h>
|
||||||
#include <framework/datapool/PIDReader.h>
|
#include <framework/datapool/PIDReader.h>
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include <framework/datapoolglob/GlobalPoolVariable.h>
|
||||||
#include <framework/devicehandlers/HealthDevice.h>
|
#include <framework/devicehandlers/HealthDevice.h>
|
||||||
#include <framework/monitoring/LimitMonitor.h>
|
#include <framework/monitoring/LimitMonitor.h>
|
||||||
#include <framework/parameters/ParameterHelper.h>
|
#include <framework/parameters/ParameterHelper.h>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define MISSION_CONTROLLERS_TCS_CORECOMPONENT_H_
|
#define MISSION_CONTROLLERS_TCS_CORECOMPONENT_H_
|
||||||
|
|
||||||
#include <framework/datapoolglob/GlobalDataSet.h>
|
#include <framework/datapoolglob/GlobalDataSet.h>
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include <framework/datapoolglob/GlobalPoolVariable.h>
|
||||||
#include <framework/thermal/ThermalComponentIF.h>
|
#include <framework/thermal/ThermalComponentIF.h>
|
||||||
#include <framework/thermal/AbstractTemperatureSensor.h>
|
#include <framework/thermal/AbstractTemperatureSensor.h>
|
||||||
#include <framework/thermal/ThermalModule.h>
|
#include <framework/thermal/ThermalModule.h>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define THERMALMODULE_H_
|
#define THERMALMODULE_H_
|
||||||
|
|
||||||
#include <framework/datapoolglob/GlobalDataSet.h>
|
#include <framework/datapoolglob/GlobalDataSet.h>
|
||||||
#include <framework/datapool/PoolVariable.h>
|
#include <framework/datapoolglob/GlobalPoolVariable.h>
|
||||||
#include <framework/devicehandlers/HealthDevice.h>
|
#include <framework/devicehandlers/HealthDevice.h>
|
||||||
#include <framework/events/EventReportingProxyIF.h>
|
#include <framework/events/EventReportingProxyIF.h>
|
||||||
#include "ThermalModuleIF.h"
|
#include "ThermalModuleIF.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user