![]() |
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Intrusive doubly-linked list node. Embed this as a base class in any object (T) that needs to participate in a DListHead list. More...
#include <stk_linked_list.h>
Public Types | |
| enum | { DLEntryTag = 1 } |
| A tag for type-safe casts done by CastListEntryToParent. More... | |
| typedef DListEntry< T, TClosedLoop > | DLEntryType |
| Convenience alias for this entry type. Used to avoid repeating the full template spelling. | |
| typedef DListHead< T, TClosedLoop > | DLHeadType |
| Convenience alias for the corresponding list head type. | |
Public Member Functions | |
| DListEntry () | |
| Construct an unlinked entry. All pointers initialized to NULL. | |
| DLHeadType * | GetHead () |
| Get the list head this entry currently belongs to. | |
| const DLHeadType * | GetHead () const |
| Get the list head this entry currently belongs to. | |
| DLEntryType * | GetNext () |
| Get the next entry in the list. | |
| const DLEntryType * | GetNext () const |
| Get the next entry in the list. | |
| DLEntryType * | GetPrev () |
| Get the previous entry in the list. | |
| const DLEntryType * | GetPrev () const |
| Get the previous entry in the list. | |
| bool | IsLinked () const |
| Check whether this entry is currently a member of any list. | |
| operator T* () | |
| Implicit conversion to a mutable pointer to the host object (T). | |
| operator const T * () const | |
| Implicit conversion to a const pointer to the host object (T). | |
Protected Member Functions | |
| ~DListEntry ()=default | |
| Protected non-virtual destructor. | |
Private Member Functions | |
| void | Link (DLHeadType *head, DLEntryType *next, DLEntryType *prev) |
| Wire this entry into a list between prev and next. | |
| void | Unlink () |
| Remove this entry from its current list. | |
Private Attributes | |
| DLHeadType * | m_head |
Owning list head, or NULL when the entry is not linked. | |
| DLEntryType * | m_next |
Next entry in the list, or NULL (open list boundary) / first entry (closed loop). | |
| DLEntryType * | m_prev |
Previous entry in the list, or NULL (open list boundary) / last entry (closed loop). | |
Friends | |
| class | DListHead< T, TClosedLoop > |
Intrusive doubly-linked list node. Embed this as a base class in any object (T) that needs to participate in a DListHead list.
| T | The host class that derives from DListEntry. Used by the implicit conversion operators to safely downcast the node pointer back to the host object pointer without a dynamic_cast. |
| TClosedLoop | When true the list is kept circular (last->next == first and first->prev == last). When false the list is linear (boundary pointers are NULL). Must match the TClosedLoop of the DListHead this entry will be inserted into. |
m_head == NULL. Use IsLinked() to test membership before calling any DListHead operation. Definition at line 57 of file stk_linked_list.h.
| typedef DListEntry<T, TClosedLoop> stk::util::DListEntry< T, TClosedLoop >::DLEntryType |
Convenience alias for this entry type. Used to avoid repeating the full template spelling.
Definition at line 75 of file stk_linked_list.h.
| typedef DListHead<T, TClosedLoop> stk::util::DListEntry< T, TClosedLoop >::DLHeadType |
Convenience alias for the corresponding list head type.
Definition at line 80 of file stk_linked_list.h.
| anonymous enum |
A tag for type-safe casts done by CastListEntryToParent.
| Enumerator | |
|---|---|
| DLEntryTag | |
Definition at line 70 of file stk_linked_list.h.
|
inlineexplicit |
Construct an unlinked entry. All pointers initialized to NULL.
Definition at line 64 of file stk_linked_list.h.
|
protecteddefault |
Protected non-virtual destructor.
|
inline |
Get the list head this entry currently belongs to.
NULL if the entry is not linked. Definition at line 85 of file stk_linked_list.h.
References m_head.
Referenced by stk::SwitchStrategyEDF::AddTask(), stk::SwitchStrategyFixedPriority< 32 >::AddTask(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::AddTask(), stk::SwitchStrategyRoundRobin::AddTask(), stk::ISyncObject::AddWaitObject(), IsLinked(), stk::SwitchStrategyEDF::OnTaskSleep(), stk::SwitchStrategyFixedPriority< 32 >::OnTaskSleep(), stk::SwitchStrategyRoundRobin::OnTaskSleep(), stk::SwitchStrategySmoothWeightedRoundRobin::OnTaskSleep(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnTaskWait(), stk::SwitchStrategyEDF::OnTaskWake(), stk::SwitchStrategyFixedPriority< 32 >::OnTaskWake(), stk::SwitchStrategyRoundRobin::OnTaskWake(), stk::SwitchStrategySmoothWeightedRoundRobin::OnTaskWake(), stk::SwitchStrategyFixedPriority< 32 >::OnTaskWeightChange(), stk::time::TimerHost::ProcessCommands(), stk::SwitchStrategyEDF::RemoveTask(), stk::SwitchStrategyFixedPriority< 32 >::RemoveTask(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::RemoveTask(), stk::SwitchStrategyRoundRobin::RemoveTask(), stk::SwitchStrategySmoothWeightedRoundRobin::RemoveTask(), stk::ISyncObject::RemoveWaitObject(), and stk::util::DListHead< T, TClosedLoop >::Unlink().
|
inline |
Get the list head this entry currently belongs to.
NULL if the entry is not linked. Definition at line 90 of file stk_linked_list.h.
References m_head.
|
inline |
Get the next entry in the list.
NULL if this is the last entry (open list) or the first entry (closed loop, where next wraps to first). TClosedLoop == true) this pointer is never NULL when the entry is linked. Definition at line 98 of file stk_linked_list.h.
References m_next.
Referenced by stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::AddTask(), stk::ISyncObject::FindWeightHigherThan(), stk::SwitchStrategyEDF::GetNext(), stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::GetNext(), stk::SwitchStrategyRoundRobin::GetNext(), stk::SwitchStrategySmoothWeightedRoundRobin::GetNext(), stk::SchedulabilityCheck::IsSchedulableWCRT(), stk::util::DListHead< T, TClosedLoop >::Link(), stk::SwitchStrategyFixedPriority< 32 >::RemoveActive(), stk::SwitchStrategyRoundRobin::RemoveActive(), stk::ISyncObject::Tick(), stk::util::DListHead< T, TClosedLoop >::Unlink(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::UpdateSyncObjects(), and stk::time::TimerHost::UpdateTime().
|
inline |
Get the next entry in the list.
NULL if this is the last entry (open list) or the first entry (closed loop, where next wraps to first). TClosedLoop == true) this pointer is never NULL when the entry is linked. Definition at line 106 of file stk_linked_list.h.
References m_next.
|
inline |
Get the previous entry in the list.
NULL if this is the first entry (open list) or the last entry (closed loop, where prev wraps to last). TClosedLoop == true) this pointer is never NULL when the entry is linked. Definition at line 114 of file stk_linked_list.h.
References m_prev.
Referenced by stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >::AddTask(), stk::util::DListHead< T, TClosedLoop >::Link(), stk::SwitchStrategyFixedPriority< 32 >::RemoveActive(), stk::SwitchStrategyRoundRobin::RemoveActive(), and stk::util::DListHead< T, TClosedLoop >::Unlink().
|
inline |
Get the previous entry in the list.
NULL if this is the first entry (open list) or the last entry (closed loop, where prev wraps to last). TClosedLoop == true) this pointer is never NULL when the entry is linked. Definition at line 122 of file stk_linked_list.h.
References m_prev.
|
inline |
Check whether this entry is currently a member of any list.
true if linked (m_head != NULL); false otherwise. Definition at line 127 of file stk_linked_list.h.
References GetHead().
Referenced by stk::util::DListHead< T, TClosedLoop >::Link(), stk::time::TimerHost::ProcessCommands(), and stk::util::DListHead< T, TClosedLoop >::Unlink().
|
inlineprivate |
Wire this entry into a list between prev and next.
| [in] | head | The owning DListHead. Stored as a back-pointer for IsLinked() and ownership checks. |
| [in] | next | The entry that will follow this one, or NULL if this becomes the last entry. |
| [in] | prev | The entry that will precede this one, or NULL if this becomes the first entry. |
Definition at line 162 of file stk_linked_list.h.
References m_head, m_next, and m_prev.
Referenced by stk::util::DListHead< T, TClosedLoop >::Link().
|
inline |
Implicit conversion to a const pointer to the host object (T).
Definition at line 141 of file stk_linked_list.h.
|
inline |
Implicit conversion to a mutable pointer to the host object (T).
Definition at line 134 of file stk_linked_list.h.
|
inlineprivate |
Remove this entry from its current list.
Definition at line 186 of file stk_linked_list.h.
References m_head, m_next, and m_prev.
Referenced by stk::util::DListHead< T, TClosedLoop >::Unlink().
|
friend |
Definition at line 1 of file stk_linked_list.h.
|
private |
Owning list head, or NULL when the entry is not linked.
Definition at line 203 of file stk_linked_list.h.
Referenced by DListEntry(), GetHead(), GetHead(), Link(), and Unlink().
|
private |
Next entry in the list, or NULL (open list boundary) / first entry (closed loop).
Definition at line 204 of file stk_linked_list.h.
Referenced by DListEntry(), GetNext(), GetNext(), Link(), and Unlink().
|
private |
Previous entry in the list, or NULL (open list boundary) / last entry (closed loop).
Definition at line 205 of file stk_linked_list.h.
Referenced by DListEntry(), GetPrev(), GetPrev(), Link(), and Unlink().