From 2af44f5995dd121a7ce2aefd3ab1c7d8dcf3fb8d Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Thu, 22 Jan 2015 08:10:08 +0100 Subject: [PATCH] multiplatform: introduce PublisherNode class for uorb for more consistency --- src/platforms/px4_nodehandle.h | 6 +++--- src/platforms/px4_publisher.h | 18 +++++++++++++++++- 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 634e5e5db6..8fafa168a2 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 _subs; /**< Subcriptions of node */ - List _pubs; /**< Publications of node */ + List _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 9115545030..7195777f5b 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 +{ +public: + PublisherNode() : + ListNode() + {} + + virtual ~PublisherNode() {} + + virtual void update() = 0; +}; + class __EXPORT Publisher : public PublisherBase, - public ListNode + public PublisherNode { public: diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h index 2b289771bb..d03b3edee7 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 */