Skip to content

Commit

Permalink
Renamed initHandle to createIOHandle to better reflect the task
Browse files Browse the repository at this point in the history
Also this allows to better distinquish from a second initHandle used for
registering handles.
  • Loading branch information
azoitl authored and MartinMelikMerkumians committed Feb 23, 2024
1 parent a5773b2 commit acb24eb
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/core/io/device/io_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void IODeviceController::run() {
}

void IODeviceController::addHandle(HandleDescriptor &paHandleDescriptor) {
IOHandle* handle = initHandle(paHandleDescriptor);
IOHandle* handle = createIOHandle(paHandleDescriptor);

if(nullptr == handle) {
DEVLOG_WARNING("[IODeviceController] Failed to initialize handle '%s'. Check initHandle method.\n", paHandleDescriptor.mId.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/core/io/device/io_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ namespace forte {
*
* @param paHandleDescriptor Descriptor of the handle
*/
virtual IOHandle* initHandle(HandleDescriptor &paHandleDescriptor) = 0;
virtual IOHandle* createIOHandle(HandleDescriptor &paHandleDescriptor) = 0;

/*! @brief Iterates over all input handles and fires an indication event in case of a change.
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/io/device/io_controller_multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ IODeviceMultiController::IODeviceMultiController(CDeviceExecution& paDeviceExecu

void IODeviceMultiController::addHandle(IODeviceController::HandleDescriptor &paHandleDescriptor) {
HandleDescriptor& desc = static_cast<HandleDescriptor&>(paHandleDescriptor);
IOHandle* handle = initHandle(desc);
IOHandle* handle = createIOHandle(desc);

if(nullptr == handle) {
DEVLOG_WARNING("[IODeviceMultiController] Failed to initialize handle '%s'. Check initHandle method.\n", desc.mId.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/core/io/device/io_controller_multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace forte {

void addHandle(IODeviceController::HandleDescriptor &paHandleDescriptor) override;

IOHandle* initHandle(IODeviceController::HandleDescriptor &paHandleDescriptor) override = 0;
IOHandle* createIOHandle(IODeviceController::HandleDescriptor &paHandleDescriptor) override = 0;

private:

Expand Down
2 changes: 1 addition & 1 deletion src/modules/PLCnext/deviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void PLCnextDeviceController::registerSlaveHandler(PLCnextSlaveHandler *slave) {
mSlaves->pushBack(slave);
}

forte::core::io::IOHandle* PLCnextDeviceController::initHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) {
forte::core::io::IOHandle* PLCnextDeviceController::createIOHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) {
HandleDescriptor& desc = static_cast<HandleDescriptor&>(paHandleDescriptor);
PLCnextSlaveHandler* slave = getSlave(desc.mSlaveIndex);

Expand Down
2 changes: 1 addition & 1 deletion src/modules/PLCnext/deviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class PLCnextDeviceController : public forte::core::io::IODeviceMultiController
protected:
const char* init() override;

forte::core::io::IOHandle* initHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) override;
forte::core::io::IOHandle* createIOHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) override;

void deInit() override;
void runLoop() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ EliteBoardDeviceController::EliteBoardDeviceController(CDeviceExecution& paDevic

EliteBoardDeviceController::~EliteBoardDeviceController() {}

EliteBoardDeviceController::IOHandle *EliteBoardDeviceController::initHandle(HandleDescriptor &paHandleDescriptor) {
EliteBoardDeviceController::IOHandle *EliteBoardDeviceController::createIOHandle(HandleDescriptor &paHandleDescriptor) {
auto desc = static_cast<EliteBoardHandleDescriptor &>(paHandleDescriptor);
IOHandle *handle = new IOHandleGPIO(this, desc.mGPIO_Port, desc.mPin);
return static_cast<IOHandle *>(handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class EliteBoardDeviceController : public forte::core::io::IODeviceController {
};


IOHandle* initHandle(HandleDescriptor& paHandleDescriptor);
IOHandle* createIOHandle(HandleDescriptor& paHandleDescriptor);

void setConfig(Config *paConfig) {}
const char *init() {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/eliteboard/types/Port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void FORTE_Port::register_handles() {
EliteBoardDeviceController::EliteBoardHandleDescriptor descr(id->getValue(), port, 1 << i);
auto ctrl = getExtEvHandler<EliteBoardDeviceController>(*this);

IOMapper::getInstance().registerHandle(id->getValue(), ctrl.initHandle(descr));
IOMapper::getInstance().registerHandle(id->getValue(), ctrl.createIOHandle(descr));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/embrick/handler/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void EmbrickBusHandler::deInit() {
delete mSlaveSelect;
}

forte::core::io::IOHandle* EmbrickBusHandler::initHandle(
forte::core::io::IOHandle* EmbrickBusHandler::createIOHandle(
forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) {
HandleDescriptor &desc = static_cast<HandleDescriptor&>(paHandleDescriptor);

Expand Down
2 changes: 1 addition & 1 deletion src/modules/embrick/handler/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class EmbrickBusHandler : public forte::core::io::IODeviceMultiController {
const char* init();
void deInit();

forte::core::io::IOHandle* initHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor);
forte::core::io::IOHandle* createIOHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor);

void prepareLoop();
virtual void runLoop();
Expand Down
2 changes: 1 addition & 1 deletion src/modules/wagokbus/modular/wagoDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const char* WagoDeviceController::init() {
return 0;
}

forte::core::io::IOHandle* WagoDeviceController::initHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) {
forte::core::io::IOHandle* WagoDeviceController::createIOHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) {
WagoHandleDescriptor &desc = *static_cast<WagoHandleDescriptor&>(paHandleDescriptor);

TForteUInt32 outputOffset;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/wagokbus/modular/wagoDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class WagoDeviceController : public forte::core::io::IODeviceMultiController {
protected:
const char* init();

forte::core::io::IOHandle* initHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) override;
forte::core::io::IOHandle* createIOHandle(forte::core::io::IODeviceController::HandleDescriptor &paHandleDescriptor) override;

void deInit() override;

Expand Down

0 comments on commit acb24eb

Please sign in to comment.