-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathocc_presence.hpp
49 lines (42 loc) · 1.3 KB
/
occ_presence.hpp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "occ_errors.hpp"
namespace open_power
{
namespace occ
{
class Manager;
/** @class Presence
* @brief Monitors the number of OCCs present
*/
class Presence : public Error
{
public:
Presence() = delete;
Presence(const Presence&) = delete;
Presence& operator=(const Presence&) = delete;
Presence(Presence&&) = default;
Presence& operator=(Presence&&) = default;
/** @brief Constructs the Presence object
*
* @param[in] event - Reference to sd_event unique_ptr
* @param[in] file - File used by driver to communicate errors
* @param[in] mgr - OCC manager instance
* @param[in] callBack - Optional function callback on error condition
*/
Presence(EventPtr& event, const fs::path& file, const Manager& mgr,
std::function<void(int)> callBack = nullptr) :
Error(event, file, callBack), manager(mgr)
{
// Nothing to do here.
}
private:
/** Store the manager instance to enable getting number of OCCs */
const Manager& manager;
/** @brief When the error event is received, analyzes it
* and makes a callback to error handler if the
* content denotes an error condition
*/
void analyzeEvent() override;
};
} // namespace occ
} // namespace open_power