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:
static DEFINE_FSTR_ARRAY_DATA(FSTR_DATA_NAME(name), ElementType, __VA_ARGS__); \
DEFINE_FSTR_REF_NAMED(name, FSTR::Array<ElementType>);
Class to access an array of integral values stored in flash.
Definition: Array.hpp:114
#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
nameName 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_PACKED FSTR_ALIGNED name PROGMEM = {{sizeof(name.data)}, {__VA_ARGS__}}; \
FSTR_CHECK_STRUCT(name);
#define PROGMEM
Definition: Arch/Esp32/Components/libc/src/include/sys/pgmspace.h:26
#define FSTR_PACKED
Definition: config.hpp:31
#define FSTR_ALIGNED
Definition: config.hpp:30

Define an Array data structure.

Parameters
nameName of data structure
ElementType
...List of ElementType items

◆ DEFINE_FSTR_ARRAY_LOCAL

#define DEFINE_FSTR_ARRAY_LOCAL (   name,
  ElementType,
  ... 
)
Value:
static DEFINE_FSTR_ARRAY_DATA(FSTR_DATA_NAME(name), ElementType, __VA_ARGS__); \
#define DEFINE_FSTR_REF_NAMED(name, ObjectType)
Definition: Object.hpp:51

Like DEFINE_FSTR_ARRAY except reference is declared static constexpr.

◆ FSTR_ARRAY_ARRAY

#define FSTR_ARRAY_ARRAY (   name,
  ElementType,
  ... 
)
Value:
static DEFINE_FSTR_ARRAY_DATA(FSTR_DATA_NAME(name), ElementType, __VA_ARGS__); \
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
nameName for the Array object
ElementTypeArray element type
fileAbsolute 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));