object manager convergence
This commit is contained in:
parent
42bfedd36c
commit
85f21b0516
@ -1,12 +1,5 @@
|
|||||||
/**
|
#ifndef FSFW_OBJECTMANAGER_OBJECTMANAGER_H_
|
||||||
* @file ObjectManager.h
|
#define FSFW_OBJECTMANAGER_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_
|
|
||||||
|
|
||||||
#include "ObjectManagerIF.h"
|
#include "ObjectManagerIF.h"
|
||||||
#include "SystemObjectIF.h"
|
#include "SystemObjectIF.h"
|
||||||
@ -22,14 +15,15 @@
|
|||||||
* most of the system initialization.
|
* most of the system initialization.
|
||||||
* As the system is static after initialization, no new objects are
|
* As the system is static after initialization, no new objects are
|
||||||
* created or inserted into the list after startup.
|
* created or inserted into the list after startup.
|
||||||
* \ingroup system_objects
|
* @ingroup system_objects
|
||||||
|
* @author Bastian Baetz
|
||||||
*/
|
*/
|
||||||
class ObjectManager : public ObjectManagerIF {
|
class ObjectManager : public ObjectManagerIF {
|
||||||
private:
|
private:
|
||||||
//comparison?
|
//comparison?
|
||||||
/**
|
/**
|
||||||
* \brief This is the map of all initialized objects in the manager.
|
* @brief This is the map of all initialized objects in the manager.
|
||||||
* \details Objects in the List must inherit the SystemObjectIF.
|
* @details Objects in the List must inherit the SystemObjectIF.
|
||||||
*/
|
*/
|
||||||
std::map<object_id_t, SystemObjectIF*> objectList;
|
std::map<object_id_t, SystemObjectIF*> objectList;
|
||||||
protected:
|
protected:
|
||||||
@ -54,7 +48,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief In the class's destructor, all objects in the list are deleted.
|
* @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 );
|
virtual ~ObjectManager( void );
|
||||||
ReturnValue_t insert( object_id_t id, SystemObjectIF* object );
|
ReturnValue_t insert( object_id_t id, SystemObjectIF* object );
|
||||||
ReturnValue_t remove( object_id_t id );
|
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_
|
#ifndef FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||||
#define FRAMEWORK_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
#define FSFW_OBJECTMANAGER_OBJECTMANAGERIF_H_
|
||||||
|
|
||||||
#include "frameworkObjects.h"
|
#include "frameworkObjects.h"
|
||||||
#include "SystemObjectIF.h"
|
#include "SystemObjectIF.h"
|
||||||
@ -21,8 +21,7 @@ public:
|
|||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF;
|
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 INSERTION_FAILED = MAKE_RETURN_CODE( 1 );
|
||||||
static constexpr 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 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 );
|
static constexpr ReturnValue_t INTERNAL_ERR_REPORTER_UNINIT = MAKE_RETURN_CODE( 4 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -80,6 +79,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief This is the forward declaration of the global objectManager instance.
|
* @brief This is the forward declaration of the global objectManager instance.
|
||||||
*/
|
*/
|
||||||
|
// maybe but this in the glob namespace to explicitely mark it global?
|
||||||
extern ObjectManagerIF *objectManager;
|
extern ObjectManagerIF *objectManager;
|
||||||
|
|
||||||
/*Documentation can be found in the class method declaration above.*/
|
/*Documentation can be found in the class method declaration above.*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "../events/EventManagerIF.h"
|
|
||||||
#include "ObjectManager.h"
|
#include "ObjectManager.h"
|
||||||
#include "SystemObject.h"
|
#include "SystemObject.h"
|
||||||
|
#include "../events/EventManagerIF.h"
|
||||||
|
|
||||||
SystemObject::SystemObject(object_id_t setObjectId, bool doRegister) :
|
SystemObject::SystemObject(object_id_t setObjectId, bool doRegister) :
|
||||||
objectId(setObjectId), registered(doRegister) {
|
objectId(setObjectId), registered(doRegister) {
|
||||||
|
@ -1,16 +1,9 @@
|
|||||||
/**
|
#ifndef FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_
|
||||||
* @file SystemObject.h
|
#define FSFW_OBJECTMANAGER_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_
|
|
||||||
|
|
||||||
|
#include "SystemObjectIF.h"
|
||||||
#include "../events/Event.h"
|
#include "../events/Event.h"
|
||||||
#include "../events/EventReportingProxyIF.h"
|
#include "../events/EventReportingProxyIF.h"
|
||||||
#include "SystemObjectIF.h"
|
|
||||||
#include "../timemanager/Clock.h"
|
#include "../timemanager/Clock.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,7 +13,7 @@
|
|||||||
* class that is announced to ObjectManager. It automatically includes
|
* class that is announced to ObjectManager. It automatically includes
|
||||||
* itself (and therefore the inheriting class) in the object manager's
|
* itself (and therefore the inheriting class) in the object manager's
|
||||||
* list.
|
* list.
|
||||||
* \ingroup system_objects
|
* @ingroup system_objects
|
||||||
*/
|
*/
|
||||||
class SystemObject: public SystemObjectIF {
|
class SystemObject: public SystemObjectIF {
|
||||||
private:
|
private:
|
||||||
@ -37,25 +30,28 @@ public:
|
|||||||
* @param parameter1
|
* @param parameter1
|
||||||
* @param parameter2
|
* @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.
|
* @brief The class's constructor.
|
||||||
* @details In the constructor, the object id is set and the class is
|
* @details In the constructor, the object id is set and the class is
|
||||||
* inserted in the object manager.
|
* inserted in the object manager.
|
||||||
* @param setObjectId The id the object shall have.
|
* @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);
|
SystemObject(object_id_t setObjectId, bool doRegister = true);
|
||||||
/**
|
/**
|
||||||
* @brief On destruction, the object removes itself from the list.
|
* @brief On destruction, the object removes itself from the list.
|
||||||
*/
|
*/
|
||||||
virtual ~SystemObject();
|
virtual ~SystemObject();
|
||||||
object_id_t getObjectId() const;
|
object_id_t getObjectId() const override;
|
||||||
virtual ReturnValue_t initialize();
|
virtual ReturnValue_t initialize() override;
|
||||||
virtual ReturnValue_t checkObjectConnections();
|
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 @@
|
|||||||
/**
|
#ifndef FSFW_OBJECTMANAGER_SYSTEMOBJECTIF_H_
|
||||||
* @file SystemObjectIF.h
|
#define FSFW_OBJECTMANAGER_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_
|
|
||||||
|
|
||||||
#include "../events/EventReportingProxyIF.h"
|
#include "../events/EventReportingProxyIF.h"
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
/**
|
/**
|
||||||
* \defgroup system_objects Software System Object Management
|
* @defgroup system_objects Software System Object Management
|
||||||
* The classes to create System Objects and classes to manage these are contained in this group.
|
* The classes to create System Objects and classes to manage these are
|
||||||
* System Objects are software elements that can be controlled externally. They all have a unique
|
* contained in this group. System Objects are software elements that can be
|
||||||
* object identifier.
|
* controlled externally. They all have a unique object identifier.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the typedef for object identifiers.
|
* This is the typedef for object identifiers.
|
||||||
* \ingroup system_objects
|
* @ingroup system_objects
|
||||||
*/
|
*/
|
||||||
typedef uint32_t object_id_t;
|
typedef uint32_t object_id_t;
|
||||||
|
|
||||||
@ -29,7 +22,8 @@ typedef uint32_t object_id_t;
|
|||||||
* list.
|
* list.
|
||||||
* It does not provide any method definitions, still it is required to
|
* It does not provide any method definitions, still it is required to
|
||||||
* perform a type check with dynamic_cast.
|
* perform a type check with dynamic_cast.
|
||||||
* \ingroup system_objects
|
* @author Bastian Baetz
|
||||||
|
* @ingroup system_objects
|
||||||
*/
|
*/
|
||||||
class SystemObjectIF : public EventReportingProxyIF {
|
class SystemObjectIF : public EventReportingProxyIF {
|
||||||
public:
|
public:
|
||||||
@ -41,24 +35,28 @@ public:
|
|||||||
/**
|
/**
|
||||||
* The empty virtual destructor as required for C++ interfaces.
|
* The empty virtual destructor as required for C++ interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~SystemObjectIF() {
|
virtual ~SystemObjectIF() {}
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Initializes all inter-object dependencies.
|
* @brief Initializes the object.
|
||||||
* This is necessary to avoid circular dependencies of not-fully
|
* There are initialization steps which can also be done in the constructor.
|
||||||
* initialized objects on start up.
|
* However, there is no clean way to get a returnvalue from a constructor.
|
||||||
* @return - \c RETURN_OK in case the initialization was successful
|
* Furthermore some components require other system object to be created
|
||||||
* - \c RETURN_FAILED otherwise
|
* 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;
|
virtual ReturnValue_t initialize() = 0;
|
||||||
/**
|
/**
|
||||||
* Checks, if all object-object interconnections are satisfying for operation.
|
* @brief Checks if all object-object interconnections are satisfying
|
||||||
* Some objects need certain other objects (or a certain number), to be registered as children.
|
* for operation.
|
||||||
* These checks can be done in this method.
|
* Some objects need certain other objects (or a certain number), to be
|
||||||
* @return - \c RETURN_OK in case the check was successful
|
* registered as children. These checks can be done in this method.
|
||||||
* - \c any other code otherwise
|
* @return - @c RETURN_OK in case the check was successful
|
||||||
|
* - @c any other code otherwise
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t checkObjectConnections() = 0;
|
virtual ReturnValue_t checkObjectConnections() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SYSTEMOBJECTIF_H_ */
|
#endif /* #ifndef FSFW_OBJECTMANAGER_SYSTEMOBJECTIF_H_ */
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
#ifndef FRAMEWORK_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
#ifndef FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
||||||
#define FRAMEWORK_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
#define FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_
|
||||||
|
|
||||||
namespace objects {
|
namespace objects {
|
||||||
enum framework_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
|
//Generic IDs for IPC, modes, health, events
|
||||||
HEALTH_TABLE = 0x53010000,
|
HEALTH_TABLE = 0x53010000,
|
||||||
// MODE_STORE = 0x53010100,
|
// MODE_STORE = 0x53010100,
|
||||||
@ -12,10 +19,11 @@ enum framework_objects {
|
|||||||
//IDs for PUS Packet Communication
|
//IDs for PUS Packet Communication
|
||||||
TC_STORE = 0x534f0100,
|
TC_STORE = 0x534f0100,
|
||||||
TM_STORE = 0x534f0200,
|
TM_STORE = 0x534f0200,
|
||||||
|
|
||||||
NO_OBJECT = 0xFFFFFFFF
|
NO_OBJECT = 0xFFFFFFFF
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_OBJECTMANAGER_FRAMEWORKOBJECTS_H_ */
|
#endif /* FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user