mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 14:53:35 +08:00
new IntrusiveSortedList container used for uORB, WorkQueues, and WorkItems
- new intrusive linked list container (c++ template) that sorts on insertion - primarily for convenience inspecting things in the system like uORB or WorkQueues - uorb status or top sorted alphabetically - work_queue status threads sorted by priority, then items sorted alphabetically within each
This commit is contained in:
@@ -50,7 +50,7 @@ class Manager;
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <containers/List.hpp>
|
||||
#include <containers/IntrusiveSortedList.hpp>
|
||||
#include <px4_platform_common/atomic_bitset.h>
|
||||
|
||||
using px4::AtomicBitset;
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
* Continuously print statistics, like the unix top command for processes.
|
||||
* Exited when the user presses the enter key.
|
||||
* @param topic_filter list of topic filters: if set, each string can be a substring for topics to match.
|
||||
* Or it can be '-a', which means to print all topics instead of only currently publishing ones.
|
||||
* Or it can be '-a', which means to print all topics instead of only ones currently publishing with subscribers.
|
||||
* @param num_filters
|
||||
*/
|
||||
void showTop(char **topic_filter, int num_filters);
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
*/
|
||||
uORB::DeviceNode *getDeviceNodeLocked(const struct orb_metadata *meta, const uint8_t instance);
|
||||
|
||||
List<uORB::DeviceNode *> _node_list;
|
||||
IntrusiveSortedList<uORB::DeviceNode *> _node_list;
|
||||
AtomicBitset<ORB_TOPICS_COUNT> _node_exists[ORB_MULTI_MAX_INSTANCES];
|
||||
|
||||
px4_sem_t _lock; /**< lock to protect access to all class members (also for derived classes) */
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <lib/cdev/CDev.hpp>
|
||||
|
||||
#include <containers/IntrusiveSortedList.hpp>
|
||||
#include <containers/List.hpp>
|
||||
#include <px4_platform_common/atomic.h>
|
||||
|
||||
@@ -52,7 +53,7 @@ class SubscriptionCallback;
|
||||
/**
|
||||
* Per-object device instance.
|
||||
*/
|
||||
class uORB::DeviceNode : public cdev::CDev, public ListNode<uORB::DeviceNode *>
|
||||
class uORB::DeviceNode : public cdev::CDev, public IntrusiveSortedListNode<uORB::DeviceNode *>
|
||||
{
|
||||
public:
|
||||
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path, ORB_PRIO priority,
|
||||
@@ -65,6 +66,8 @@ public:
|
||||
DeviceNode(DeviceNode &&) = delete;
|
||||
DeviceNode &operator=(DeviceNode &&) = delete;
|
||||
|
||||
bool operator<=(const DeviceNode &rhs) const { return (strcmp(get_devname(), rhs.get_devname()) <= 0); }
|
||||
|
||||
/**
|
||||
* Method to create a subscriber instance and return the struct
|
||||
* pointing to the subscriber as a file pointer.
|
||||
|
||||
Reference in New Issue
Block a user