17 #ifndef GZ_SENSORS_SENSORFACTORY_HH_
18 #define GZ_SENSORS_SENSORFACTORY_HH_
22 #include <type_traits>
25 #include <gz/common/Console.hh>
26 #include <gz/utils/SuppressWarning.hh>
28 #include <gz/sensors/config.hh>
29 #include <gz/sensors/Export.hh>
38 inline namespace GZ_SENSORS_VERSION_NAMESPACE {
40 class SensorFactoryPrivate;
67 public:
template<
typename SensorType>
70 auto sensor = std::make_unique<SensorType>();
72 if (
nullptr == sensor)
74 gzerr <<
"Failed to create sensor [" << _sdf.Name()
75 <<
"] of type[" << _sdf.TypeStr() <<
"]" <<
std::endl;
79 if (!sensor->Load(_sdf))
81 gzerr <<
"Failed to load sensor [" << _sdf.Name()
82 <<
"] of type[" << _sdf.TypeStr() <<
"]" <<
std::endl;
88 gzerr <<
"Failed to initialize sensor [" << _sdf.Name()
89 <<
"] of type[" << _sdf.TypeStr() <<
"]" <<
std::endl;
102 public:
template<
typename SensorType>
107 gzerr <<
"Failed to create sensor, received null SDF "
112 auto sensor = std::make_unique<SensorType>();
117 if (
nullptr == sensor)
119 gzerr <<
"Failed to create sensor [" << name
120 <<
"] of type[" << type <<
"]" <<
std::endl;
124 if (!sensor->Load(_sdf))
126 gzerr <<
"Failed to load sensor [" << name
127 <<
"] of type[" << type <<
"]" <<
std::endl;
133 gzerr <<
"Failed to initialize sensor [" << name
134 <<
"] of type[" << type <<
"]" <<
std::endl;
141 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
144 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING