libcosmos
Linux C++ System Programming Library
Loading...
Searching...
No Matches
Initable.hxx
1#pragma once
2
3// cosmos
4#include <cosmos/cosmos.hxx>
5
6namespace cosmos {
7
9
13enum class InitPrio : std::size_t {
14 MUTEX_ATTR,
15 RUNNING_ON_VALGRIND,
16 CHECK_STDIO_TTYS
17};
18
20
28class Initable {
29 friend struct InitData;
30
31protected: // functions
32
33 explicit Initable(const InitPrio prio) {
34 registerInitable(prio);
35 }
36
37protected: // functions
38
39 virtual void libInit() = 0;
40 virtual void libExit() = 0;
41
42 bool libInitialized() const { return m_lib_initialized; }
43
44private: // functions
45
46 void registerInitable(const InitPrio prio);
47
48private: // data
49
50 bool m_lib_initialized = false;
51};
52
53} // end ns
Pure virtual base class for the library init system.
Definition Initable.hxx:28