Modernize event service manager and sse
Move static initialization of variables into the variables
themselves and use = default for the destructor.
Also, deleted constructors/destructors/move operators should be public,
not private.
Tested:
Code builds. No substantial changes.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I156b6d7ce4c59d636bec6e722de981bbd0f727c3
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index ded8dbc..a6fe829 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -395,8 +395,7 @@
sseConn = std::make_shared<crow::ServerSentEvents>(adaptor);
}
- ~Subscription()
- {}
+ ~Subscription() = default;
void sendEvent(const std::string& msg)
{
@@ -600,28 +599,27 @@
uint32_t retryAttempts;
uint32_t retryTimeoutInterval;
- EventServiceManager(const EventServiceManager&) = delete;
- EventServiceManager& operator=(const EventServiceManager&) = delete;
- EventServiceManager(EventServiceManager&&) = delete;
- EventServiceManager& operator=(EventServiceManager&&) = delete;
-
- EventServiceManager() :
- noOfEventLogSubscribers(0), noOfMetricReportSubscribers(0), eventId(1)
+ EventServiceManager()
{
// Load config from persist store.
initConfig();
}
std::string lastEventTStr;
- size_t noOfEventLogSubscribers;
- size_t noOfMetricReportSubscribers;
+ size_t noOfEventLogSubscribers{0};
+ size_t noOfMetricReportSubscribers{0};
std::shared_ptr<sdbusplus::bus::match::match> matchTelemetryMonitor;
boost::container::flat_map<std::string, std::shared_ptr<Subscription>>
subscriptionsMap;
- uint64_t eventId;
+ uint64_t eventId{1};
public:
+ EventServiceManager(const EventServiceManager&) = delete;
+ EventServiceManager& operator=(const EventServiceManager&) = delete;
+ EventServiceManager(EventServiceManager&&) = delete;
+ EventServiceManager& operator=(EventServiceManager&&) = delete;
+
static EventServiceManager& getInstance()
{
static EventServiceManager handler;
diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp
index 9689001..ee4ad4d 100644
--- a/redfish-core/include/server_sent_events.hpp
+++ b/redfish-core/include/server_sent_events.hpp
@@ -267,8 +267,7 @@
startSSE();
}
- ~ServerSentEvents()
- {}
+ ~ServerSentEvents() = default;
void sendData(const uint64_t& id, const std::string& data)
{