Collaboration diagram for Arrays:
Macros | |
#define | DECLARE_FSTR_ARRAY(name, ElementType) DECLARE_FSTR_OBJECT(name, FSTR::Array<ElementType>) |
Declare a global Array& reference. More... | |
#define | DEFINE_FSTR_ARRAY(name, ElementType, ...) |
Define an Array Object with global reference. More... | |
#define | DEFINE_FSTR_ARRAY_LOCAL(name, ElementType, ...) |
Like DEFINE_FSTR_ARRAY except reference is declared static constexpr. More... | |
#define | DEFINE_FSTR_ARRAY_DATA(name, ElementType, ...) |
Define an Array data structure. More... | |
#define | LOAD_FSTR_ARRAY(name, array) |
Load an Array object into a named local (stack) buffer. More... | |
#define | FSTR_ARRAY_ARRAY(name, ElementType, ...) |
Define an Array and load it into a named buffer on the stack. More... | |
#define | IMPORT_FSTR_ARRAY(name, ElementType, file) IMPORT_FSTR_OBJECT(name, FSTR::Array<ElementType>, file) |
Define an Array containing data from an external file. More... | |
#define | IMPORT_FSTR_ARRAY_LOCAL(name, ElementType, file) IMPORT_FSTR_OBJECT_LOCAL(name, FSTR::Array<ElementType>, file) |
Like IMPORT_FSTR_ARRAY except reference is declared static constexpr. More... | |
Detailed Description
Macro Definition Documentation
◆ DECLARE_FSTR_ARRAY
#define DECLARE_FSTR_ARRAY | ( | name, | |
ElementType | |||
) | DECLARE_FSTR_OBJECT(name, FSTR::Array<ElementType>) |
Declare a global Array& reference.
- Parameters
-
name ElementType
- Note
- Use
DEFINE_FSTR_ARRAY
to instantiate the global Object
◆ DEFINE_FSTR_ARRAY
#define DEFINE_FSTR_ARRAY | ( | name, | |
ElementType, | |||
... | |||
) |
Value:
DEFINE_FSTR_REF_NAMED(name, FSTR::Array<ElementType>);
#define DEFINE_FSTR_ARRAY_DATA(name, ElementType,...)
Define an Array data structure.
Definition: Array.hpp:65
#define FSTR_DATA_NAME(name)
Provide internal name for generated flash string structures.
Definition: Object.hpp:56
Define an Array Object with global reference.
- Parameters
-
name Name of Array& reference to define ElementType ... List of ElementType items
- Note
- Unlike String, array is not NUL-terminated
◆ DEFINE_FSTR_ARRAY_DATA
#define DEFINE_FSTR_ARRAY_DATA | ( | name, | |
ElementType, | |||
... | |||
) |
Value:
constexpr const struct { \
FSTR::ObjectBase object; \
ElementType data[sizeof((const ElementType[]){__VA_ARGS__}) / sizeof(ElementType)]; \
FSTR_CHECK_STRUCT(name);
Define an Array data structure.
- Parameters
-
name Name of data structure ElementType ... List of ElementType items
◆ DEFINE_FSTR_ARRAY_LOCAL
#define DEFINE_FSTR_ARRAY_LOCAL | ( | name, | |
ElementType, | |||
... | |||
) |
Value:
static constexpr DEFINE_FSTR_REF_NAMED(name, FSTR::Array<ElementType>);
Like DEFINE_FSTR_ARRAY except reference is declared static constexpr.
◆ FSTR_ARRAY_ARRAY
#define FSTR_ARRAY_ARRAY | ( | name, | |
ElementType, | |||
... | |||
) |
Value:
LOAD_FSTR_ARRAY(name, FSTR_DATA_NAME(name).object)
Define an Array and load it into a named buffer on the stack.
- Note
- Equivalent to
ElementType name[] = {a, b, c}
except the buffer is word-aligned
◆ IMPORT_FSTR_ARRAY
#define IMPORT_FSTR_ARRAY | ( | name, | |
ElementType, | |||
file | |||
) | IMPORT_FSTR_OBJECT(name, FSTR::Array<ElementType>, file) |
Define an Array containing data from an external file.
- Parameters
-
name Name for the Array object ElementType Array element type file Absolute path to the file containing the content
- See also
- See also
IMPORT_FSTR_DATA
◆ IMPORT_FSTR_ARRAY_LOCAL
#define IMPORT_FSTR_ARRAY_LOCAL | ( | name, | |
ElementType, | |||
file | |||
) | IMPORT_FSTR_OBJECT_LOCAL(name, FSTR::Array<ElementType>, file) |
Like IMPORT_FSTR_ARRAY except reference is declared static constexpr.
◆ LOAD_FSTR_ARRAY
#define LOAD_FSTR_ARRAY | ( | name, | |
array | |||
) |
Value:
decltype((array)[0]) name[(array).size()] FSTR_ALIGNED; \
memcpy_aligned(name, (array).data(), (array).size());
Load an Array object into a named local (stack) buffer.
- Note
- Example:
DEFINE_FSTR_ARRAY(fsArray, double, 5.33, PI) ... LOAD_FSTR_ARRAY(arr, fsArray) printf("arr[0] = %f, %u elements, buffer is %u bytes\n", arr[0], fsArray.length(), sizeof(arr));