-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_timerlife.h
More file actions
32 lines (25 loc) · 888 Bytes
/
_timerlife.h
File metadata and controls
32 lines (25 loc) · 888 Bytes
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
#pragma once
// _timerlife.h
// dbien
// 24MAR2024
// This is an attempt to make a timer object whose lifetime is owned by the handler.
// Then there is no need to have a seperate container for the timed object - it is managed by async_wait().
template <typename t_TyTimer>
class CTimerLife : public std::enable_shared_from_this<CTimerLife<t_TyTimer>>
{
public:
using _TyBase = std::enable_shared_from_this<CTimerLife<t_TyTimer>>;
using _TyThis = CTimerLife<t_TyTimer>;
using _TyTimer = t_TyTimer;
// Delete the copy constructor and copy assignment operator
CTimerLife(const _TyThis&) = delete;
CTimerLife& operator=(const _TyThis&) = delete;
// Default constructor
CTimerLife() = default;
// Move constructor
CTimerLife(_TyThis&&) = default;
// Move assignment operator
_TyThis& operator=(_TyThis&&) = default;
// Destructor
~CTimerLife() = default;
};