I now remember why I included object manager IF changes
This commit is contained in:
parent
8e3f99a350
commit
1d99a99bbd
@ -1,17 +1,10 @@
|
|||||||
/**
|
#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 <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.
|
||||||
@ -20,13 +13,17 @@
|
|||||||
* 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:
|
||||||
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
|
||||||
@ -78,15 +75,22 @@ public:
|
|||||||
virtual void printList() = 0;
|
virtual void printList() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
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(1);
|
||||||
|
}
|
||||||
|
SystemObjectIF* temp = this->getSystemObject(id);
|
||||||
|
return dynamic_cast<T*>(temp);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OBJECTMANAGERIF_H_ */
|
#endif /* OBJECTMANAGERIF_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user