obj factory is singleton now
This commit is contained in:
parent
dfc2e6bf67
commit
0747db41ff
@ -1,6 +1,5 @@
|
||||
#include "InitMission.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
#include "pollingsequence/pollingSequenceFactory.h"
|
||||
|
||||
@ -8,7 +7,7 @@
|
||||
#include "mission/assemblies/TestAssembly.h"
|
||||
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
@ -195,7 +194,7 @@ void InitMission::createTasks() {
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO
|
||||
HasModesIF* assembly = objectManager->get<HasModesIF>(objects::TEST_ASSEMBLY);
|
||||
HasModesIF* assembly = ObjectManager::instance()->get<HasModesIF>(objects::TEST_ASSEMBLY);
|
||||
if (assembly == nullptr){
|
||||
return;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
|
||||
void ObjectFactory::produce() {
|
||||
void ObjectFactory::produce(void* args) {
|
||||
/* Located inside GenericFactory source file */
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace ObjectFactory {
|
||||
void setStatics();
|
||||
void produce();
|
||||
void produce(void* args);
|
||||
};
|
||||
|
||||
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */
|
||||
|
@ -33,8 +33,6 @@ ServiceInterfaceStream sif::warning("WARNING", true);
|
||||
ServiceInterfaceStream sif::error("ERROR", true);
|
||||
#endif
|
||||
|
||||
ObjectManagerIF *objectManager = nullptr;
|
||||
|
||||
void initTask(void *parameters);
|
||||
|
||||
/**
|
||||
@ -70,8 +68,10 @@ void initTask(void *parameters) {
|
||||
sif::printInfo("Creating objects..\n\r");
|
||||
#endif
|
||||
|
||||
objectManager = new ObjectManager(ObjectFactory::produce);
|
||||
objectManager->initialize();
|
||||
ObjectManager* objManager = ObjectManager::instance();
|
||||
objManager->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||
objManager->initialize();
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Creating tasks.." << std::endl;
|
||||
#else
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <hardware_init.h>
|
||||
|
||||
#include <fsfw/ipc/MutexGuard.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
#include <lwip/timeouts.h>
|
||||
@ -18,7 +19,7 @@ UdpTcLwIpPollingTask::~UdpTcLwIpPollingTask() {
|
||||
}
|
||||
|
||||
ReturnValue_t UdpTcLwIpPollingTask::initialize() {
|
||||
udpBridge = objectManager->get<TmTcLwIpUdpBridge>(bridgeId);
|
||||
udpBridge = ObjectManager::instance()->get<TmTcLwIpUdpBridge>(bridgeId);
|
||||
if(udpBridge == nullptr) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 33e7c635c57055597caf3d9e9cbafc15c7364266
|
||||
Subproject commit 50fac22f54031e409306931e15d2e63426aa03b2
|
@ -1,7 +1,7 @@
|
||||
#include <mission/assemblies/TestAssembly.h>
|
||||
#include <common/config/commonSystemObjects.h>
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
|
||||
TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId):
|
||||
@ -149,8 +149,8 @@ ReturnValue_t TestAssembly::initialize() {
|
||||
if(result != RETURN_OK){
|
||||
return result;
|
||||
}
|
||||
handler0 = objectManager->get<TestDevice>(objects::TEST_DEVICE_HANDLER_0);
|
||||
handler1 = objectManager->get<TestDevice>(objects::TEST_DEVICE_HANDLER_1);
|
||||
handler0 = ObjectManager::instance()->get<TestDevice>(objects::TEST_DEVICE_HANDLER_0);
|
||||
handler1 = ObjectManager::instance()->get<TestDevice>(objects::TEST_DEVICE_HANDLER_1);
|
||||
if((handler0 == nullptr) or (handler1 == nullptr)){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "TestController.h"
|
||||
#include <OBSWConfig.h>
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
TestController::TestController(object_id_t objectId, size_t commandQueueDepth):
|
||||
@ -161,7 +162,7 @@ ReturnValue_t TestController::initializeLocalDataPool(localpool::DataPool &local
|
||||
|
||||
ReturnValue_t TestController::initializeAfterTaskCreation() {
|
||||
namespace td = testdevice;
|
||||
HasLocalDataPoolIF* device0 = objectManager->get<HasLocalDataPoolIF>(
|
||||
HasLocalDataPoolIF* device0 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
objects::TEST_DEVICE_HANDLER_0);
|
||||
if(device0 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
@ -183,7 +184,7 @@ ReturnValue_t TestController::initializeAfterTaskCreation() {
|
||||
}
|
||||
|
||||
|
||||
HasLocalDataPoolIF* device1 = objectManager->get<HasLocalDataPoolIF>(
|
||||
HasLocalDataPoolIF* device1 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
objects::TEST_DEVICE_HANDLER_1);
|
||||
if(device1 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h>
|
||||
@ -81,7 +82,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
|
||||
|
||||
ReturnValue_t TmFunnel::initialize() {
|
||||
|
||||
tmPool = objectManager->get<StorageManagerIF>(objects::TM_STORE);
|
||||
tmPool = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
|
||||
if(tmPool == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "TmFunnel::initialize: TM store not set." << std::endl;
|
||||
@ -91,8 +92,8 @@ ReturnValue_t TmFunnel::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
AcceptsTelemetryIF* tmTarget =
|
||||
objectManager->get<AcceptsTelemetryIF>(downlinkDestination);
|
||||
AcceptsTelemetryIF* tmTarget = ObjectManager::instance()->
|
||||
get<AcceptsTelemetryIF>(downlinkDestination);
|
||||
if(tmTarget == nullptr){
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "TmFunnel::initialize: Downlink Destination not set." << std::endl;
|
||||
@ -108,8 +109,8 @@ ReturnValue_t TmFunnel::initialize() {
|
||||
return SystemObject::initialize();
|
||||
}
|
||||
|
||||
AcceptsTelemetryIF* storageTarget =
|
||||
objectManager->get<AcceptsTelemetryIF>(storageDestination);
|
||||
AcceptsTelemetryIF* storageTarget = ObjectManager::instance()->
|
||||
get<AcceptsTelemetryIF>(storageDestination);
|
||||
if(storageTarget != nullptr) {
|
||||
storageQueue->setDefaultDestination(
|
||||
storageTarget->getReportReceptionQueue());
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "FsfwExampleTask.h"
|
||||
#include <OBSWConfig.h>
|
||||
#include <commonSystemObjects.h>
|
||||
#include <objects/systemObjectList.h>
|
||||
#include "OBSWConfig.h"
|
||||
#include "commonSystemObjects.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
@ -83,8 +84,7 @@ object_id_t FsfwExampleTask::getSender() {
|
||||
ReturnValue_t FsfwExampleTask::initialize() {
|
||||
// Get the dataset of the sender. Will be cached for later checks.
|
||||
object_id_t sender = getSender();
|
||||
HasLocalDataPoolIF* senderIF =
|
||||
objectManager->get<HasLocalDataPoolIF>(sender);
|
||||
HasLocalDataPoolIF* senderIF = ObjectManager::instance()->get<HasLocalDataPoolIF>(sender);
|
||||
if(senderIF == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "FsfwDemoTask::initialize: Sender object invalid!" << std::endl;
|
||||
@ -163,7 +163,7 @@ ReturnValue_t FsfwExampleTask::performMonitoringDemo() {
|
||||
|
||||
ReturnValue_t FsfwExampleTask::performSendOperation() {
|
||||
object_id_t nextRecipient = getNextRecipient();
|
||||
FsfwExampleTask* target = objectManager->get<FsfwExampleTask>(nextRecipient);
|
||||
FsfwExampleTask* target = ObjectManager::instance()->get<FsfwExampleTask>(nextRecipient);
|
||||
if (target == nullptr) {
|
||||
/* Configuration error */
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "TestTask.h"
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
bool TestTask::oneShotAction = true;
|
||||
@ -12,7 +12,7 @@ TestTask::TestTask(object_id_t objectId, bool periodicPrintout):
|
||||
if(testLock == nullptr) {
|
||||
testLock = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
}
|
||||
|
||||
TestTask::~TestTask() {
|
||||
|
Reference in New Issue
Block a user