Merge pull request 'object manager convergence' (#202) from KSat/fsfw:mueller/objectManager-convergence into master
Reviewed-on: fsfw/fsfw#202
This commit is contained in:
commit
580669d49d
@ -1,12 +1,5 @@
|
||||
/**
|
||||
* @file ObjectManager.h
|
||||
* @brief This file contains the implementation of the ObjectManager class
|
||||
* @date 18.09.2012
|
||||
* @author Bastian Baetz
|
||||
*/
|
||||
|
||||
#ifndef OBJECTMANAGER_H_
|
||||
#define OBJECTMANAGER_H_
|
||||
#ifndef FSFW_OBJECTMANAGER_OBJECTMANAGER_H_
|
||||
#define FSFW_OBJECTMANAGER_OBJECTMANAGER_H_
|
||||
|
||||
#include "ObjectManagerIF.h"
|
||||
#include "SystemObjectIF.h"
|
||||
@ -22,14 +15,15 @@
|
||||
* most of the system initialization.
|
||||
* As the system is static after initialization, no new objects are
|
||||
* created or inserted into the list after startup.
|
||||
* \ingroup system_objects
|
||||
* @ingroup system_objects
|
||||
* @author Bastian Baetz
|
||||
*/
|
||||
class ObjectManager : public ObjectManagerIF {
|
||||
private:
|
||||
//comparison?
|
||||
/**
|
||||
* \brief This is the map of all initialized objects in the manager.
|
||||
* \details Objects in the List must inherit the SystemObjectIF.
|
||||
* @brief This is the map of all initialized objects in the manager.
|
||||
* @details Objects in the List must inherit the SystemObjectIF.
|
||||
*/
|
||||
std::map<object_id_t, SystemObjectIF*> objectList;
|
||||
protected:
|
||||
@ -54,7 +48,8 @@ public:
|
||||
/**
|
||||
* @brief In the class's destructor, all objects in the list are deleted.
|
||||
*/
|
||||
//SHOULDDO: If, for some reason, deleting an ObjectManager instance is required, check if this works.
|
||||
// SHOULDDO: If, for some reason, deleting an ObjectManager instance is
|
||||
// required, check if this works.
|
||||
virtual ~ObjectManager( void );
|
||||
ReturnValue_t insert( object_id_t id, SystemObjectIF* object );
|
||||
ReturnValue_t remove( object_id_t id );
|
||||
@ -64,4 +59,4 @@ public:
|
||||
|
||||
|
||||
|
||||
#endif /* OBJECTMANAGER_H_ */
|
||||
#endif /* FSFW_OBJECTMANAGER_OBJECTMANAGER_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||
#define FRAMEWORK_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||
#ifndef FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||
#define FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||
|
||||
#include "frameworkObjects.h"
|
||||
#include "SystemObjectIF.h"
|
||||
@ -21,7 +21,6 @@ public:
|
||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF;
|
||||
static constexpr ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 );
|
||||
static constexpr ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 );
|
||||
|
||||
static constexpr ReturnValue_t CHILD_INIT_FAILED = MAKE_RETURN_CODE( 3 ); //!< Can be used if the initialization of a SystemObject failed.
|
||||
static constexpr ReturnValue_t INTERNAL_ERR_REPORTER_UNINIT = MAKE_RETURN_CODE( 4 );
|
||||
|
||||
@ -80,6 +79,7 @@ public:
|
||||
/**
|
||||
* @brief This is the forward declaration of the global objectManager instance.
|
||||
*/
|
||||
// SHOULDDO: maybe put this in the glob namespace to explicitely mark it global?
|
||||
extern ObjectManagerIF *objectManager;
|
||||
|
||||
/*Documentation can be found in the class method declaration above.*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "../events/EventManagerIF.h"
|
||||
#include "ObjectManager.h"
|
||||
#include "SystemObject.h"
|
||||
#include "../events/EventManagerIF.h"
|
||||
|
||||
SystemObject::SystemObject(object_id_t setObjectId, bool doRegister) :
|
||||
objectId(setObjectId), registered(doRegister) {
|
||||
|
@ -1,16 +1,9 @@
|
||||
/**
|
||||
* @file SystemObject.h
|
||||
* @brief This file contains the definition of the SystemObject class.
|
||||
* @date 07.11.2012
|
||||
* @author Ulrich Mohr
|
||||
*/
|
||||
|
||||
#ifndef SYSTEMOBJECT_H_
|
||||
#define SYSTEMOBJECT_H_
|
||||
#ifndef FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_
|
||||
#define FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_
|
||||
|
||||
#include "SystemObjectIF.h"
|
||||
#include "../events/Event.h"
|
||||
#include "../events/EventReportingProxyIF.h"
|
||||
#include "SystemObjectIF.h"
|
||||
#include "../timemanager/Clock.h"
|
||||
|
||||
/**
|
||||
@ -20,7 +13,8 @@
|
||||
* class that is announced to ObjectManager. It automatically includes
|
||||
* itself (and therefore the inheriting class) in the object manager's
|
||||
* list.
|
||||
* \ingroup system_objects
|
||||
* @author Ulrich Mohr
|
||||
* @ingroup system_objects
|
||||
*/
|
||||
class SystemObject: public SystemObjectIF {
|
||||
private:
|
||||
@ -37,25 +31,28 @@ public:
|
||||
* @param parameter1
|
||||
* @param parameter2
|
||||
*/
|
||||
virtual void triggerEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0);
|
||||
virtual void triggerEvent(Event event, uint32_t parameter1 = 0,
|
||||
uint32_t parameter2 = 0);
|
||||
|
||||
/**
|
||||
* @brief The class's constructor.
|
||||
* @details In the constructor, the object id is set and the class is
|
||||
* inserted in the object manager.
|
||||
* @param setObjectId The id the object shall have.
|
||||
* @param doRegister Determines if the object is registered in the global object manager.
|
||||
* @param doRegister Determines if the object is registered in
|
||||
* the global object manager.
|
||||
*/
|
||||
SystemObject(object_id_t setObjectId, bool doRegister = true);
|
||||
/**
|
||||
* @brief On destruction, the object removes itself from the list.
|
||||
*/
|
||||
virtual ~SystemObject();
|
||||
object_id_t getObjectId() const;
|
||||
virtual ReturnValue_t initialize();
|
||||
object_id_t getObjectId() const override;
|
||||
virtual ReturnValue_t initialize() override;
|
||||
virtual ReturnValue_t checkObjectConnections();
|
||||
|
||||
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const;
|
||||
virtual void forwardEvent(Event event, uint32_t parameter1 = 0,
|
||||
uint32_t parameter2 = 0) const;
|
||||
};
|
||||
|
||||
#endif /* SYSTEMOBJECT_H_ */
|
||||
#endif /* FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_ */
|
||||
|
@ -1,26 +1,19 @@
|
||||
/**
|
||||
* @file SystemObjectIF.h
|
||||
* @brief This file contains the definition of the SystemObjectIF interface.
|
||||
* @date 18.09.2012
|
||||
* @author Bastian Baetz
|
||||
*/
|
||||
|
||||
#ifndef SYSTEMOBJECTIF_H_
|
||||
#define SYSTEMOBJECTIF_H_
|
||||
#ifndef FSFW_OBJECTMANAGER_SYSTEMOBJECTIF_H_
|
||||
#define FSFW_OBJECTMANAGER_SYSTEMOBJECTIF_H_
|
||||
|
||||
#include "../events/EventReportingProxyIF.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
/**
|
||||
* \defgroup system_objects Software System Object Management
|
||||
* The classes to create System Objects and classes to manage these are contained in this group.
|
||||
* System Objects are software elements that can be controlled externally. They all have a unique
|
||||
* object identifier.
|
||||
* @defgroup system_objects Software System Object Management
|
||||
* The classes to create System Objects and classes to manage these are
|
||||
* contained in this group. System Objects are software elements that can be
|
||||
* controlled externally. They all have a unique object identifier.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the typedef for object identifiers.
|
||||
* \ingroup system_objects
|
||||
* @ingroup system_objects
|
||||
*/
|
||||
typedef uint32_t object_id_t;
|
||||
|
||||
@ -29,7 +22,8 @@ typedef uint32_t object_id_t;
|
||||
* list.
|
||||
* It does not provide any method definitions, still it is required to
|
||||
* perform a type check with dynamic_cast.
|
||||
* \ingroup system_objects
|
||||
* @author Bastian Baetz
|
||||
* @ingroup system_objects
|
||||
*/
|
||||
class SystemObjectIF : public EventReportingProxyIF {
|
||||
public:
|
||||
@ -41,24 +35,28 @@ public:
|
||||
/**
|
||||
* The empty virtual destructor as required for C++ interfaces.
|
||||
*/
|
||||
virtual ~SystemObjectIF() {
|
||||
}
|
||||
virtual ~SystemObjectIF() {}
|
||||
/**
|
||||
* Initializes all inter-object dependencies.
|
||||
* This is necessary to avoid circular dependencies of not-fully
|
||||
* initialized objects on start up.
|
||||
* @return - \c RETURN_OK in case the initialization was successful
|
||||
* - \c RETURN_FAILED otherwise
|
||||
* @brief Initializes the object.
|
||||
* There are initialization steps which can also be done in the constructor.
|
||||
* However, there is no clean way to get a returnvalue from a constructor.
|
||||
* Furthermore some components require other system object to be created
|
||||
* which might not have been built yet.
|
||||
* Therefore, a two-step initialization resolves this problem and prevents
|
||||
* circular dependencies of not-fully initialized objects on start up.
|
||||
* @return - @c RETURN_OK in case the initialization was successful
|
||||
* - @c RETURN_FAILED otherwise
|
||||
*/
|
||||
virtual ReturnValue_t initialize() = 0;
|
||||
/**
|
||||
* Checks, if all object-object interconnections are satisfying for operation.
|
||||
* Some objects need certain other objects (or a certain number), to be registered as children.
|
||||
* These checks can be done in this method.
|
||||
* @return - \c RETURN_OK in case the check was successful
|
||||
* - \c any other code otherwise
|
||||
* @brief Checks if all object-object interconnections are satisfying
|
||||
* for operation.
|
||||
* Some objects need certain other objects (or a certain number), to be
|
||||
* registered as children. These checks can be done in this method.
|
||||
* @return - @c RETURN_OK in case the check was successful
|
||||
* - @c any other code otherwise
|
||||
*/
|
||||
virtual ReturnValue_t checkObjectConnections() = 0;
|
||||
};
|
||||
|
||||
#endif /* SYSTEMOBJECTIF_H_ */
|
||||
#endif /* #ifndef FSFW_OBJECTMANAGER_SYSTEMOBJECTIF_H_ */
|
||||
|
@ -1,8 +1,15 @@
|
||||
#ifndef FRAMEWORK_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
||||
#define FRAMEWORK_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
||||
#ifndef FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
||||
#define FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
||||
|
||||
namespace objects {
|
||||
enum framework_objects {
|
||||
// Default verification reporter.
|
||||
PUS_SERVICE_1 = 0x53000001,
|
||||
PUS_SERVICE_2 = 0x53000002,
|
||||
PUS_SERVICE_5 = 0x53000005,
|
||||
PUS_SERVICE_8 = 0x53000008,
|
||||
PUS_SERVICE_200 = 0x53000200,
|
||||
|
||||
//Generic IDs for IPC, modes, health, events
|
||||
HEALTH_TABLE = 0x53010000,
|
||||
// MODE_STORE = 0x53010100,
|
||||
@ -12,10 +19,11 @@ enum framework_objects {
|
||||
//IDs for PUS Packet Communication
|
||||
TC_STORE = 0x534f0100,
|
||||
TM_STORE = 0x534f0200,
|
||||
|
||||
NO_OBJECT = 0xFFFFFFFF
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_OBJECTMANAGER_FRAMEWORKOBJECTS_H_ */
|
||||
#endif /* FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user