multiplatform: introduce PublisherNode class for uorb for more consistency

This commit is contained in:
Thomas Gubler
2015-01-22 08:10:08 +01:00
parent 2b103d319c
commit 2af44f5995
3 changed files with 20 additions and 7 deletions
+3 -3
View File
@@ -176,7 +176,7 @@ public:
} }
/* Empty publications list */ /* Empty publications list */
Publisher *pub = _pubs.getHead(); PublisherNode *pub = _pubs.getHead();
count = 0; count = 0;
while (pub != nullptr) { while (pub != nullptr) {
@@ -185,7 +185,7 @@ public:
break; break;
} }
Publisher *sib = pub->getSibling(); PublisherNode *sib = pub->getSibling();
delete pub; delete pub;
pub = sib; pub = sib;
} }
@@ -294,7 +294,7 @@ private:
static const uint16_t kMaxSubscriptions = 100; static const uint16_t kMaxSubscriptions = 100;
static const uint16_t kMaxPublications = 100; static const uint16_t kMaxPublications = 100;
List<SubscriberNode *> _subs; /**< Subcriptions of node */ 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 SubscriberNode *_sub_min_interval; /**< Points to the sub wtih the smallest interval
of all Subscriptions in _subs*/ of all Subscriptions in _subs*/
}; };
+17 -1
View File
@@ -88,9 +88,25 @@ private:
ros::Publisher _ros_pub; /**< Handle to the ros publisher */ ros::Publisher _ros_pub; /**< Handle to the ros publisher */
}; };
#else #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 : class __EXPORT Publisher :
public PublisherBase, public PublisherBase,
public ListNode<Publisher *> public PublisherNode
{ {
public: public:
-3
View File
@@ -154,8 +154,6 @@ protected:
}; };
#else // Building for NuttX #else // Building for NuttX
/** /**
* Because we maintain a list of subscribers we need a node class * 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 * Subscriber class that is templated with the uorb subscription message type
*/ */