Merge branch 'mueller_framework' into mueller_merge_mohr_serialize
This commit is contained in:
commit
18173772af
@ -1,8 +1,11 @@
|
|||||||
#include <framework/datapool/DataSetBase.h>
|
#include <framework/datapool/DataSetBase.h>
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
DataSetBase::DataSetBase() {
|
DataSetBase::DataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||||
for (uint8_t count = 0; count < DATA_SET_MAX_SIZE; count++) {
|
const size_t maxFillCount):
|
||||||
|
registeredVariables(registeredVariablesArray),
|
||||||
|
maxFillCount(maxFillCount) {
|
||||||
|
for (uint8_t count = 0; count < maxFillCount; count++) {
|
||||||
registeredVariables[count] = nullptr;
|
registeredVariables[count] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,7 +24,7 @@ ReturnValue_t DataSetBase::registerVariable(
|
|||||||
"Pool variable is nullptr." << std::endl;
|
"Pool variable is nullptr." << std::endl;
|
||||||
return DataSetIF::POOL_VAR_NULL;
|
return DataSetIF::POOL_VAR_NULL;
|
||||||
}
|
}
|
||||||
if (fillCount >= DATA_SET_MAX_SIZE) {
|
if (fillCount >= maxFillCount) {
|
||||||
sif::error << "DataSet::registerVariable: "
|
sif::error << "DataSet::registerVariable: "
|
||||||
"DataSet is full." << std::endl;
|
"DataSet is full." << std::endl;
|
||||||
return DataSetIF::DATA_SET_FULL;
|
return DataSetIF::DATA_SET_FULL;
|
||||||
|
@ -37,7 +37,8 @@ public:
|
|||||||
* supply a pointer to this dataset to PoolVariable
|
* supply a pointer to this dataset to PoolVariable
|
||||||
* initializations to register pool variables.
|
* initializations to register pool variables.
|
||||||
*/
|
*/
|
||||||
DataSetBase();
|
DataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||||
|
const size_t maxFillCount);
|
||||||
virtual~ DataSetBase();
|
virtual~ DataSetBase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,11 +112,6 @@ public:
|
|||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
SerializeIF::Endianness streamEndianness) override;
|
SerializeIF::Endianness streamEndianness) override;
|
||||||
|
|
||||||
// SHOULDDO we could use a linked list of datapool variables
|
|
||||||
//!< This definition sets the maximum number of variables to
|
|
||||||
//! register in one DataSet.
|
|
||||||
static const uint8_t DATA_SET_MAX_SIZE = 63;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief The fill_count attribute ensures that the variables
|
* @brief The fill_count attribute ensures that the variables
|
||||||
@ -138,8 +134,11 @@ protected:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This array represents all pool variables registered in this set.
|
* @brief This array represents all pool variables registered in this set.
|
||||||
|
* Child classes can use a static or dynamic container to create
|
||||||
|
* an array of registered variables and assign the first entry here.
|
||||||
*/
|
*/
|
||||||
PoolVariableIF* registeredVariables[DATA_SET_MAX_SIZE] = { };
|
PoolVariableIF** registeredVariables = nullptr;
|
||||||
|
const size_t maxFillCount = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ReturnValue_t readVariable(uint16_t count);
|
ReturnValue_t readVariable(uint16_t count);
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
#include <framework/datapoolglob/GlobalDataSet.h>
|
#include <framework/datapoolglob/GlobalDataSet.h>
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
GlobDataSet::GlobDataSet(): DataSetBase() {}
|
GlobDataSet::GlobDataSet(): DataSetBase(
|
||||||
|
reinterpret_cast<PoolVariableIF**>(®isteredVariables),
|
||||||
|
DATA_SET_MAX_SIZE) {}
|
||||||
|
|
||||||
// Don't do anything with your variables, they are dead already!
|
// Don't do anything with your variables, they are dead already!
|
||||||
// (Destructor is already called)
|
// (Destructor is already called)
|
||||||
|
@ -61,6 +61,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setEntriesValid(bool valid);
|
void setEntriesValid(bool valid);
|
||||||
|
|
||||||
|
//!< This definition sets the maximum number of variables to
|
||||||
|
//! register in one DataSet.
|
||||||
|
static const uint8_t DATA_SET_MAX_SIZE = 63;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* If the valid state of a dataset is always relevant to the whole
|
* If the valid state of a dataset is always relevant to the whole
|
||||||
@ -85,6 +89,8 @@ private:
|
|||||||
|
|
||||||
void handleAlreadyReadDatasetCommit();
|
void handleAlreadyReadDatasetCommit();
|
||||||
ReturnValue_t handleUnreadDatasetCommit();
|
ReturnValue_t handleUnreadDatasetCommit();
|
||||||
|
|
||||||
|
PoolVariableIF* registeredVariables[DATA_SET_MAX_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DATASET_H_ */
|
#endif /* DATASET_H_ */
|
||||||
|
@ -5,20 +5,30 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
LocalDataSet::LocalDataSet(OwnsLocalDataPoolIF *hkOwner): DataSetBase() {
|
LocalDataSet::LocalDataSet(OwnsLocalDataPoolIF *hkOwner,
|
||||||
|
const size_t maxNumberOfVariables):
|
||||||
|
DataSetBase(poolVarList.data(), maxNumberOfVariables) {
|
||||||
|
poolVarList.reserve(maxNumberOfVariables);
|
||||||
|
poolVarList.resize(maxNumberOfVariables);
|
||||||
if(hkOwner == nullptr) {
|
if(hkOwner == nullptr) {
|
||||||
sif::error << "LocalDataSet::LocalDataSet: Owner can't be nullptr!"
|
sif::error << "LocalDataSet::LocalDataSet: Owner can't be nullptr!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
hkManager = hkOwner->getHkManagerHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDataSet::LocalDataSet(object_id_t ownerId): DataSetBase() {
|
LocalDataSet::LocalDataSet(object_id_t ownerId,
|
||||||
|
const size_t maxNumberOfVariables):
|
||||||
|
DataSetBase(poolVarList.data(), maxNumberOfVariables) {
|
||||||
|
poolVarList.reserve(maxNumberOfVariables);
|
||||||
|
poolVarList.resize(maxNumberOfVariables);
|
||||||
OwnsLocalDataPoolIF* hkOwner = objectManager->get<OwnsLocalDataPoolIF>(
|
OwnsLocalDataPoolIF* hkOwner = objectManager->get<OwnsLocalDataPoolIF>(
|
||||||
ownerId);
|
ownerId);
|
||||||
if(hkOwner == nullptr) {
|
if(hkOwner == nullptr) {
|
||||||
sif::error << "LocalDataSet::LocalDataSet: Owner can't be nullptr!"
|
sif::error << "LocalDataSet::LocalDataSet: Owner can't be nullptr!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
hkManager = hkOwner->getHkManagerHandle();
|
hkManager = hkOwner->getHkManagerHandle();
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <framework/datapoollocal/OwnsLocalDataPoolIF.h>
|
#include <framework/datapoollocal/OwnsLocalDataPoolIF.h>
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include <framework/serialize/SerializeIF.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class LocalDataPoolManager;
|
class LocalDataPoolManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +37,8 @@ public:
|
|||||||
* The constructor simply sets the fill_count to zero and sets
|
* The constructor simply sets the fill_count to zero and sets
|
||||||
* the state to "uninitialized".
|
* the state to "uninitialized".
|
||||||
*/
|
*/
|
||||||
LocalDataSet(OwnsLocalDataPoolIF* hkOwner);
|
LocalDataSet(OwnsLocalDataPoolIF *hkOwner,
|
||||||
|
const size_t maxNumberOfVariables);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructor for users of local pool data. The passed pool
|
* @brief Constructor for users of local pool data. The passed pool
|
||||||
@ -43,7 +46,8 @@ public:
|
|||||||
* The constructor simply sets the fill_count to zero and sets
|
* The constructor simply sets the fill_count to zero and sets
|
||||||
* the state to "uninitialized".
|
* the state to "uninitialized".
|
||||||
*/
|
*/
|
||||||
LocalDataSet(object_id_t ownerId);
|
LocalDataSet(object_id_t ownerId,
|
||||||
|
const size_t maxNumberOfVariables);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The destructor automatically manages writing the valid
|
* @brief The destructor automatically manages writing the valid
|
||||||
@ -104,6 +108,8 @@ private:
|
|||||||
* (most significant bit) to 7 (least significant bit)
|
* (most significant bit) to 7 (least significant bit)
|
||||||
*/
|
*/
|
||||||
void bitSetter(uint8_t* byte, uint8_t position) const;
|
void bitSetter(uint8_t* byte, uint8_t position) const;
|
||||||
|
|
||||||
|
std::vector<PoolVariableIF*> poolVarList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_DATAPOOLLOCAL_LOCALDATASET_H_ */
|
#endif /* FRAMEWORK_DATAPOOLLOCAL_LOCALDATASET_H_ */
|
||||||
|
6
datapoollocal/StaticLocalDataSet.cpp
Normal file
6
datapoollocal/StaticLocalDataSet.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <framework/datapoollocal/StaticLocalDataSet.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
11
datapoollocal/StaticLocalDataSet.h
Normal file
11
datapoollocal/StaticLocalDataSet.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef FRAMEWORK_DATAPOOLLOCAL_STATICLOCALDATASET_H_
|
||||||
|
#define FRAMEWORK_DATAPOOLLOCAL_STATICLOCALDATASET_H_
|
||||||
|
#include <framework/datapool/DataSetBase.h>
|
||||||
|
|
||||||
|
|
||||||
|
class StaticLocalDataSet: public DataSetBase {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FRAMEWORK_DATAPOOLLOCAL_STATICLOCALDATASET_H_ */
|
@ -12,8 +12,7 @@ typedef uint16_t ReturnValue_t;
|
|||||||
class HasReturnvaluesIF {
|
class HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
static const ReturnValue_t RETURN_OK = 0;
|
static const ReturnValue_t RETURN_OK = 0;
|
||||||
//! This will be the all-ones value irrespective of used unsigned datatype.
|
static const ReturnValue_t RETURN_FAILED = 1;
|
||||||
static const ReturnValue_t RETURN_FAILED = -1;
|
|
||||||
virtual ~HasReturnvaluesIF() {}
|
virtual ~HasReturnvaluesIF() {}
|
||||||
|
|
||||||
static ReturnValue_t makeReturnCode(uint8_t interfaceId, uint8_t number) {
|
static ReturnValue_t makeReturnCode(uint8_t interfaceId, uint8_t number) {
|
||||||
@ -21,4 +20,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* HASRETURNVALUESIF_H_ */
|
#endif /* FRAMEWORK_RETURNVALUES_HASRETURNVALUESIF_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user