FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
singleton.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/namespace.h"
4
5namespace fl {
6
7// A templated singleton class, parameterized by the type of the singleton and
8// an optional integer.
9template <typename T, int N = 0> class Singleton {
10 public:
11 static T &instance() {
12 static T instance;
13 return instance;
14 }
15 static T *instanceRef() { return &instance(); }
16 Singleton(const Singleton &) = delete;
17 Singleton &operator=(const Singleton &) = delete;
18
19 private:
20 Singleton() = default;
21 ~Singleton() = default;
22};
23
24} // namespace fl
static T * instanceRef()
Definition singleton.h:15
static T & instance()
Definition singleton.h:11
Singleton & operator=(const Singleton &)=delete
Singleton()=default
~Singleton()=default
Singleton(const Singleton &)=delete
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16