forked from Archive/PX4-Autopilot
Fixed uORB Pub/Sub templates for GCC 4.7
This commit is contained in:
parent
da9dab2799
commit
afb2c37bfc
|
@ -37,3 +37,30 @@
|
|||
*/
|
||||
|
||||
#include "Publication.hpp"
|
||||
#include "topics/vehicle_attitude.h"
|
||||
#include "topics/vehicle_local_position.h"
|
||||
#include "topics/vehicle_global_position.h"
|
||||
|
||||
namespace uORB {
|
||||
|
||||
template<class T>
|
||||
Publication<T>::Publication(
|
||||
List<PublicationBase *> * list,
|
||||
const struct orb_metadata *meta) :
|
||||
T(), // initialize data structure to zero
|
||||
PublicationBase(list, meta) {
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Publication<T>::~Publication() {}
|
||||
|
||||
template<class T>
|
||||
void * Publication<T>::getDataVoidPtr() {
|
||||
return (void *)(T *)(this);
|
||||
}
|
||||
|
||||
template class __EXPORT Publication<vehicle_attitude_s>;
|
||||
template class __EXPORT Publication<vehicle_local_position_s>;
|
||||
template class __EXPORT Publication<vehicle_global_position_s>;
|
||||
|
||||
}
|
||||
|
|
|
@ -95,13 +95,9 @@ public:
|
|||
* @param meta The uORB metadata (usually from the ORB_ID() macro)
|
||||
* for the topic.
|
||||
*/
|
||||
Publication(
|
||||
List<PublicationBase *> * list,
|
||||
const struct orb_metadata *meta) :
|
||||
T(), // initialize data structure to zero
|
||||
PublicationBase(list, meta) {
|
||||
}
|
||||
virtual ~Publication() {}
|
||||
Publication(List<PublicationBase *> * list,
|
||||
const struct orb_metadata *meta);
|
||||
virtual ~Publication();
|
||||
/*
|
||||
* XXX
|
||||
* This function gets the T struct, assuming
|
||||
|
@ -109,7 +105,7 @@ public:
|
|||
* should use dynamic cast, but doesn't
|
||||
* seem to be available
|
||||
*/
|
||||
void *getDataVoidPtr() { return (void *)(T *)(this); }
|
||||
void *getDataVoidPtr();
|
||||
};
|
||||
|
||||
} // namespace uORB
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -108,17 +108,11 @@ public:
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
const struct orb_metadata *meta, unsigned interval);
|
||||
/**
|
||||
* Deconstructor
|
||||
*/
|
||||
virtual ~Subscription() {}
|
||||
virtual ~Subscription();
|
||||
|
||||
/*
|
||||
* XXX
|
||||
|
@ -127,8 +121,8 @@ public:
|
|||
* should use dynamic cast, but doesn't
|
||||
* seem to be available
|
||||
*/
|
||||
void *getDataVoidPtr() { return (void *)(T *)(this); }
|
||||
T getData() { return T(*this); }
|
||||
void *getDataVoidPtr();
|
||||
T getData();
|
||||
};
|
||||
|
||||
} // namespace uORB
|
||||
|
|
Loading…
Reference in New Issue