Minor event refactoring

Assert that all events will share the same filter interface by
moving event filters to event base class.

Remove virtual on destructors in classes with final.

Improve comments in a number of places.

Change-Id: Ia32c13fd0f3b9a5fa147a2198a285bce37c27cfb
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/events.hpp b/events.hpp
index 78b63ab..e197719 100644
--- a/events.hpp
+++ b/events.hpp
@@ -24,8 +24,11 @@
 
 /** @struct Event
  *  @brief Event object interface.
+ *
+ *  The event base is an assocation of an event type
+ *  and an array of filter callbacks.
  */
-struct Event
+struct Event : public std::vector<FilterBasePtr>
 {
     enum class Type
     {
@@ -33,12 +36,22 @@
     };
 
     virtual ~Event() = default;
-    Event(const Event&) = default;
-    Event& operator=(const Event&) = default;
+    Event(const Event&) = delete;
+    Event& operator=(const Event&) = delete;
     Event(Event&&) = default;
     Event& operator=(Event&&) = default;
-    explicit Event(Type t) : type(t) {}
 
+    /** @brief Event constructor.
+     *
+     *  @param[in] filters - An array of filter callbacks.
+     *  @param[in] t - The event type.
+     */
+    explicit Event(
+        const std::vector<FilterBasePtr>& filters, Type t) :
+        std::vector<FilterBasePtr>(filters),
+        type(t) {}
+
+    /** @brief event class enumeration. */
     Type type;
 };
 
@@ -50,12 +63,10 @@
  *  DBus signal events are an association of a match signature
  *  and filtering function object.
  */
-struct DbusSignal final :
-    public Event,
-    public std::tuple<const char*, std::vector<FilterBasePtr>>
+struct DbusSignal final : public Event
 {
-    virtual ~DbusSignal() = default;
-    DbusSignal(const DbusSignal&) = default;
+    ~DbusSignal() = default;
+    DbusSignal(const DbusSignal&) = delete;
     DbusSignal& operator=(const DbusSignal&) = delete;
     DbusSignal(DbusSignal&&) = default;
     DbusSignal& operator=(DbusSignal&&) = default;
@@ -63,12 +74,14 @@
     /** @brief Import from signature and filter constructor.
      *
      *  @param[in] sig - The DBus match signature.
-     *  @param[in] filter - A DBus signal match callback filtering function.
+     *  @param[in] filter - An array of DBus signal
+     *     match callback filtering functions.
      */
     DbusSignal(const char* sig, const std::vector<FilterBasePtr>& filters) :
-        Event(Type::DBUS_SIGNAL),
-        std::tuple<const char*, std::vector<FilterBasePtr>>(
-                    sig, std::move(filters)) {}
+        Event(filters, Type::DBUS_SIGNAL),
+        signature(sig) {}
+
+    const char* signature;
 };
 
 /** @brief make_filter
diff --git a/manager.cpp b/manager.cpp
index 16ed30a..5562b95 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -42,7 +42,7 @@
         auto& args = *static_cast<Manager::SigArg*>(data);
         sd_bus_message_ref(m);
         auto& mgr = *std::get<0>(args);
-        mgr.signal(
+        mgr.handleEvent(
             msg,
             static_cast<const details::DbusSignal&>(
                 *std::get<1>(args)),
@@ -71,7 +71,8 @@
 {
     for (auto& group : _events)
     {
-        for (auto pEvent : std::get<0>(group))
+        for (auto pEvent : std::get<std::vector<details::EventBasePtr>>(
+                 group))
         {
             if (pEvent->type !=
                 details::Event::Type::DBUS_SIGNAL)
@@ -97,7 +98,7 @@
             // each signal event.
             _matches.emplace_back(
                 _bus,
-                std::get<0>(*dbusEvent),
+                dbusEvent->signature,
                 details::_signal,
                 _sigargs.back().get());
         }
@@ -178,15 +179,14 @@
     }
 }
 
-void Manager::signal(
+void Manager::handleEvent(
     sdbusplus::message::message& msg,
-    const details::DbusSignal& event,
+    const details::Event& event,
     const EventInfo& info)
 {
-    auto& filters = std::get<1>(event);
     auto& actions = std::get<1>(info);
 
-    for (auto& f : filters)
+    for (auto& f : event)
     {
         if (!(*f)(_bus, msg, *this))
         {
diff --git a/manager.hpp b/manager.hpp
index bd12ef6..616e45d 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -92,10 +92,10 @@
         /** @brief sd_bus Notify method implementation callback. */
         void notify(sdbusplus::message::object_path, Object) override;
 
-        /** @brief sd_bus signal callback. */
-        void signal(sdbusplus::message::message&,
-                    const details::DbusSignal& event,
-                    const EventInfo& info);
+        /** @brief Event processing entry point. */
+        void handleEvent(sdbusplus::message::message&,
+                         const details::Event& event,
+                         const EventInfo& info);
 
         /** @brief Drop one or more objects from DBus. */
         void destroyObjects(