SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::util::DListCast Class Reference

Helper for casting list entries to concrete (parent) types. More...

#include <stk_linked_list.h>

Static Public Member Functions

template<typename TTargetType, typename TSourceType>
static __stk_forceinline TTargetType * ListEntryToParent (TSourceType *const lentry)
 Safely casts an intrusive list entry to its concrete parent container object type.

Detailed Description

Helper for casting list entries to concrete (parent) types.

Definition at line 458 of file stk_linked_list.h.

Member Function Documentation

◆ ListEntryToParent()

template<typename TTargetType, typename TSourceType>
__stk_forceinline TTargetType * stk::util::DListCast::ListEntryToParent ( TSourceType *const lentry)
inlinestatic

Safely casts an intrusive list entry to its concrete parent container object type.

Parameters
[in]lentryPointer to the intrusive list entry. Must be a valid pointer or nullptr.
Returns
A pointer converted to the target parent container type TargetType, or nullptr if the input entry was nullptr.

Definition at line 465 of file stk_linked_list.h.

466 {
467 STK_STATIC_ASSERT_N(TT, TTargetType::DLEntryTag == 1); // TTargetType must inherit DLEntryType
468 STK_STATIC_ASSERT_N(ST, TSourceType::DLEntryTag == 1); // TSourceType must inherit DLEntryType
469
470 return static_cast<TTargetType *>(lentry);
471 }
#define STK_STATIC_ASSERT_N(NAME, X)
Compile-time assertion with a user-defined name suffix.
Definition stk_defs.h:545

References __stk_forceinline, and STK_STATIC_ASSERT_N.

Referenced by stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::FetchNextEvent(), stk::ISyncObject::FindWeightHigherThan(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::OnStart(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::StateSleep(), stk::ISyncObject::Tick(), stk::sync::Mutex::Unlock(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::UpdateSyncObjects(), stk::time::TimerHost::UpdateTime(), stk::ISyncObject::WakeAll(), and stk::ISyncObject::WakeOne().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: