39 #define DECLARE_FSTR_ARRAY(name, ElementType) DECLARE_FSTR_OBJECT(name, FSTR::Array<ElementType>)
48 #define DEFINE_FSTR_ARRAY(name, ElementType, ...) \
49 static DEFINE_FSTR_ARRAY_DATA(FSTR_DATA_NAME(name), ElementType, __VA_ARGS__); \
50 DEFINE_FSTR_REF_NAMED(name, FSTR::Array<ElementType>);
55 #define DEFINE_FSTR_ARRAY_LOCAL(name, ElementType, ...) \
56 static DEFINE_FSTR_ARRAY_DATA(FSTR_DATA_NAME(name), ElementType, __VA_ARGS__); \
57 static constexpr DEFINE_FSTR_REF_NAMED(name, FSTR::Array<ElementType>);
65 #define DEFINE_FSTR_ARRAY_DATA(name, ElementType, ...) \
66 constexpr const struct { \
67 FSTR::ObjectBase object; \
68 ElementType data[sizeof((const ElementType[]){__VA_ARGS__}) / sizeof(ElementType)]; \
69 } FSTR_PACKED FSTR_ALIGNED name PROGMEM = {{sizeof(name.data)}, {__VA_ARGS__}}; \
70 FSTR_CHECK_STRUCT(name);
81 #define LOAD_FSTR_ARRAY(name, array) \
82 decltype((array)[0]) name[(array).size()] FSTR_ALIGNED; \
83 memcpy_aligned(name, (array).data(), (array).size());
89 #define FSTR_ARRAY_ARRAY(name, ElementType, ...) \
90 static DEFINE_FSTR_ARRAY_DATA(FSTR_DATA_NAME(name), ElementType, __VA_ARGS__); \
91 LOAD_FSTR_ARRAY(name, FSTR_DATA_NAME(name).object)
100 #define IMPORT_FSTR_ARRAY(name, ElementType, file) IMPORT_FSTR_OBJECT(name, FSTR::Array<ElementType>, file)
105 #define IMPORT_FSTR_ARRAY_LOCAL(name, ElementType, file) IMPORT_FSTR_OBJECT_LOCAL(name, FSTR::Array<ElementType>, file)
113 template <
typename ElementType>
class Array :
public Object<Array<ElementType>, ElementType>
116 static_assert(!std::is_pointer<ElementType>::value,
"Pointer types not supported by Array - use Vector");
Class template to provide a simple way to print the contents of an array.
Definition: ArrayPrinter.hpp:40
Class to access an array of integral values stored in flash.
Definition: Array.hpp:114
ArrayPrinter< Array > printer() const
Returns a printer object for this array.
Definition: Array.hpp:124
size_t printTo(Print &p) const
Definition: Array.hpp:129
Base class template for all types.
Definition: Object.hpp:121
Provides formatted output to stream.
Definition: Print.h:37
Definition: Array.hpp:108