libcosmos
Linux C++ System Programming Library
Loading...
Searching...
No Matches
cosmos::InitData Struct Reference

Public Member Functions

void add (const InitPrio prio, Initable *init_if)
 
void init ()
 
void finish ()
 

Protected Attributes

InitableMap initables
 

Detailed Description

Definition at line 22 of file cosmos.cxx.

Member Function Documentation

◆ add()

void cosmos::InitData::add ( const InitPrio prio,
Initable * init_if )

Definition at line 60 of file cosmos.cxx.

60 {
61
62 auto ret = initables.insert(std::make_pair(prio, init_if));
63
64 if (ret.second != true) {
65 std::cerr << "Conflicting priority of Initables!\n";
66 _exit(9);
67 }
68}

◆ finish()

void cosmos::InitData::finish ( )

Definition at line 77 of file cosmos.cxx.

77 {
78 // perform cleanup - in reverse order
79 for (auto it = initables.rbegin(); it != initables.rend(); it++) {
80 auto initable = it->second;
81 initable->libExit();
82 initable->m_lib_initialized = false;
83 }
84}

◆ init()

void cosmos::InitData::init ( )

Definition at line 70 of file cosmos.cxx.

70 {
71 for (auto &[prio, initable]: initables) {
72 initable->libInit();
73 initable->m_lib_initialized = true;
74 }
75}

Member Data Documentation

◆ initables

InitableMap cosmos::InitData::initables
protected

Definition at line 28 of file cosmos.cxx.


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