Object Manager API

SystemObject

class SystemObject : public SystemObjectIF

This class automates insertion into the ObjectManager and management of the object id.

This class is more a base class, which shall be inherited by any class that is announced to ObjectManager. It automatically includes itself (and therefore the inheriting class) in the object manager’s list.

Author

Ulrich Mohr

Subclassed by AbstractTemperatureSensor, CdsShortTimeStamper, CommandingServiceBase, ControllerBase, DeviceHandlerBase, DummyPowerSwitcher, EventManager, Fuse, HealthDevice, HealthTable, I2cComIF, InternalErrorReporter, LinuxLibgpioIF, LocalPool, PowerSensor, PowerSwitcherComponent, PusServiceBase, SerialComIF, Service1TelecommandVerification, SharedLocalDataSet, SharedRingBuffer, SpiComIF, SubsystemBase, TcDistributorBase, TcpTmTcServer, TestEchoComIF, TestTask, TmTcBridge, UdpTcPollingTask, VerificationReporter

Public Functions

virtual void triggerEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0)

Helper function to send Event Messages to the Event Manager

Parameters:
  • event

  • parameter1

  • parameter2

SystemObject(object_id_t setObjectId, bool doRegister = true)

The class’s constructor.

In the constructor, the object id is set and the class is inserted in the object manager.

Parameters:
  • setObjectId – The id the object shall have.

  • doRegister – Determines if the object is registered in the global object manager.

virtual ~SystemObject()

On destruction, the object removes itself from the list.

virtual object_id_t getObjectId() const override

This is a simple getter to return the object identifier.

Returns:

Returns the object id of this object.

virtual ReturnValue_t initialize() override

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.

Returns:

- returnvalue::OK in case the initialization was successful

  • returnvalue::FAILED otherwise

virtual ReturnValue_t checkObjectConnections() override

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.

Returns:

- returnvalue::OK in case the check was successful

  • any other code otherwise

ObjectManager

class ObjectManager : public ObjectManagerIF

This class implements a global object manager.

This manager handles a list of available objects with system-wide relevance, such as device handlers, and TM/TC services. Objects can be inserted, removed and retrieved from the list. In addition, the class holds a so-called factory, that creates and inserts new objects if they are not already in the list. This feature automates most of the system initialization. As the system is static after initialization, no new objects are created or inserted into the list after startup.

Author

Bastian Baetz

Public Functions

~ObjectManager() override

In the class’s destructor, all objects in the list are deleted.

virtual ReturnValue_t insert(object_id_t id, SystemObjectIF *object) override

With this call, new objects are inserted to the list.

The implementation shall return an error code in case the object can’t be added (e.g. the id is already in use).

Parameters:
  • id – The new id to be added to the list.

  • object – A pointer to the object to be added.

Returns:

  • INSERTION_FAILED in case the object could not be inserted.

  • returnvalue::OK in case the object was successfully inserted

virtual ReturnValue_t remove(object_id_t id) override

With this call, an object is removed from the list.

Parameters:

id – The object id of the object to be removed.

Returns:

  • NOT_FOUND in case the object was not found

  • returnvalue::OK in case the object was successfully removed

virtual void printList() override

This is a debug function, that prints the current content of the object list.

Public Static Functions

static ObjectManager *instance()

Returns the single instance of ObjectManager. The implementation of instance is found in its subclasses. Thus, we choose link-time variability of the instance.

static void clear()

Deletes the single instance of ObjectManager

Protected Functions

virtual SystemObjectIF *getSystemObject(object_id_t id) override

This method is used to hide the template-based get call from a specific implementation.

So, an implementation only has to implement this call.

Parameters:

id – The object id of the requested object.

Returns:

The method returns a pointer to an object implementing (at least) the SystemObjectIF, or NULL.

Protected Attributes

produce_function_t objectFactoryFunction = nullptr

This attribute is initialized with the factory function that creates new objects.

The function is called if an object was requested with getSystemObject, but not found in objectList.

Param The:

id of the object to be created.

Return:

Returns a pointer to the newly created object or NULL.

SystemObjectIF

class SystemObjectIF : public EventReportingProxyIF

This interface allows a class to be included in the object manager list. It does not provide any method definitions, still it is required to perform a type check with dynamic_cast.

Author

Bastian Baetz

Subclassed by SystemObject

Public Functions

virtual object_id_t getObjectId() const = 0

This is a simple getter to return the object identifier.

Returns:

Returns the object id of this object.

inline virtual ~SystemObjectIF()

The empty virtual destructor as required for C++ interfaces.

virtual ReturnValue_t initialize() = 0

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.

Returns:

- returnvalue::OK in case the initialization was successful

  • returnvalue::FAILED otherwise

virtual ReturnValue_t checkObjectConnections() = 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.

Returns:

- returnvalue::OK in case the check was successful

  • any other code otherwise

ObjectManagerIF

class ObjectManagerIF

This class provides an interface to the global object manager.

This manager handles a list of available objects with system-wide relevance, such as device handlers, and TM/TC services. They can be inserted, removed and retrieved from the list. On getting the object, the call checks if the object implements the requested interface. This interface does not specify a getter function because templates can’t be used in interfaces.

Author

Bastian Baetz

Subclassed by ObjectManager

Public Functions

inline virtual ~ObjectManagerIF(void)

This is the empty virtual destructor as requested by C++ interfaces.

virtual ReturnValue_t insert(object_id_t id, SystemObjectIF *object) = 0

With this call, new objects are inserted to the list.

The implementation shall return an error code in case the object can’t be added (e.g. the id is already in use).

Parameters:
  • id – The new id to be added to the list.

  • object – A pointer to the object to be added.

Returns:

  • INSERTION_FAILED in case the object could not be inserted.

  • returnvalue::OK in case the object was successfully inserted

virtual ReturnValue_t remove(object_id_t id) = 0

With this call, an object is removed from the list.

Parameters:

id – The object id of the object to be removed.

Returns:

  • NOT_FOUND in case the object was not found

  • returnvalue::OK in case the object was successfully removed

virtual void printList() = 0

This is a debug function, that prints the current content of the object list.

Public Static Attributes

static constexpr ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE(2)

Can be used if the initialization of a SystemObject failed.

Protected Functions

virtual SystemObjectIF *getSystemObject(object_id_t id) = 0

This method is used to hide the template-based get call from a specific implementation.

So, an implementation only has to implement this call.

Parameters:

id – The object id of the requested object.

Returns:

The method returns a pointer to an object implementing (at least) the SystemObjectIF, or NULL.