From 340a871a98576af905b387e251a5face2ebd2fbc Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Wed, 14 Jan 2015 15:36:30 +0200 Subject: [PATCH] core: use seastar shared ptr in scollectd --- core/scollectd.cc | 10 ++++------ core/scollectd.hh | 5 +++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/scollectd.cc b/core/scollectd.cc index 9f889123a5..f369e182b1 100644 --- a/core/scollectd.cc +++ b/core/scollectd.cc @@ -60,17 +60,15 @@ class impl { double _avg = 0; public: - // Note: we use std::shared_ptr, not the C* one. This is because currently - // seastar sp does not handle polymorphism. And we use it. - typedef std::map > value_list_map; + typedef std::map > value_list_map; typedef value_list_map::value_type value_list_pair; void add_polled(const type_instance_id & id, - const std::shared_ptr & values) { + const shared_ptr & values) { _values.insert(std::make_pair(id, values)); } void remove_polled(const type_instance_id & id) { - _values.insert(std::make_pair(id, std::shared_ptr())); + _values.insert(std::make_pair(id, shared_ptr())); } // explicitly send a type_instance value list (outside polling) future<> send_metric(const type_instance_id & id, @@ -381,7 +379,7 @@ impl & get_impl() { } void add_polled(const type_instance_id & id, - const std::shared_ptr & values) { + const shared_ptr & values) { get_impl().add_polled(id, values); } diff --git a/core/scollectd.hh b/core/scollectd.hh index c9442505eb..602ca537f1 100644 --- a/core/scollectd.hh +++ b/core/scollectd.hh @@ -22,6 +22,7 @@ #include "future.hh" #include "net/byteorder.hh" +#include "core/shared_ptr.hh" /** * Implementation of rudimentary collectd data gathering. @@ -355,7 +356,7 @@ private: std::tuple < Args... > _values; }; -void add_polled(const type_instance_id &, const std::shared_ptr &); +void add_polled(const type_instance_id &, const shared_ptr &); typedef std::function notify_function; template @@ -393,7 +394,7 @@ static type_instance_id add_polled_metric(const type_instance_id & id, _Args&& ... args) { typedef decltype(make_type_instance(std::forward<_Args>(args)...)) impl_type; add_polled(id, - std::make_shared( + ::make_shared( make_type_instance(std::forward<_Args>(args)...))); return id; }