FastLED 3.9.15
Loading...
Searching...
No Matches
ref.cpp
Go to the documentation of this file.
1#include "fl/ptr.h"
2
3#include "fl/namespace.h"
4
5namespace fl {
6
8Referent::~Referent() = default;
10
11int Referent::ref_count() const { return mRefCount; }
12
14 if (--mRefCount == 0) {
15 if (mWeakPtr) {
16 mWeakPtr->setReferent(nullptr);
17 mWeakPtr.reset();
18 }
19 destroy();
20 }
21}
22
23void Referent::destroy() { delete this; }
24
25Referent::Referent(const Referent &) = default;
26Referent &Referent::operator=(const Referent &) = default;
27Referent::Referent(Referent &&) = default;
29
30} // namespace fl
virtual int ref_count() const
Definition ref.cpp:11
Referent & operator=(const Referent &)
Ptr< WeakReferent > mWeakPtr
Definition ptr.h:411
int mRefCount
Definition ptr.h:410
virtual ~Referent()
virtual void ref()
Definition ref.cpp:9
Referent()
Definition ref.cpp:7
virtual void destroy()
Definition ref.cpp:23
virtual void unref()
Definition ref.cpp:13
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16