FastLED
3.9.15
Loading...
Searching...
No Matches
singleton.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
fl/namespace.h
"
4
5
namespace
fl
{
6
7
// A templated singleton class, parameterized by the type of the singleton and
8
// an optional integer.
9
template
<
typename
T,
int
N = 0>
class
Singleton
{
10
public
:
11
static
T &
instance
() {
12
// We love function level singletons!! They don't get construction until first call.
13
// And they seem to have locks on them in most compilers. So yay.
14
static
T
instance
;
15
return
instance
;
16
}
17
static
T *
instanceRef
() {
return
&
instance
(); }
18
Singleton
(
const
Singleton
&) =
delete
;
19
Singleton
&
operator=
(
const
Singleton
&) =
delete
;
20
21
private
:
22
Singleton
() =
default
;
23
~Singleton
() =
default
;
24
};
25
26
}
// namespace fl
fl::Singleton::instanceRef
static T * instanceRef()
Definition
singleton.h:17
fl::Singleton::instance
static T & instance()
Definition
singleton.h:11
fl::Singleton::operator=
Singleton & operator=(const Singleton &)=delete
fl::Singleton::Singleton
Singleton()=default
fl::Singleton::~Singleton
~Singleton()=default
fl::Singleton::Singleton
Singleton(const Singleton &)=delete
namespace.h
Implements the FastLED namespace macros.
fl
Implements a simple red square effect for 2D LED grids.
Definition
crgb.h:16
fl
singleton.h
Generated on Tue Jun 24 2025 00:58:14 for FastLED by
1.13.2