mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-26 10:50:34 +08:00
Fixed uORB Pub/Sub templates for GCC 4.7
This commit is contained in:
@@ -37,6 +37,10 @@
|
||||
*/
|
||||
|
||||
#include "Subscription.hpp"
|
||||
#include "topics/parameter_update.h"
|
||||
#include "topics/actuator_controls.h"
|
||||
#include "topics/vehicle_gps_position.h"
|
||||
#include "topics/sensor_combined.h"
|
||||
|
||||
namespace uORB
|
||||
{
|
||||
@@ -48,4 +52,32 @@ bool __EXPORT SubscriptionBase::updated()
|
||||
return isUpdated;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Subscription<T>::Subscription(
|
||||
List<SubscriptionBase *> * list,
|
||||
const struct orb_metadata *meta, unsigned interval) :
|
||||
T(), // initialize data structure to zero
|
||||
SubscriptionBase(list, meta) {
|
||||
setHandle(orb_subscribe(getMeta()));
|
||||
orb_set_interval(getHandle(), interval);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Subscription<T>::~Subscription() {}
|
||||
|
||||
template<class T>
|
||||
void * Subscription<T>::getDataVoidPtr() {
|
||||
return (void *)(T *)(this);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T Subscription<T>::getData() {
|
||||
return T(*this);
|
||||
}
|
||||
|
||||
template class __EXPORT Subscription<parameter_update_s>;
|
||||
template class __EXPORT Subscription<actuator_controls_s>;
|
||||
template class __EXPORT Subscription<vehicle_gps_position_s>;
|
||||
template class __EXPORT Subscription<sensor_combined_s>;
|
||||
|
||||
} // namespace uORB
|
||||
|
||||
Reference in New Issue
Block a user