Motor Driver Evaluation Kit NEVB-MTR1-t01-1.0.0
Firmware for NEVB-MTR1-KIT1 for trapezoidal control of BLDC motors using Hall-effect sensors
|
Variable size string array class. More...
#include <scpi_types.h>
Public Member Functions | |
char * | operator[] (const byte index) const |
Read-only array indexing. | |
void | Append (char *value) |
Append a new string to the array (LIFO push). | |
char * | Pop () |
Remove and return the last string (LIFO pop). | |
char * | First () const |
Get the first appended string. | |
char * | Last () const |
Get the last appended string. | |
uint8_t | Size () const |
Get the number of stored strings. | |
Public Attributes | |
bool | overflow_error = false |
Flag set when exceeding storage_size . | |
const uint8_t | storage_size = 6 |
Max number of entries allowed. | |
Protected Attributes | |
uint8_t | size_ = 0 |
Current size of the array. | |
char * | values_ [6] |
Internal storage for string pointers. | |
Variable size string array class.
This class represents a simple container for storing and managing a list of string tokens.
Strings can be added using Append
(which acts like a LIFO stack push), and removed using Pop
. The current size can be queried via Size
. Indexing is supported via operator
[]. Methods First
and Last
return the respective elements in the array.
Overflow protection is built-in, and the array size is bounded by the compile-time constant SCPI_ARRAY_SYZE
.
Definition at line 49 of file scpi_types.h.
void SCPI_String_Array::Append | ( | char * | value | ) |
Append a new string to the array (LIFO push).
Append a new string to the array.
Acts like a LIFO stack push. If the array is full, sets overflow_error
.
value | Pointer to the null-terminated string to append. |
Definition at line 55 of file scpi_types.cpp.
char * SCPI_String_Array::First | ( | ) | const |
Get the first appended string.
Get the first element in the array.
Definition at line 84 of file scpi_types.cpp.
char * SCPI_String_Array::Last | ( | ) | const |
Get the last appended string.
Get the last element in the array.
Definition at line 96 of file scpi_types.cpp.
char * SCPI_String_Array::operator[] | ( | const byte | index | ) | const |
Read-only array indexing.
Indexing operator.
Provides array-like access to internal values.
index | Index of the element to retrieve. |
Definition at line 41 of file scpi_types.cpp.
char * SCPI_String_Array::Pop | ( | ) |
Remove and return the last string (LIFO pop).
Pop the last string from the array.
Acts like a LIFO stack pop. Removes and returns the last inserted string.
Definition at line 71 of file scpi_types.cpp.
uint8_t SCPI_String_Array::Size | ( | ) | const |
Get the number of stored strings.
Get the current number of strings in the array.
Definition at line 108 of file scpi_types.cpp.
bool SCPI_String_Array::overflow_error = false |
Flag set when exceeding storage_size
.
Definition at line 58 of file scpi_types.h.
|
protected |
Current size of the array.
Definition at line 61 of file scpi_types.h.
const uint8_t SCPI_String_Array::storage_size = 6 |
Max number of entries allowed.
Definition at line 59 of file scpi_types.h.
|
protected |
Internal storage for string pointers.
Definition at line 62 of file scpi_types.h.