Merge branch 'mueller_framework' into front_branch
This commit is contained in:
commit
2a632ae711
@ -1,30 +1,37 @@
|
|||||||
#include <framework/datapool/PoolEntry.h>
|
#include <framework/datapool/PoolEntry.h>
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
#include <framework/globalfunctions/printer.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, uint8_t set_length,
|
PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, uint8_t setLength,
|
||||||
uint8_t set_valid ) : length(set_length), valid(set_valid) {
|
bool setValid ) : length(setLength), valid(setValid) {
|
||||||
this->address = new T[this->length];
|
this->address = new T[this->length];
|
||||||
if(initValue.size() == 0) {
|
if(initValue.size() == 0) {
|
||||||
memset(this->address, 0, this->getByteSize());
|
std::memset(this->address, 0, this->getByteSize());
|
||||||
|
}
|
||||||
|
else if (initValue.size() != setLength){
|
||||||
|
sif::warning << "PoolEntry: setLength is not equal to initializer list"
|
||||||
|
"length! Performing zero initialization with given setLength"
|
||||||
|
<< std::endl;
|
||||||
|
std::memset(this->address, 0, this->getByteSize());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memcpy(this->address, initValue.begin(), this->getByteSize());
|
std::copy(initValue.begin(), initValue.end(), this->address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
PoolEntry<T>::PoolEntry( T* initValue, uint8_t set_length, uint8_t set_valid ) :
|
PoolEntry<T>::PoolEntry( T* initValue, uint8_t setLength, bool setValid ) :
|
||||||
length(set_length), valid(set_valid) {
|
length(setLength), valid(setValid) {
|
||||||
this->address = new T[this->length];
|
this->address = new T[this->length];
|
||||||
if (initValue != NULL) {
|
if (initValue != nullptr) {
|
||||||
memcpy(this->address, initValue, this->getByteSize() );
|
std::memcpy(this->address, initValue, this->getByteSize() );
|
||||||
} else {
|
} else {
|
||||||
memset(this->address, 0, this->getByteSize() );
|
std::memset(this->address, 0, this->getByteSize() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//As the data pool is global, this dtor is only be called on program exit.
|
//As the data pool is global, this dtor is only be called on program exit.
|
||||||
//Warning! Never copy pool entries!
|
//Warning! Never copy pool entries!
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -48,21 +55,20 @@ void* PoolEntry<T>::getRawData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void PoolEntry<T>::setValid( uint8_t isValid ) {
|
void PoolEntry<T>::setValid(bool isValid) {
|
||||||
this->valid = isValid;
|
this->valid = isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
uint8_t PoolEntry<T>::getValid() {
|
bool PoolEntry<T>::getValid() {
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void PoolEntry<T>::print() {
|
void PoolEntry<T>::print() {
|
||||||
for (uint8_t size = 0; size < this->length; size++ ) {
|
sif::debug << "Pool Entry Validity: " <<
|
||||||
sif::debug << "| " << std::hex << (double)this->address[size]
|
(this->valid? " (valid) " : " (invalid) ") << std::endl;
|
||||||
<< (this->valid? " (valid) " : " (invalid) ");
|
printer::print(reinterpret_cast<uint8_t*>(address), length);
|
||||||
}
|
|
||||||
sif::debug << std::dec << std::endl;
|
sif::debug << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,95 +1,126 @@
|
|||||||
#ifndef POOLENTRY_H_
|
#ifndef FRAMEWORK_DATAPOOL_POOLENTRY_H_
|
||||||
#define POOLENTRY_H_
|
#define FRAMEWORK_DATAPOOL_POOLENTRY_H_
|
||||||
|
|
||||||
|
|
||||||
#include <framework/datapool/PoolEntryIF.h>
|
#include <framework/datapool/PoolEntryIF.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <cstring>
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a small helper class that defines a single data pool entry.
|
* @brief This is a small helper class that defines a single data pool entry.
|
||||||
* @details
|
* @details
|
||||||
* The helper is used to store all information together with the data as a
|
* The helper is used to store all information together with the data as a
|
||||||
* single data pool entry.The content's type is defined by the template argument.
|
* single data pool entry. The content's type is defined by the template
|
||||||
* It is prepared for use with plain old data types, but may be extended to
|
* argument.
|
||||||
* complex types if necessary. It can be initialized with a certain value,
|
|
||||||
* size and validity flag. It holds a pointer to the real data and offers
|
|
||||||
* methods to access this data and to acquire additional information
|
|
||||||
* (such as validity and array/byte size). It is NOT intended to be used
|
|
||||||
* outside the DataPool class.
|
|
||||||
* @author Bastian Baetz
|
|
||||||
* @ingroup data_pool
|
|
||||||
*
|
*
|
||||||
|
* It is prepared for use with plain old data types, but may be
|
||||||
|
* extended to complex types if necessary. It can be initialized with a
|
||||||
|
* certain value, size and validity flag.
|
||||||
|
*
|
||||||
|
* It holds a pointer to the real data and offers methods to access this data
|
||||||
|
* and to acquire additional information (such as validity and array/byte size).
|
||||||
|
* It is NOT intended to be used outside DataPool implementations as it performs
|
||||||
|
* dynamic memory allocation.
|
||||||
|
*
|
||||||
|
* @ingroup data_pool
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class PoolEntry : public PoolEntryIF {
|
class PoolEntry : public PoolEntryIF {
|
||||||
public:
|
public:
|
||||||
static_assert(not std::is_same<T, bool>::value,
|
static_assert(not std::is_same<T, bool>::value,
|
||||||
"Do not use boolean for the PoolEntry type, use uint8_t instead!"
|
"Do not use boolean for the PoolEntry type, use uint8_t "
|
||||||
"Warum? Darum :-)");
|
"instead! The ECSS standard defines a boolean as a one bit "
|
||||||
|
"field. Therefore it is preferred to store a boolean as an "
|
||||||
|
"uint8_t");
|
||||||
/**
|
/**
|
||||||
* @brief In the classe's constructor, space is allocated on the heap and
|
* @brief In the classe's constructor, space is allocated on the heap and
|
||||||
* potential init values are copied to that space.
|
* potential init values are copied to that space.
|
||||||
* @param initValue Initializer list with values to initialize with
|
* @details
|
||||||
* @param set_length Defines the array length of this entry.
|
* Not passing any arguments will initialize an non-array pool entry
|
||||||
* @param set_valid Sets the initialization flag. It is invalid (0) by default.
|
* (setLength = 1) with an initial invalid state.
|
||||||
|
* Please note that if an initializer list is passed, the correct
|
||||||
|
* corresponding length should be passed too, otherwise a zero
|
||||||
|
* initialization will be performed with the given setLength.
|
||||||
|
* @param initValue
|
||||||
|
* Initializer list with values to initialize with, for example {0,0} to
|
||||||
|
* initialize the two entries to zero.
|
||||||
|
* @param setLength
|
||||||
|
* Defines the array length of this entry. Should be equal to the
|
||||||
|
* intializer list length.
|
||||||
|
* @param setValid
|
||||||
|
* Sets the initialization flag. It is invalid by default.
|
||||||
*/
|
*/
|
||||||
PoolEntry( std::initializer_list<T> initValue = {}, uint8_t set_length = 1, uint8_t set_valid = 0 );
|
PoolEntry(std::initializer_list<T> initValue = {}, uint8_t setLength = 1,
|
||||||
|
bool setValid = false);
|
||||||
/**
|
/**
|
||||||
* @brief In the classe's constructor, space is allocated on the heap and
|
* @brief In the classe's constructor, space is allocated on the heap and
|
||||||
* potential init values are copied to that space.
|
* potential init values are copied to that space.
|
||||||
* @param initValue A pointer to the single value or array that holds the init value.
|
* @param initValue
|
||||||
* With the default value (NULL), the entry is initalized with all 0.
|
* A pointer to the single value or array that holds the init value.
|
||||||
* @param set_length Defines the array length of this entry.
|
* With the default value (nullptr), the entry is initalized with all 0.
|
||||||
* @param set_valid Sets the initialization flag. It is invalid (0) by default.
|
* @param setLength
|
||||||
|
* Defines the array length of this entry.
|
||||||
|
* @param setValid
|
||||||
|
* Sets the initialization flag. It is invalid by default.
|
||||||
*/
|
*/
|
||||||
PoolEntry( T* initValue = NULL, uint8_t set_length = 1, uint8_t set_valid = 0 );
|
PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false);
|
||||||
|
|
||||||
|
//! Explicitely deleted copy ctor, copying is not allowed!
|
||||||
|
PoolEntry(const PoolEntry&) = delete;
|
||||||
|
//! Explicitely deleted copy assignment, copying is not allowed!
|
||||||
|
PoolEntry& operator=(const PoolEntry&) = delete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The allocated memory for the variable is freed in the destructor.
|
* @brief The allocated memory for the variable is freed
|
||||||
* \details As the data pool is global, this dtor is only called on program exit.
|
* in the destructor.
|
||||||
* PoolEntries shall never be copied, as a copy might delete the variable on the heap.
|
* @details
|
||||||
|
* As the data pool is global, this dtor is only called on program exit.
|
||||||
|
* PoolEntries shall never be copied, as a copy might delete the variable
|
||||||
|
* on the heap.
|
||||||
*/
|
*/
|
||||||
~PoolEntry();
|
~PoolEntry();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This is the address pointing to the allocated memory.
|
* @brief This is the address pointing to the allocated memory.
|
||||||
*/
|
*/
|
||||||
T* address;
|
T* address;
|
||||||
/**
|
/**
|
||||||
* \brief This attribute stores the length information.
|
* @brief This attribute stores the length information.
|
||||||
*/
|
*/
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
/**
|
/**
|
||||||
* \brief Here, the validity information for a variable is stored.
|
* @brief Here, the validity information for a variable is stored.
|
||||||
* Every entry (single variable or vector) has one valid flag.
|
* Every entry (single variable or vector) has one valid flag.
|
||||||
*/
|
*/
|
||||||
uint8_t valid;
|
uint8_t valid;
|
||||||
/**
|
/**
|
||||||
* \brief getSize returns the array size of the entry.
|
* @brief getSize returns the array size of the entry.
|
||||||
* \details A single parameter has size 1.
|
* @details A single parameter has size 1.
|
||||||
*/
|
*/
|
||||||
uint8_t getSize();
|
uint8_t getSize();
|
||||||
/**
|
/**
|
||||||
* \brief This operation returns the size in bytes.
|
* @brief This operation returns the size in bytes.
|
||||||
* \details The size is calculated by sizeof(type) * array_size.
|
* @details The size is calculated by sizeof(type) * array_size.
|
||||||
*/
|
*/
|
||||||
uint16_t getByteSize();
|
uint16_t getByteSize();
|
||||||
/**
|
/**
|
||||||
* \brief This operation returns a the address pointer casted to void*.
|
* @brief This operation returns a the address pointer casted to void*.
|
||||||
*/
|
*/
|
||||||
void* getRawData();
|
void* getRawData();
|
||||||
/**
|
/**
|
||||||
* \brief This method allows to set the valid information of the pool entry.
|
* @brief This method allows to set the valid information
|
||||||
|
* of the pool entry.
|
||||||
*/
|
*/
|
||||||
void setValid( uint8_t isValid );
|
void setValid( bool isValid );
|
||||||
/**
|
/**
|
||||||
* \brief This method allows to get the valid information of the pool entry.
|
* @brief This method allows to get the valid information
|
||||||
|
* of the pool entry.
|
||||||
*/
|
*/
|
||||||
uint8_t getValid();
|
bool getValid();
|
||||||
/**
|
/**
|
||||||
* \brief This is a debug method that prints all values and the valid information to the screen.
|
* @brief This is a debug method that prints all values and the valid
|
||||||
* It prints all array entries in a row.
|
* information to the screen. It prints all array entries in a row.
|
||||||
*/
|
*/
|
||||||
void print();
|
void print();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef POOLENTRYIF_H_
|
#ifndef FRAMEWORK_DATAPOOL_POOLENTRYIF_H_
|
||||||
#define POOLENTRYIF_H_
|
#define FRAMEWORK_DATAPOOL_POOLENTRYIF_H_
|
||||||
|
|
||||||
#include <framework/globalfunctions/Type.h>
|
#include <framework/globalfunctions/Type.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -9,55 +9,53 @@
|
|||||||
* single data pool entry.
|
* single data pool entry.
|
||||||
* @details
|
* @details
|
||||||
* The interface provides methods to determine the size and the validity
|
* The interface provides methods to determine the size and the validity
|
||||||
* information of a value. It also defines a method to receive a pointer to
|
* information of a value. It also defines a method to receive a pointer to the
|
||||||
* the raw data content. It is mainly used by DataPool itself, but also as a
|
* raw data content. It is mainly used by DataPool itself, but also as a
|
||||||
* return pointer.
|
* return pointer.
|
||||||
|
*
|
||||||
* @author Bastian Baetz
|
* @author Bastian Baetz
|
||||||
* @ingroup data_pool
|
* @ingroup data_pool
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class PoolEntryIF {
|
class PoolEntryIF {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief This is an empty virtual destructor,
|
* @brief This is an empty virtual destructor,
|
||||||
* as it is proposed for C++ interfaces.
|
* as it is required for C++ interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~PoolEntryIF() {}
|
virtual ~PoolEntryIF() {
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @brief getSize returns the array size of the entry.
|
* @brief getSize returns the array size of the entry.
|
||||||
* A single variable parameter has size 1.
|
* A single variable parameter has size 1.
|
||||||
*/
|
*/
|
||||||
virtual uint8_t getSize() = 0;
|
virtual uint8_t getSize() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This operation returns the size in bytes, which is calculated by
|
* @brief This operation returns the size in bytes, which is calculated by
|
||||||
* sizeof(type) * array_size.
|
* sizeof(type) * array_size.
|
||||||
*/
|
*/
|
||||||
virtual uint16_t getByteSize() = 0;
|
virtual uint16_t getByteSize() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This operation returns a the address pointer casted to void*.
|
* @brief This operation returns a the address pointer casted to void*.
|
||||||
*/
|
*/
|
||||||
virtual void* getRawData() = 0;
|
virtual void* getRawData() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This method allows to set the valid information of the pool entry.
|
* @brief This method allows to set the valid information of the pool entry.
|
||||||
*/
|
*/
|
||||||
virtual void setValid(uint8_t isValid) = 0;
|
virtual void setValid(bool isValid) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This method allows to set the valid information of the pool entry.
|
* @brief This method allows to set the valid information of the pool entry.
|
||||||
*/
|
*/
|
||||||
virtual uint8_t getValid() = 0;
|
virtual bool getValid() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a debug method that prints all values and the valid
|
* @brief This is a debug method that prints all values and the valid
|
||||||
* information to the screen. It prints all array entries in a row.
|
* information to the screen. It prints all array entries in a row.
|
||||||
|
* @details
|
||||||
|
* Also displays whether the pool entry is valid or invalid.
|
||||||
*/
|
*/
|
||||||
virtual void print() = 0;
|
virtual void print() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the type of the entry.
|
* Returns the type of the entry.
|
||||||
*/
|
*/
|
||||||
virtual Type getType() = 0;
|
virtual Type getType() = 0;
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <framework/osal/Endiness.h>
|
#include <framework/osal/Endiness.h>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
PoolRawAccess::PoolRawAccess(uint32_t set_id, uint8_t setArrayEntry,
|
PoolRawAccess::PoolRawAccess(uint32_t set_id, uint8_t setArrayEntry,
|
||||||
DataSetIF* dataSet, ReadWriteMode_t setReadWriteMode) :
|
DataSetIF* dataSet, ReadWriteMode_t setReadWriteMode) :
|
||||||
dataPoolId(set_id), arrayEntry(setArrayEntry), valid(false),
|
dataPoolId(set_id), arrayEntry(setArrayEntry), valid(false),
|
||||||
|
@ -2,29 +2,29 @@
|
|||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
ObjectManager::ObjectManager( void (*setProducer)() ) : produceObjects(setProducer) {
|
ObjectManager::ObjectManager( void (*setProducer)() ):
|
||||||
|
produceObjects(setProducer) {
|
||||||
//There's nothing special to do in the constructor.
|
//There's nothing special to do in the constructor.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ObjectManager::~ObjectManager() {
|
ObjectManager::~ObjectManager() {
|
||||||
std::map<object_id_t, SystemObjectIF*>::iterator it;
|
for (auto const& iter : objectList) {
|
||||||
for (it = this->objectList.begin(); it != this->objectList.end(); it++) {
|
delete iter.second;
|
||||||
delete it->second;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ObjectManager::insert( object_id_t id, SystemObjectIF* object) {
|
ReturnValue_t ObjectManager::insert( object_id_t id, SystemObjectIF* object) {
|
||||||
bool insert_return = this->objectList.insert( std::pair< object_id_t, SystemObjectIF* >( id, object ) ).second;
|
auto returnPair = objectList.emplace(id, object);
|
||||||
if (insert_return == true) {
|
if (returnPair.second) {
|
||||||
// sif::debug << "ObjectManager::insert: Object " << std::hex
|
// sif::debug << "ObjectManager::insert: Object " << std::hex
|
||||||
// << (int)id << std::dec << " inserted." << std::endl;
|
// << (int)id << std::dec << " inserted." << std::endl;
|
||||||
return this->RETURN_OK;
|
return this->RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
sif::error << "ObjectManager::insert: Object id " << std::hex
|
sif::error << "ObjectManager::insert: Object id " << std::hex
|
||||||
<< (int)id << std::dec << " is already in use!" << std::endl;
|
<< (int)id << std::dec << " is already in use!" << std::endl;
|
||||||
exit(0); //This is very severe and difficult to handle in other places.
|
//This is very severe and difficult to handle in other places.
|
||||||
return this->INSERTION_FAILED;
|
std::exit(INSERTION_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,29 +44,31 @@ ReturnValue_t ObjectManager::remove( object_id_t id ) {
|
|||||||
|
|
||||||
|
|
||||||
SystemObjectIF* ObjectManager::getSystemObject( object_id_t id ) {
|
SystemObjectIF* ObjectManager::getSystemObject( object_id_t id ) {
|
||||||
std::map<object_id_t, SystemObjectIF*>::iterator it = this->objectList.find( id );
|
auto listIter = this->objectList.find( id );
|
||||||
if (it == this->objectList.end() ) {
|
if (listIter == this->objectList.end() ) {
|
||||||
//Changed for testing different method.
|
return nullptr;
|
||||||
// SystemObjectIF* object = this->produceObjects( id );
|
|
||||||
// return object;
|
|
||||||
return NULL;
|
|
||||||
} else {
|
} else {
|
||||||
return it->second;
|
return listIter->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectManager::ObjectManager( ) : produceObjects(NULL) {
|
ObjectManager::ObjectManager() : produceObjects(nullptr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectManager::initialize() {
|
void ObjectManager::initialize() {
|
||||||
|
if(produceObjects == nullptr) {
|
||||||
|
sif::error << "ObjectManager: Passed produceObjects functions is"
|
||||||
|
"nullptr!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->produceObjects();
|
this->produceObjects();
|
||||||
ReturnValue_t return_value = RETURN_FAILED;
|
ReturnValue_t return_value = RETURN_FAILED;
|
||||||
uint32_t error_count = 0;
|
uint32_t error_count = 0;
|
||||||
for (std::map<object_id_t, SystemObjectIF*>::iterator it = this->objectList.begin(); it != objectList.end(); it++ ) {
|
for (auto const& it : objectList) {
|
||||||
return_value = it->second->initialize();
|
return_value = it.second->initialize();
|
||||||
if ( return_value != RETURN_OK ) {
|
if ( return_value != RETURN_OK ) {
|
||||||
object_id_t var = it->first;
|
object_id_t var = it.first;
|
||||||
sif::error << "Object 0x" << std::hex << std::setw(8) <<
|
sif::error << "Object 0x" << std::hex << std::setw(8) <<
|
||||||
std::setfill('0')<< var << " failed to initialize " <<
|
std::setfill('0')<< var << " failed to initialize " <<
|
||||||
"with code 0x" << return_value << std::dec << std::endl;
|
"with code 0x" << return_value << std::dec << std::endl;
|
||||||
@ -79,10 +81,10 @@ void ObjectManager::initialize() {
|
|||||||
}
|
}
|
||||||
//Init was successful. Now check successful interconnections.
|
//Init was successful. Now check successful interconnections.
|
||||||
error_count = 0;
|
error_count = 0;
|
||||||
for (std::map<object_id_t, SystemObjectIF*>::iterator it = this->objectList.begin(); it != objectList.end(); it++ ) {
|
for (auto const& it : objectList) {
|
||||||
return_value = it->second->checkObjectConnections();
|
return_value = it.second->checkObjectConnections();
|
||||||
if ( return_value != RETURN_OK ) {
|
if ( return_value != RETURN_OK ) {
|
||||||
sif::error << "Object " << std::hex << (int) it->first
|
sif::error << "Object " << std::hex << (int) it.first
|
||||||
<< " connection check failed with code 0x" << return_value
|
<< " connection check failed with code 0x" << return_value
|
||||||
<< std::dec << std::endl;
|
<< std::dec << std::endl;
|
||||||
error_count++;
|
error_count++;
|
||||||
@ -98,7 +100,7 @@ void ObjectManager::initialize() {
|
|||||||
void ObjectManager::printList() {
|
void ObjectManager::printList() {
|
||||||
std::map<object_id_t, SystemObjectIF*>::iterator it;
|
std::map<object_id_t, SystemObjectIF*>::iterator it;
|
||||||
sif::debug << "ObjectManager: Object List contains:" << std::endl;
|
sif::debug << "ObjectManager: Object List contains:" << std::endl;
|
||||||
for (it = this->objectList.begin(); it != this->objectList.end(); it++) {
|
for (auto const& it : objectList) {
|
||||||
sif::debug << std::hex << it->first << " | " << it->second << std::endl;
|
sif::debug << std::hex << it.first << " | " << it.second << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
/**
|
#ifndef FRAMEWORK_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||||
* @file ObjectManagerIF.h
|
#define FRAMEWORK_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||||
* @brief This file contains the implementation of the ObjectManagerIF interface
|
|
||||||
* @date 19.09.2012
|
|
||||||
* @author Bastian Baetz
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OBJECTMANAGERIF_H_
|
|
||||||
#define OBJECTMANAGERIF_H_
|
|
||||||
|
|
||||||
#include <framework/objectmanager/frameworkObjects.h>
|
#include <framework/objectmanager/frameworkObjects.h>
|
||||||
#include <framework/objectmanager/SystemObjectIF.h>
|
#include <framework/objectmanager/SystemObjectIF.h>
|
||||||
@ -20,7 +13,8 @@
|
|||||||
* inserted, removed and retrieved from the list. On getting the
|
* inserted, removed and retrieved from the list. On getting the
|
||||||
* object, the call checks if the object implements the requested
|
* object, the call checks if the object implements the requested
|
||||||
* interface.
|
* interface.
|
||||||
* \ingroup system_objects
|
* @author Bastian Baetz
|
||||||
|
* @ingroup system_objects
|
||||||
*/
|
*/
|
||||||
class ObjectManagerIF : public HasReturnvaluesIF {
|
class ObjectManagerIF : public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
@ -93,7 +87,6 @@ T* ObjectManagerIF::get( object_id_t id ) {
|
|||||||
if(objectManager == nullptr) {
|
if(objectManager == nullptr) {
|
||||||
sif::error << "ObjectManagerIF: Global object manager has not "
|
sif::error << "ObjectManagerIF: Global object manager has not "
|
||||||
"been initialized yet!" << std::endl;
|
"been initialized yet!" << std::endl;
|
||||||
std::exit(0);
|
|
||||||
}
|
}
|
||||||
SystemObjectIF* temp = this->getSystemObject(id);
|
SystemObjectIF* temp = this->getSystemObject(id);
|
||||||
return dynamic_cast<T*>(temp);
|
return dynamic_cast<T*>(temp);
|
||||||
|
@ -82,7 +82,7 @@ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//No Else If, go on with buffer
|
//No Else If, go on with buffer
|
||||||
if (bufferLength >= *size) {
|
if (bufferLength <= *size) {
|
||||||
*size -= bufferLength;
|
*size -= bufferLength;
|
||||||
memcpy(m_buffer, *buffer, bufferLength);
|
memcpy(m_buffer, *buffer, bufferLength);
|
||||||
(*buffer) += bufferLength;
|
(*buffer) += bufferLength;
|
||||||
|
Loading…
Reference in New Issue
Block a user