blob: 6b2c95f2d6e8ac30351ddbf5f9c292fb5f49263a [file] [log] [blame]
Matt Spinlerd82a5f42017-07-24 13:40:37 -05001#pragma once
2
3#include <memory>
4#include <systemd/sd-event.h>
5
6namespace witherspoon
7{
8namespace power
9{
10namespace event
11{
12
13/**
14 * Custom deleter for sd_event_source
15 */
16struct EventSourceDeleter
17{
18 void operator()(sd_event_source* eventSource) const
19 {
20 sd_event_source_unref(eventSource);
21 }
22};
23
24using EventSource = std::unique_ptr<sd_event_source, EventSourceDeleter>;
25
26/**
27 * Customer deleter for sd_event
28 */
29struct EventDeleter
30{
31 void operator()(sd_event* event) const
32 {
33 sd_event_unref(event);
34 }
35};
36
37using Event = std::unique_ptr<sd_event, EventDeleter>;
38
39}
40}
41}