FastLED 3.9.7
Loading...
Searching...
No Matches
ref.cpp
1#include "fl/ptr.h"
2
3#include "fl/namespace.h"
4
5namespace fl {
6
7Referent::Referent() : mRefCount(0) {}
8Referent::~Referent() = default;
9void Referent::ref() { mRefCount++; }
10
11int Referent::ref_count() const { return mRefCount; }
12
13void Referent::unref() {
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;
28Referent &Referent::operator=(Referent &&) = default;
29
30} // namespace fl
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16