Skip to content
Snippets Groups Projects
Commit 66d2e64b authored by m.marn's avatar m.marn Committed by al.schwinn
Browse files

Add setup and cleanup.

parent 3d0d285f
No related branches found
No related tags found
1 merge request!64Add initial version of the integration testing class
......@@ -6,6 +6,8 @@
#include <AllTypesFESA/GeneratedCode/ServiceLocator.h>
#include <fesa-core/Core/AbstractEvent.h>
#include <AllTypesFESA/Common/AllTypesFESA.h>
#include <cmw-log/Logger.h>
#include <string>
......@@ -30,6 +32,7 @@ RTDeviceClass::RTDeviceClass () :
RTDeviceClass::~RTDeviceClass()
{
AllTypesFESA::cleanup();
}
RTDeviceClass* RTDeviceClass::getInstance()
......@@ -54,23 +57,24 @@ void RTDeviceClass::releaseInstance()
// You can write code that initializes devices in the loop below.
void RTDeviceClass::specificInit()
{
const Devices& deviceCol = AllTypesFESAServiceLocator_->getDeviceCollection();
for (Devices::const_iterator it = deviceCol.begin(); it != deviceCol.end(); ++it)
try
{
try
{
Device* device = *it;
static_cast<void>(device); // This line prevents an "unused variable" warning, it can be removed safely.
// Write here some code to initialize devices
}
catch (const fesa::FesaException& exception)
if (!AllTypesFESA::isInitialized())
{
LOG_ERROR_IF(logger, exception.getMessage());
// Re-throwing the exception prevents the process from starting up.
throw;
AllTypesFESA::setup(this->AllTypesFESAServiceLocator_);
}
}
}
catch(std::exception& ex)
{
// required to trace failures on logstash.acc.gsi.de
LOG_ERROR_IF(logger, ex.what());
throw;
}
catch(...)
{
LOG_ERROR_IF(logger, "Unexpected error. Please notify support");
throw;
}
}
void RTDeviceClass::specificShutDown()
......
......@@ -49,23 +49,7 @@ StatusUpdateAction::~StatusUpdateAction()
// of this real time action is there.
void StatusUpdateAction::execute(fesa::RTEvent* pEvt)
{
const fesa::MultiplexingContext* context = pEvt->getMultiplexingContext();
static_cast<void>(context); // This line prevents an "unused variable" warning, it can be removed safely.
const Devices& devices = getFilteredDeviceCollection(pEvt);
for (Devices::const_iterator it = devices.begin(); it != devices.end(); ++it)
{
try
{
Device* device = *it;
static_cast<void>(device); // This line prevents an "unused variable" warning, it can be removed safely.
// Write here some code to process devices
}
catch (const fesa::FesaException& exception)
{
LOG_ERROR_IF(logger, exception.getMessage());
}
}
// We don't need the status action, however it's left here for compliance with the FESA GSI template.
}
} // AllTypesFESA
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment