... | @@ -8,6 +8,10 @@ In boardcore, you can achieve this by extending the Singleton template which you |
... | @@ -8,6 +8,10 @@ In boardcore, you can achieve this by extending the Singleton template which you |
|
The Singleton interface is a template class which exposes a single method:
|
|
The Singleton interface is a template class which exposes a single method:
|
|
```cpp
|
|
```cpp
|
|
inline static T* getInstance()
|
|
inline static T* getInstance()
|
|
|
|
{
|
|
|
|
static T instance;
|
|
|
|
return &instance;
|
|
|
|
}
|
|
```
|
|
```
|
|
What this method does is:
|
|
What this method does is:
|
|
- If an instance of this class already exists, return that instance.
|
|
- If an instance of this class already exists, return that instance.
|
... | | ... | |