REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
utils::HeapSingleton< T > Class Template Reference

Define singletons which are not static-space allocated (and thus consume valuable ICTM space). More...

#include <singleton.h>

Static Public Member Functions

static T & get ()
 

Detailed Description

template<class T>
class utils::HeapSingleton< T >

Define singletons which are not static-space allocated (and thus consume valuable ICTM space).

Instead, this allocates them in the RAM2.

As usual with Singletons, we assume "eternal objects" which have no destruction time.

A note on heap fragmentation: If the first call to get() happens late, heap fragmentation will occur. Therefore, make sure to call get() early on frequently used objects.

Usage is like

class Foo : HeapSingleton<Foo> { ... }

This is a CRTP pattern.

Definition at line 46 of file singleton.h.

Member Function Documentation

◆ get()

template<class T >
static T & utils::HeapSingleton< T >::get ( )
inlinestatic

Definition at line 48 of file singleton.h.

Referenced by api().


The documentation for this class was generated from the following file: