![]() |
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Lightweight, non-owning view over a contiguous sequence of elements. More...
#include <stk_common.h>
Public Types | |
| typedef T | value_type |
Public Member Functions | |
| ArrayView () | |
| Construct an empty ArrayView with a null pointer and zero size. | |
| ArrayView (T *ptr, size_t size) | |
| Construct an ArrayView from a raw pointer and size. | |
| T & | operator[] (size_t index) const |
| Subscript operator for element access. | |
| T * | GetPtr () |
| Get pointer to the beginning of elements in the view. | |
| const T * | GetPtr () const |
| Get constant pointer to the beginning of elements in the view. | |
| size_t | GetSize () const |
| Get number of elements in the view. | |
Private Member Functions | |
| T & | UncheckedAt (size_t index) const |
| Deviation MISRA-CPP-2008-5-0-15 \reason Array indexing on a base pointer is required for a dynamic-size non-owning view. The pointer and size are externally supplied. Bounds are enforced by the public API (STK_ASSERT / operator[]). | |
Private Attributes | |
| T * | m_ptr |
| Pointer to the underlying memory block. | |
| size_t | m_size |
| Total number of elements in the view. | |
Lightweight, non-owning view over a contiguous sequence of elements.
Usage example:
Definition at line 253 of file stk_common.h.
| typedef T stk::ArrayView< T >::value_type |
Definition at line 256 of file stk_common.h.
|
inline |
Construct an empty ArrayView with a null pointer and zero size.
Definition at line 260 of file stk_common.h.
|
inline |
Construct an ArrayView from a raw pointer and size.
| [in] | ptr | Pointer to the first element of the contiguous memory block. |
| [in] | size | Number of elements available in the memory block. |
Definition at line 267 of file stk_common.h.
|
inline |
Get pointer to the beginning of elements in the view.
Definition at line 284 of file stk_common.h.
References m_ptr.
|
inline |
Get constant pointer to the beginning of elements in the view.
Definition at line 289 of file stk_common.h.
References m_ptr.
|
inline |
Get number of elements in the view.
Definition at line 294 of file stk_common.h.
References m_size.
Referenced by stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::EnumerateKernelTasks(), stk::Kernel< stk::KERNEL_DYNAMIC|stk::KERNEL_SYNC|stk::KERNEL_TICKLESS,(16U), stk::SwitchStrategyFP32, stk::PlatformDefault >::EnumerateTasks(), stk::IStackMemory::GetStackSpace(), and stk::PlatformContext::InitStackMemory().
|
inline |
Subscript operator for element access.
| [in] | index | Element index to access. |
Definition at line 275 of file stk_common.h.
References m_size, STK_ASSERT, and UncheckedAt().
|
inlineprivate |
Deviation MISRA-CPP-2008-5-0-15 \reason Array indexing on a base pointer is required for a dynamic-size non-owning view. The pointer and size are externally supplied. Bounds are enforced by the public API (STK_ASSERT / operator[]).
Definition at line 302 of file stk_common.h.
References __stk_forceinline, and m_ptr.
Referenced by operator[]().
|
private |
Pointer to the underlying memory block.
Definition at line 307 of file stk_common.h.
Referenced by ArrayView(), ArrayView(), GetPtr(), GetPtr(), and UncheckedAt().
|
private |
Total number of elements in the view.
Definition at line 308 of file stk_common.h.
Referenced by ArrayView(), ArrayView(), GetSize(), and operator[]().