diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2015-01-22 08:10:08 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2015-01-22 08:10:08 +0100 |
commit | 2af44f5995dd121a7ce2aefd3ab1c7d8dcf3fb8d (patch) | |
tree | cef66b2fa679e225effa6d44b56cbda4a53f9966 /src/platforms | |
parent | 2b103d319c8547d0d6e9ae14a6413a787051e205 (diff) | |
download | px4-firmware-2af44f5995dd121a7ce2aefd3ab1c7d8dcf3fb8d.tar.gz px4-firmware-2af44f5995dd121a7ce2aefd3ab1c7d8dcf3fb8d.tar.bz2 px4-firmware-2af44f5995dd121a7ce2aefd3ab1c7d8dcf3fb8d.zip |
multiplatform: introduce PublisherNode class for uorb for more consistency
Diffstat (limited to 'src/platforms')
-rw-r--r-- | src/platforms/px4_nodehandle.h | 6 | ||||
-rw-r--r-- | src/platforms/px4_publisher.h | 18 | ||||
-rw-r--r-- | src/platforms/px4_subscriber.h | 3 |
3 files changed, 20 insertions, 7 deletions
diff --git a/src/platforms/px4_nodehandle.h b/src/platforms/px4_nodehandle.h index 634e5e5db..8fafa168a 100644 --- a/src/platforms/px4_nodehandle.h +++ b/src/platforms/px4_nodehandle.h @@ -176,7 +176,7 @@ public: } /* Empty publications list */ - Publisher *pub = _pubs.getHead(); + PublisherNode *pub = _pubs.getHead(); count = 0; while (pub != nullptr) { @@ -185,7 +185,7 @@ public: break; } - Publisher *sib = pub->getSibling(); + PublisherNode *sib = pub->getSibling(); delete pub; pub = sib; } @@ -294,7 +294,7 @@ private: static const uint16_t kMaxSubscriptions = 100; static const uint16_t kMaxPublications = 100; List<SubscriberNode *> _subs; /**< Subcriptions of node */ - List<Publisher *> _pubs; /**< Publications of node */ + List<PublisherNode *> _pubs; /**< Publications of node */ SubscriberNode *_sub_min_interval; /**< Points to the sub wtih the smallest interval of all Subscriptions in _subs*/ }; diff --git a/src/platforms/px4_publisher.h b/src/platforms/px4_publisher.h index 911554503..7195777f5 100644 --- a/src/platforms/px4_publisher.h +++ b/src/platforms/px4_publisher.h @@ -88,9 +88,25 @@ private: ros::Publisher _ros_pub; /**< Handle to the ros publisher */ }; #else +/** + * Because we maintain a list of publishers we need a node class + */ +class __EXPORT PublisherNode : + public ListNode<PublisherNode *> +{ +public: + PublisherNode() : + ListNode() + {} + + virtual ~PublisherNode() {} + + virtual void update() = 0; +}; + class __EXPORT Publisher : public PublisherBase, - public ListNode<Publisher *> + public PublisherNode { public: diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h index 2b289771b..d03b3edee 100644 --- a/src/platforms/px4_subscriber.h +++ b/src/platforms/px4_subscriber.h @@ -154,8 +154,6 @@ protected: }; #else // Building for NuttX - - /** * Because we maintain a list of subscribers we need a node class */ @@ -181,7 +179,6 @@ protected: }; - /** * Subscriber class that is templated with the uorb subscription message type */ |