mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 05:03:35 +08:00
multiplatform: introduce PublisherNode class for uorb for more consistency
This commit is contained in:
@@ -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*/
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user