some object managerIF security measures
objectmanager get function checks whether global object manager was initialized now. New returnvalues, which are also used for local pool init
This commit is contained in:
parent
6b205e166b
commit
e950051b4a
@ -89,17 +89,9 @@ uint32_t FixedSlotSequence::getLengthMs() const {
|
|||||||
|
|
||||||
ReturnValue_t FixedSlotSequence::checkSequence() const {
|
ReturnValue_t FixedSlotSequence::checkSequence() const {
|
||||||
if(slotList.empty()) {
|
if(slotList.empty()) {
|
||||||
<<<<<<< HEAD
|
|
||||||
sif::error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
|
sif::error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
// Iterate through slotList and check successful creation.
|
|
||||||
// Checks if timing is ok (must be ascending) and if all handlers were found.
|
|
||||||
=======
|
|
||||||
error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
>>>>>>> master
|
|
||||||
auto slotIt = slotList.begin();
|
auto slotIt = slotList.begin();
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
uint32_t time = 0;
|
uint32_t time = 0;
|
||||||
|
@ -12,16 +12,6 @@ using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class is the representation of a Polling Sequence Table in software.
|
* @brief This class is the representation of a Polling Sequence Table in software.
|
||||||
*
|
|
||||||
<<<<<<< HEAD
|
|
||||||
* @details The FixedSlotSequence object maintains the dynamic execution of device handler objects.
|
|
||||||
* The main idea is to create a list of device handlers, to announce all handlers to the
|
|
||||||
* polling sequence and to maintain a list of polling slot objects. This slot list represents the
|
|
||||||
* Polling Sequence Table in software. Each polling slot contains information to indicate when and
|
|
||||||
* which device handler shall be executed within a given polling period.
|
|
||||||
* The sequence is then executed by iterating through this slot list.
|
|
||||||
* Handlers are invoking by calling a certain function stored in the handler list.
|
|
||||||
=======
|
|
||||||
* @details
|
* @details
|
||||||
* The FixedSlotSequence object maintains the dynamic execution of
|
* The FixedSlotSequence object maintains the dynamic execution of
|
||||||
* device handler objects.
|
* device handler objects.
|
||||||
@ -35,7 +25,6 @@ using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
|
|||||||
* which device handler shall be executed within a given polling period.
|
* which device handler shall be executed within a given polling period.
|
||||||
* The sequence is then executed by iterating through this slot list.
|
* The sequence is then executed by iterating through this slot list.
|
||||||
* Handlers are invoking by calling a certain function stored in the handler list.
|
* Handlers are invoking by calling a certain function stored in the handler list.
|
||||||
>>>>>>> master
|
|
||||||
*/
|
*/
|
||||||
class FixedSlotSequence {
|
class FixedSlotSequence {
|
||||||
public:
|
public:
|
||||||
@ -128,16 +117,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
SlotListIter current;
|
SlotListIter current;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
virtual ReturnValue_t checkSequence() const;
|
|
||||||
=======
|
|
||||||
/**
|
/**
|
||||||
* Iterate through slotList and check successful creation.
|
* Iterate through slotList and check successful creation.
|
||||||
* Checks if timing is ok (must be ascending) and if all handlers were found.
|
* Checks if timing is ok (must be ascending) and if all handlers were found.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t checkSequence() const;
|
ReturnValue_t checkSequence() const;
|
||||||
>>>>>>> master
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <config/objects/systemObjectList.h>
|
#include <config/objects/systemObjectList.h>
|
||||||
#include <framework/objectmanager/SystemObjectIF.h>
|
#include <framework/objectmanager/SystemObjectIF.h>
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class provides an interface to the global object manager.
|
* @brief This class provides an interface to the global object manager.
|
||||||
@ -24,9 +25,12 @@
|
|||||||
*/
|
*/
|
||||||
class ObjectManagerIF : public HasReturnvaluesIF {
|
class ObjectManagerIF : public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF;
|
||||||
static const ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 );
|
static constexpr ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 );
|
||||||
static const ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 );
|
static constexpr ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 );
|
||||||
|
static constexpr ReturnValue_t CHILD_INIT_FAILED = MAKE_RETURN_CODE( 3 );
|
||||||
|
static constexpr ReturnValue_t INTERNAL_ERR_REPORTER_UNINIT = MAKE_RETURN_CODE( 4 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief This method is used to hide the template-based get call from
|
* @brief This method is used to hide the template-based get call from
|
||||||
@ -79,16 +83,21 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*Documentation can be found in the class method declaration above.*/
|
|
||||||
template <typename T>
|
|
||||||
T* ObjectManagerIF::get( object_id_t id ) {
|
|
||||||
SystemObjectIF* temp = this->getSystemObject(id);
|
|
||||||
return dynamic_cast<T*>(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the forward declaration of the global objectManager instance.
|
* @brief This is the forward declaration of the global objectManager instance.
|
||||||
*/
|
*/
|
||||||
extern ObjectManagerIF *objectManager;
|
extern ObjectManagerIF *objectManager;
|
||||||
|
|
||||||
|
/*Documentation can be found in the class method declaration above.*/
|
||||||
|
template <typename T>
|
||||||
|
T* ObjectManagerIF::get( object_id_t id ) {
|
||||||
|
if(objectManager == nullptr) {
|
||||||
|
sif::error << "ObjectManagerIF: Global object manager has not "
|
||||||
|
"been initialized yet!" << std::endl;
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
SystemObjectIF* temp = this->getSystemObject(id);
|
||||||
|
return dynamic_cast<T*>(temp);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OBJECTMANAGERIF_H_ */
|
#endif /* OBJECTMANAGERIF_H_ */
|
||||||
|
@ -242,8 +242,8 @@ inline ReturnValue_t LocalPool<NUMBER_OF_POOLS>::initialize() {
|
|||||||
}
|
}
|
||||||
internalErrorReporter = objectManager->get<InternalErrorReporterIF>(
|
internalErrorReporter = objectManager->get<InternalErrorReporterIF>(
|
||||||
objects::INTERNAL_ERROR_REPORTER);
|
objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (internalErrorReporter == NULL){
|
if (internalErrorReporter == nullptr){
|
||||||
return RETURN_FAILED;
|
return ObjectManagerIF::INTERNAL_ERR_REPORTER_UNINIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if any pool size is large than the maximum allowed.
|
//Check if any pool size is large than the maximum allowed.
|
||||||
@ -251,7 +251,7 @@ inline ReturnValue_t LocalPool<NUMBER_OF_POOLS>::initialize() {
|
|||||||
if (element_sizes[count] >= STORAGE_FREE) {
|
if (element_sizes[count] >= STORAGE_FREE) {
|
||||||
sif::error << "LocalPool::initialize: Pool is too large! "
|
sif::error << "LocalPool::initialize: Pool is too large! "
|
||||||
"Max. allowed size is: " << (STORAGE_FREE - 1) << std::endl;
|
"Max. allowed size is: " << (STORAGE_FREE - 1) << std::endl;
|
||||||
return RETURN_FAILED;
|
return StorageManagerIF::POOL_TOO_LARGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
@ -71,6 +71,7 @@ public:
|
|||||||
static const ReturnValue_t ILLEGAL_STORAGE_ID = MAKE_RETURN_CODE(3); //!< This return code indicates that data was requested with an illegal storage ID.
|
static const ReturnValue_t ILLEGAL_STORAGE_ID = MAKE_RETURN_CODE(3); //!< This return code indicates that data was requested with an illegal storage ID.
|
||||||
static const ReturnValue_t DATA_DOES_NOT_EXIST = MAKE_RETURN_CODE(4); //!< This return code indicates that the requested ID was valid, but no data is stored there.
|
static const ReturnValue_t DATA_DOES_NOT_EXIST = MAKE_RETURN_CODE(4); //!< This return code indicates that the requested ID was valid, but no data is stored there.
|
||||||
static const ReturnValue_t ILLEGAL_ADDRESS = MAKE_RETURN_CODE(5);
|
static const ReturnValue_t ILLEGAL_ADDRESS = MAKE_RETURN_CODE(5);
|
||||||
|
static const ReturnValue_t POOL_TOO_LARGE = MAKE_RETURN_CODE(6); //!< Pool size too large on initialization.
|
||||||
|
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::OBSW;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::OBSW;
|
||||||
static const Event GET_DATA_FAILED = MAKE_EVENT(0, SEVERITY::LOW);
|
static const Event GET_DATA_FAILED = MAKE_EVENT(0, SEVERITY::LOW);
|
||||||
|
Loading…
Reference in New Issue
Block a user