79template<
typename T,
typename Deleter = default_delete<T>>
112 bool object_constructed;
122 constexpr fl::size_t align = control_block_alignment<T>::value;
125 static void operator delete(
void* ptr) {
139 if (object_constructed) {
141 object_constructed =
false;
145 void destroy_control_block()
FL_NOEXCEPT override {
205 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
212 other.mPtr =
nullptr;
213 other.mControlBlock =
nullptr;
217 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
219 other.mPtr =
nullptr;
220 other.mControlBlock =
nullptr;
245 if (
this != &other) {
255 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
258 mPtr =
static_cast<T*
>(other.mPtr);
265 if (
this != &other) {
273 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
275 if (
static_cast<void*
>(
this) !=
static_cast<void*
>(&other)) {
277 mPtr =
static_cast<T*
>(other.mPtr);
279 other.mPtr =
nullptr;
280 other.mControlBlock =
nullptr;
362 return mPtr ==
nullptr;
366 return mPtr !=
nullptr;
382 template<
typename Y,
typename Deleter>
394 template<
typename Y,
typename... Args>
397 template<
typename Y,
typename Deleter,
typename... Args>
400 template<
typename Y,
typename A,
typename... Args>
413template<
typename T,
typename... Args>
415 auto* control =
new detail::InlinedControlBlock<T>();
416 T* obj = control->get_object();
418 control->object_constructed =
true;
422template<
typename T,
typename Deleter,
typename... Args>
448template<
typename T,
typename A,
typename... Args>
456template<
typename T,
typename Y>
458 return lhs.get() == rhs.get();
461template<
typename T,
typename Y>
463 return lhs.get() != rhs.get();
466template<
typename T,
typename Y>
468 return lhs.get() < rhs.get();
471template<
typename T,
typename Y>
473 return lhs.get() <= rhs.get();
476template<
typename T,
typename Y>
478 return lhs.get() > rhs.get();
481template<
typename T,
typename Y>
483 return lhs.get() >= rhs.get();
488 return lhs.get() ==
nullptr;
493 return nullptr == rhs.get();
498 return lhs.get() !=
nullptr;
503 return nullptr != rhs.get();
513template<
typename T,
typename Y>
518template<
typename T,
typename Y>
523template<
typename T,
typename Y>
535#define FASTLED_SHARED_PTR(type) \
537 using type##Ptr = fl::shared_ptr<type>;
540#define FASTLED_SHARED_PTR_STRUCT(type) \
542 using type##Ptr = fl::shared_ptr<type>;
546#define FASTLED_SHARED_PTR_NO_FWD(type) using type##Ptr = fl::shared_ptr<type>;
549#define FASTLED_SMART_PTR(type) FASTLED_SHARED_PTR(type)
550#define FASTLED_SMART_PTR_STRUCT(type) FASTLED_SHARED_PTR_STRUCT(type)
551#define FASTLED_SMART_PTR_NO_FWD(type) FASTLED_SHARED_PTR_NO_FWD(type)
Alignment macros and utilities for FastLED.
shared_ptr(fl::nullptr_t) FL_NOEXCEPT
detail::ControlBlockBase * mControlBlock
shared_ptr(T *ptr, detail::ControlBlockBase *control_block, detail::make_shared_tag) FL_NOEXCEPT
T & operator[](ptrdiff_t idx) const FL_NOEXCEPT
shared_ptr & operator=(shared_ptr &&other) FL_NOEXCEPT
shared_ptr(shared_ptr &&other) FL_NOEXCEPT
void swap(shared_ptr &&other) FL_NOEXCEPT
void acquire() FL_NOEXCEPT
weak_ptr< filebuf > weak_type
friend shared_ptr< Y > make_shared_array(size_t n) FL_NOEXCEPT
long use_count() const FL_NOEXCEPT
shared_ptr(shared_ptr< Y > &&other) FL_NOEXCEPT
shared_ptr & operator=(const shared_ptr< Y > &other) FL_NOEXCEPT
friend shared_ptr< Y > allocate_shared(const A &alloc, Args &&... args) FL_NOEXCEPT
shared_ptr(Y *ptr) FL_NOEXCEPT
friend shared_ptr< Y > make_shared_with_deleter(Deleter d, Args &&... args) FL_NOEXCEPT
bool operator!=(fl::nullptr_t) const FL_NOEXCEPT
friend shared_ptr< Y > make_shared(Args &&... args) FL_NOEXCEPT
shared_ptr & operator=(const shared_ptr &other) FL_NOEXCEPT
~shared_ptr() FL_NOEXCEPT
shared_ptr & operator=(shared_ptr< Y > &&other) FL_NOEXCEPT
friend shared_ptr< Y > make_shared_no_tracking(Y &obj) FL_NOEXCEPT
void reset(shared_ptr &&other) FL_NOEXCEPT
bool operator==(fl::nullptr_t) const FL_NOEXCEPT
shared_ptr(T *ptr, detail::ControlBlockBase *control_block, detail::no_tracking_tag) FL_NOEXCEPT
bool unique() const FL_NOEXCEPT
T * get() const FL_NOEXCEPT
shared_ptr(Y *ptr, Deleter d) FL_NOEXCEPT
T & operator*() const FL_NOEXCEPT
T * operator->() const FL_NOEXCEPT
bool is_no_tracking() const FL_NOEXCEPT
shared_ptr(const shared_ptr &other) FL_NOEXCEPT
shared_ptr(const weak_ptr< Y > &weak) FL_NOEXCEPT
void swap(shared_ptr &other) FL_NOEXCEPT
shared_ptr(const shared_ptr< Y > &other, T *ptr) FL_NOEXCEPT
shared_ptr(const shared_ptr< Y > &other) FL_NOEXCEPT
Compile-time linker keep-alive hook for a single fl::Bus.
constexpr T && forward(typename remove_reference< T >::type &t) FL_NOEXCEPT
decltype(nullptr) nullptr_t
shared_ptr< T > reinterpret_pointer_cast(const shared_ptr< Y > &other) FL_NOEXCEPT
constexpr int type_rank< T >::value
shared_ptr< T > const_pointer_cast(const shared_ptr< Y > &other) FL_NOEXCEPT
void aligned_free(void *ptr)
shared_ptr< T > make_shared_no_tracking(T &obj) FL_NOEXCEPT
void * aligned_alloc(fl::size_t alignment, fl::size_t size)
FASTLED_FORCE_INLINE bool operator!=(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if two CRGB objects do not have the same color data.
void swap(array< T, N > &lhs, array< T, N > &rhs) FL_NOEXCEPT
atomic< fl::u32 > atomic_u32
shared_ptr< T > make_shared_array(size_t n) FL_NOEXCEPT
FASTLED_FORCE_INLINE bool operator<(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is less than another.
FASTLED_FORCE_INLINE bool operator==(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if two CRGB objects have the same color data.
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
FASTLED_FORCE_INLINE bool operator>(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is greater than another.
struct FL_ALIGNAS(4) Wave3BitExpansionLut
Lookup table for nibble-to-waveform expansion in wave3 format (32 bytes)
FASTLED_FORCE_INLINE bool operator<=(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is less than or equal to another.
shared_ptr< T > allocate_shared(const A &, Args &&... args) FL_NOEXCEPT
shared_ptr< T > static_pointer_cast(const shared_ptr< Y > &other) FL_NOEXCEPT
To bit_cast(const From &from) FL_NOEXCEPT
shared_ptr< T > make_shared_with_deleter(Deleter d, Args &&... args) FL_NOEXCEPT
FASTLED_FORCE_INLINE bool operator>=(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is greater than or equal to another.
Base definition for an LED controller.
ControlBlock(T *p, Deleter d=Deleter(), bool track=true) FL_NOEXCEPT
void destroy_object() FL_NOEXCEPT override
void destroy_control_block() FL_NOEXCEPT override
static constexpr fl::u32 NO_TRACKING_VALUE
virtual void destroy_control_block() FL_NOEXCEPT=0
fl::atomic_u32 shared_count
bool remove_shared_ref() FL_NOEXCEPT
virtual ~ControlBlockBase() FL_NOEXCEPT
ControlBlockBase(bool track=true) FL_NOEXCEPT
virtual void destroy_object() FL_NOEXCEPT=0
fl::atomic_u32 weak_count
void add_shared_ref() FL_NOEXCEPT
bool is_no_tracking() const FL_NOEXCEPT
void operator()(T *ptr) const FL_NOEXCEPT
static constexpr fl::size value
void operator()(T *ptr) const FL_NOEXCEPT
void operator()(T *) const FL_NOEXCEPT