FastLED 3.9.15
Loading...
Searching...
No Matches

◆ makeName()

fl::string fl::Channel::makeName ( i32 id,
const fl::optional< fl::string > & configName = fl::optional<fl::string>() )
staticprivate

Definition at line 156 of file channel.cpp.hpp.

156 {
157 if (configName.has_value()) {
158 return configName.value();
159 }
160 // Auto-naming `"Channel_<id>"` only matters for diagnostics — in release
161 // builds (NDEBUG → FASTLED_LOG_VERBOSITY=0 per Stage 1) every FL_WARN /
162 // FL_ERROR site that reads mName collapses to `do { } while(0)`, so the
163 // string and the supporting `fl::to_string` + `operator+` chain go
164 // unused. Empty in release saves the `fl::to_string<i64>` instantiation
165 // plus the heap allocation per Channel ctor. See #2942 / #2886.
166#if FASTLED_LOG_RUNTIME_ENABLED
167 return "Channel_" + fl::to_string(static_cast<i64>(id));
168#else
169 (void)id;
170 return {};
171#endif
172}
T & value() FL_NOEXCEPT
Definition optional.h:112
bool has_value() const FL_NOEXCEPT
Definition optional.h:42
string to_string(T value) FL_NOEXCEPT
Definition string.h:450
fl::i64 i64
Definition s16x16x4.h:222

References fl::Optional< T >::has_value(), fl::to_string(), and fl::Optional< T >::value().

Referenced by Channel(), Channel(), Channel(), create(), and operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: