Skip to content
Snippets Groups Projects
Commit 2551f594 authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Add SensorDeviceTemplate (it automatically adds a member value and implements getSensorValue)

parent cb0f81ea
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,18 @@ namespace armarx
virtual void rtReadSensorValues(const IceUtil::Time& sensorValuesTimestamp, const IceUtil::Time& timeSinceLastIteration);
};
template<class SensorValueType>
class SensorDeviceTemplate : public virtual SensorDevice
{
static_assert(std::is_base_of<SensorValueBase, SensorValueType>::value, "SensorValueType has to inherit SensorValueBase");
public:
using SensorDevice::SensorDevice;
virtual const SensorValueType* getSensorValue() const final;
SensorValueType sensorValue;
};
}
//inline functions
......@@ -73,6 +85,12 @@ namespace armarx
}
inline void SensorDevice::rtReadSensorValues(const IceUtil::Time& sensorValuesTimestamp, const IceUtil::Time& timeSinceLastIteration) {}
template<class SensorValueType>
inline const SensorValueType* SensorDeviceTemplate<SensorValueType>::getSensorValue() const
{
return &sensorValue;
}
}
#endif
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