1 #pragma once 2 3 #include <systemd/sd-event.h> 4 5 #include <memory> 6 namespace open_power 7 { 8 namespace occ 9 { 10 11 /* Need a custom deleter for freeing up sd_event */ 12 struct EventDeleter 13 { operator ()open_power::occ::EventDeleter14 void operator()(sd_event* event) const 15 { 16 sd_event_unref(event); 17 } 18 }; 19 using EventPtr = std::unique_ptr<sd_event, EventDeleter>; 20 21 /* Need a custom deleter for freeing up sd_event_source */ 22 struct EventSourceDeleter 23 { operator ()open_power::occ::EventSourceDeleter24 void operator()(sd_event_source* eventSource) const 25 { 26 sd_event_source_unref(eventSource); 27 } 28 }; 29 using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>; 30 31 } // namespace occ 32 } // namespace open_power 33