Added register_signal method to sdbusplus::asio::dbus_interface

Signals, just like other interface members, should be listed on
interface v-table. This change introduces ability to expose
information about signal defined by D-Bus interface.

Tested by calling function in following ways:
iface->register_signal<void>("Empty");                     // -
iface->register_signal<double,std::string>("TwoElems");    // ds
iface->register_signal<std::tuple<int, double>>("Struct"); // (id)
iface->register_signal<std::vector<int>>("Array");         // ai

Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>
Change-Id: I477ebdee0c4eb814e0c18987c96fe7d7c1eb90e6
diff --git a/sdbusplus/asio/object_server.hpp b/sdbusplus/asio/object_server.hpp
index a9d5fbf..29c9748 100644
--- a/sdbusplus/asio/object_server.hpp
+++ b/sdbusplus/asio/object_server.hpp
@@ -518,6 +518,32 @@
         return false;
     }
 
+    template <typename... SignalSignature>
+    bool register_signal(const std::string& name)
+    {
+        if (initialized_)
+        {
+            return false;
+        }
+        if (name.find_first_not_of(PropertyNameAllowedCharacters) !=
+            std::string::npos)
+        {
+            return false;
+        }
+
+        static constexpr auto signature = utility::tuple_to_array(
+            message::types::type_id<SignalSignature...>());
+
+        auto [itr, inserted] = signalNames_.insert(name);
+        if (!inserted)
+        {
+            return false;
+        }
+
+        vtable_.emplace_back(vtable::signal(itr->c_str(), signature.data()));
+        return true;
+    }
+
 #ifdef __cpp_if_constexpr
     template <typename CallbackType>
     bool register_method(const std::string& name, CallbackType&& handler)
@@ -750,6 +776,7 @@
     std::string name_;
     std::list<std::string> propertyNames_;
     std::list<std::string> methodNames_;
+    std::set<std::string> signalNames_;
     boost::container::flat_map<std::string, std::unique_ptr<callback>>
         callbacksGet_;
     boost::container::flat_map<std::string, std::unique_ptr<callback_set>>