Improve macro for registration into factories
So far, this macro is as follows
#define WOLF_REGISTER_SENSOR_AUTO(SensorType) \
namespace{ const bool WOLF_UNUSED SensorType##AutoConfRegistered = \
AutoConfFactorySensor::registerCreator(#SensorType, SensorType::create); } \
and it must be used as
// Register in the FactorySensor
#include "core/sensor/factory_sensor.h"
namespace wolf {
WOLF_REGISTER_SENSOR(SensorDiffDrive);
WOLF_REGISTER_SENSOR_AUTO(SensorDiffDrive);
} // namespace wolf
I suggest we add all the namespace stuff and includes in the macro, so that registration would only require this:
// Register in the FactorySensor
WOLF_REGISTER_SENSOR(SensorDiffDrive);
WOLF_REGISTER_SENSOR_AUTO(SensorDiffDrive);
The macro should be then as the one below:
// Register in the FactorySensor
#define WOLF_REGISTER_SENSOR_AUTO(SensorType) \
#include "core/sensor/factory_sensor.h" \
namespace wolf { \
namespace{ const bool WOLF_UNUSED SensorType##AutoConfRegistered = \
AutoConfFactorySensor::registerCreator(#SensorType, SensorType::create); } \
} // namespace wolf
Edited by Joan Solà Ortega