SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
resettable.h
Go to the documentation of this file.
1#ifndef SENSESP_SYSTEM_RESETTABLE_H_
2#define SENSESP_SYSTEM_RESETTABLE_H_
3
4#include <queue>
5
6namespace sensesp {
7
8class ResettableCompare;
9
21 public:
22 Resettable(int priority = 0);
23
24 virtual void reset() {}
25
26 const int get_reset_priority() const { return priority; }
27
28 void set_reset_priority(int priority) { this->priority = priority; }
29
30 static void reset_all();
31
32 friend class ResettableCompare;
33
34 private:
35 int priority;
36
37 static std::priority_queue<Resettable*, std::vector<Resettable*>,
39 reset_list;
40};
41
43 public:
44 bool operator()(const Resettable* a, const Resettable* b) {
45 return a->priority < b->priority;
46 }
47};
48
49} // namespace sensesp
50
51#endif
bool operator()(const Resettable *a, const Resettable *b)
Definition resettable.h:44
Automatic calling of the reset() method when the device needs to be reset.
Definition resettable.h:20
static void reset_all()
virtual void reset()
Definition resettable.h:24
Resettable(int priority=0)
const int get_reset_priority() const
Definition resettable.h:26
void set_reset_priority(int priority)
Definition resettable.h:28