fix make for a21, PIDs are always ints, linter things

This commit is contained in:
Niklas Gollenstede
2026-01-05 10:41:27 +01:00
parent 7ae806fa01
commit 598f97cd78
16 changed files with 155 additions and 104 deletions

View File

@@ -25,18 +25,22 @@ class Queue {
/// Function pointer to the get_link function, called whenever the
/// next pointer array is referenced
const NextFunc get_link = default_get_link;
/// head points to the first element (the one returned on first dequeue).
/// Can be nullptr if the queue is empty.
/// `head` points to the first element (the one returned on first dequeue).
/// Can be `nullptr` if the queue is empty.
T* head = nullptr;
/// tail points to the last element (the one last added).
/// Is only valid if head != nullptr
/// `tail` points to the last element (the one last added).
/// Is only valid if `head != nullptr`.
T* tail = nullptr;
// Prevent copies and assignments
Queue(const Queue&) = delete;
Queue(Queue&&) = delete;
Queue& operator=(const Queue&) = delete;
Queue& operator=(Queue&&) = delete;
public:
~Queue() = default;
/*! \brief Minimal forward iterator
* You can use this iterator to iterate the queue like a normal STL
* container. It only supports forward iteration, since the queue is single
@@ -44,11 +48,11 @@ class Queue {
*/
class Iterator {
private:
Queue<T>& queue;
Queue<T>* queue;
T* current;
friend class Queue<T>;
Iterator(Queue<T>& queue, T* current)
: queue(queue), current(current) {}
: queue(&queue), current(current) {}
public:
Iterator operator+(unsigned num) {
@@ -57,21 +61,21 @@ class Queue {
}
T* temp = current;
while (num--) {
temp = queue.next(*temp);
temp = queue->next(*temp);
}
return Iterator(queue, temp);
return Iterator(*queue, temp);
}
// pre increment
Iterator& operator++() {
current = queue.next(*current);
current = queue->next(*current);
return *this;
}
// post increment
Iterator operator++(int) {
auto temp = Iterator(queue, current);
current = queue.next(*current);
current = queue->next(*current);
return temp;
}
@@ -84,8 +88,6 @@ class Queue {
bool operator!=(const Iterator& other) { return !(*this == other); }
};
constexpr Queue(Queue&&) = default;
/*! \brief Constructor
* \param[in] get_link A function pointer to the get_link, i.e. a function
* which returns a pointer to the next-pointer of an
@@ -97,11 +99,10 @@ class Queue {
"get_link function pointer must not be nullptr!");
}
/*! \brief Enqueues the provided item at the end of the queue. If the
*element is already contained in the queue, false will be returned
* \param[in] item element to be appended (enqueued).
* \return false if the element already was enqueued (and nothing was done)
* or not (and it is now enqueued, then true)
/*! \brief Enqueues the provided item at the end of the queue.
* \param[in] item Element to be appended (enqueued).
* \return `false` if the element already was already in this (or a
* different) queue (and nothing was done), `true` otherwise.
*/
bool enqueue(T& item) {
T** nextptr = get_link(item);
@@ -214,7 +215,7 @@ class Queue {
T* remove(T* that) {
if (!that) return nullptr;
T* cur = head;
T** next_link;
T** next_link = nullptr;
if (head == that) {
head = *get_link(*head);
@@ -258,14 +259,14 @@ class Queue {
* the pointer.
*/
template <class T>
OutputStream& operator<<(OutputStream& os, Queue<T>& queue) {
os << "{";
OutputStream& operator<<(OutputStream& out, Queue<T>& queue) {
out << "{";
for (typename Queue<T>::Iterator it = queue.begin(); it != queue.end();
++it) {
os << *it;
out << *it;
if (it + 1 != queue.end()) {
os << ", ";
out << ", ";
}
}
return os << "}";
return out << "}";
}