comparison foosdk/sdk/pfc/killswitch.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 #include <memory>
4
5 namespace pfc {
6 struct killSwitchData_t {
7 killSwitchData_t() : m_val() {}
8 volatile bool m_val;
9 };
10
11
12 typedef std::shared_ptr<killSwitchData_t> killSwitchRef_t;
13
14 class killSwitchRef {
15 public:
16 killSwitchRef( killSwitchRef_t ks ) : m_ks(ks) {}
17
18 operator bool () const {
19 return m_ks->m_val;
20 }
21
22 void set(bool val = true) {
23 m_ks->m_val = val;
24 }
25 private:
26 killSwitchRef_t m_ks;
27 };
28
29 killSwitchRef killSwitchMake() {
30 return std::make_shared<killSwitchData_t>();
31 }
32 }