-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlynkTemplates.h
executable file
·47 lines (42 loc) · 1.09 KB
/
BlynkTemplates.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class BlynkStackOnly
{
protected:
BlynkStackOnly() {}
~BlynkStackOnly() {}
private:
/// @brief Declared as private to prevent usage of dynamic memory
void* operator new(size_t size);
/// @brief Declared as private to prevent usage of dynamic memory
void operator delete(void *p);
};
class BlynkNonCopyable
{
protected:
BlynkNonCopyable(){}
~BlynkNonCopyable(){}
private:
/// @brief Declared as private to prevent usage of copy constructor
BlynkNonCopyable(const BlynkNonCopyable&);
/// @brief Declared as private to prevent usage of assignment operator
BlynkNonCopyable& operator=(const BlynkNonCopyable&);
};
template<typename T>
class BlynkSingleton
: public BlynkNonCopyable
{
public:
/** @brief Returns the instance of the singleton type
When called for the first time, the singleton instance will be
created. All subsequent calls will return a reference to the
previously created instance.
@return The singleton instance
*/
static T* instance()
{
static T instance;
return &instance;
}
protected:
BlynkSingleton() {}
~BlynkSingleton() {}
};