diff --git a/libraries/plugins/account_history/account_history_plugin.cpp b/libraries/plugins/account_history/account_history_plugin.cpp index 19e384a171..dd8a5c6215 100644 --- a/libraries/plugins/account_history/account_history_plugin.cpp +++ b/libraries/plugins/account_history/account_history_plugin.cpp @@ -46,7 +46,7 @@ namespace detail class account_history_plugin_impl { public: - account_history_plugin_impl(account_history_plugin& _plugin) + explicit account_history_plugin_impl(account_history_plugin& _plugin) : _self( _plugin ) { } @@ -60,6 +60,9 @@ class account_history_plugin_impl return _self.database(); } + friend class graphene::account_history::account_history_plugin; + + private: account_history_plugin& _self; flat_set _tracked_accounts; flat_set _extended_history_accounts; @@ -68,7 +71,7 @@ class account_history_plugin_impl primary_index< operation_history_index >* _oho_index; uint64_t _max_ops_per_account = -1; uint64_t _extended_max_ops_per_account = -1; - private: + /** add one history record, then check and remove the earliest history record */ void add_account_history( const account_id_type account_id, const operation_history_id_type op_id ); @@ -279,11 +282,10 @@ account_history_plugin::account_history_plugin(graphene::app::application& app) plugin(app), my( std::make_unique(*this) ) { + // Nothing else to do } -account_history_plugin::~account_history_plugin() -{ -} +account_history_plugin::~account_history_plugin() = default; std::string account_history_plugin::plugin_name()const { diff --git a/libraries/plugins/account_history/include/graphene/account_history/account_history_plugin.hpp b/libraries/plugins/account_history/include/graphene/account_history/account_history_plugin.hpp index 9676869fbf..6ceda572a7 100644 --- a/libraries/plugins/account_history/include/graphene/account_history/account_history_plugin.hpp +++ b/libraries/plugins/account_history/include/graphene/account_history/account_history_plugin.hpp @@ -64,7 +64,7 @@ namespace detail class account_history_plugin : public graphene::app::plugin { public: - account_history_plugin(graphene::app::application& app); + explicit account_history_plugin(graphene::app::application& app); ~account_history_plugin() override; std::string plugin_name()const override; @@ -76,7 +76,7 @@ class account_history_plugin : public graphene::app::plugin flat_set tracked_accounts()const; - friend class detail::account_history_plugin_impl; + private: std::unique_ptr my; }; diff --git a/libraries/plugins/api_helper_indexes/api_helper_indexes.cpp b/libraries/plugins/api_helper_indexes/api_helper_indexes.cpp index 00fbbf3e16..79c996399c 100644 --- a/libraries/plugins/api_helper_indexes/api_helper_indexes.cpp +++ b/libraries/plugins/api_helper_indexes/api_helper_indexes.cpp @@ -133,7 +133,7 @@ namespace detail class api_helper_indexes_impl { public: - api_helper_indexes_impl(api_helper_indexes& _plugin) + explicit api_helper_indexes_impl(api_helper_indexes& _plugin) : _self( _plugin ) { } @@ -142,10 +142,8 @@ class api_helper_indexes_impl return _self.database(); } - api_helper_indexes& _self; - private: - + api_helper_indexes& _self; }; } // end namespace detail @@ -154,11 +152,10 @@ api_helper_indexes::api_helper_indexes(graphene::app::application& app) : plugin(app), my( std::make_unique(*this) ) { + // Nothing else to do } -api_helper_indexes::~api_helper_indexes() -{ -} +api_helper_indexes::~api_helper_indexes() = default; std::string api_helper_indexes::plugin_name()const { diff --git a/libraries/plugins/api_helper_indexes/include/graphene/api_helper_indexes/api_helper_indexes.hpp b/libraries/plugins/api_helper_indexes/include/graphene/api_helper_indexes/api_helper_indexes.hpp index a6bb59b307..bfd7502ab1 100644 --- a/libraries/plugins/api_helper_indexes/include/graphene/api_helper_indexes/api_helper_indexes.hpp +++ b/libraries/plugins/api_helper_indexes/include/graphene/api_helper_indexes/api_helper_indexes.hpp @@ -79,7 +79,7 @@ namespace detail class api_helper_indexes : public graphene::app::plugin { public: - api_helper_indexes(graphene::app::application& app); + explicit api_helper_indexes(graphene::app::application& app); ~api_helper_indexes() override; std::string plugin_name()const override; diff --git a/libraries/plugins/custom_operations/custom_operations_plugin.cpp b/libraries/plugins/custom_operations/custom_operations_plugin.cpp index 1696b98f50..e9fb5b971c 100644 --- a/libraries/plugins/custom_operations/custom_operations_plugin.cpp +++ b/libraries/plugins/custom_operations/custom_operations_plugin.cpp @@ -35,10 +35,9 @@ namespace detail class custom_operations_plugin_impl { public: - custom_operations_plugin_impl(custom_operations_plugin& _plugin) + explicit custom_operations_plugin_impl(custom_operations_plugin& _plugin) : _self( _plugin ) { } - virtual ~custom_operations_plugin_impl(); void onBlock(); @@ -47,12 +46,12 @@ class custom_operations_plugin_impl return _self.database(); } - custom_operations_plugin& _self; - - uint32_t _start_block = 45000000; + friend class graphene::custom_operations::custom_operations_plugin; private: + custom_operations_plugin& _self; + uint32_t _start_block = 45000000; }; struct custom_op_visitor @@ -98,22 +97,16 @@ void custom_operations_plugin_impl::onBlock() } } -custom_operations_plugin_impl::~custom_operations_plugin_impl() -{ - // nothing to do -} - } // end namespace detail custom_operations_plugin::custom_operations_plugin(graphene::app::application& app) : plugin(app), my( std::make_unique(*this) ) { + // Nothing to do } -custom_operations_plugin::~custom_operations_plugin() -{ -} +custom_operations_plugin::~custom_operations_plugin() = default; std::string custom_operations_plugin::plugin_name()const { diff --git a/libraries/plugins/custom_operations/include/graphene/custom_operations/custom_operations_plugin.hpp b/libraries/plugins/custom_operations/include/graphene/custom_operations/custom_operations_plugin.hpp index e2a5fd9633..add8ce8637 100644 --- a/libraries/plugins/custom_operations/include/graphene/custom_operations/custom_operations_plugin.hpp +++ b/libraries/plugins/custom_operations/include/graphene/custom_operations/custom_operations_plugin.hpp @@ -41,7 +41,7 @@ namespace detail class custom_operations_plugin : public graphene::app::plugin { public: - custom_operations_plugin(graphene::app::application& app); + explicit custom_operations_plugin(graphene::app::application& app); ~custom_operations_plugin() override; std::string plugin_name()const override; @@ -52,7 +52,7 @@ class custom_operations_plugin : public graphene::app::plugin void plugin_initialize(const boost::program_options::variables_map& options) override; void plugin_startup() override; - friend class detail::custom_operations_plugin_impl; + private: std::unique_ptr my; }; diff --git a/libraries/plugins/delayed_node/delayed_node_plugin.cpp b/libraries/plugins/delayed_node/delayed_node_plugin.cpp index 18ef6b26b1..b16aadd233 100644 --- a/libraries/plugins/delayed_node/delayed_node_plugin.cpp +++ b/libraries/plugins/delayed_node/delayed_node_plugin.cpp @@ -47,17 +47,18 @@ struct delayed_node_plugin_impl { } delayed_node_plugin::delayed_node_plugin(graphene::app::application& app) : - plugin(app), - my(nullptr) -{} + plugin(app) +{ + // Nothing else to do +} -delayed_node_plugin::~delayed_node_plugin() -{} +delayed_node_plugin::~delayed_node_plugin() = default; void delayed_node_plugin::plugin_set_program_options(bpo::options_description& cli, bpo::options_description& cfg) { cli.add_options() - ("trusted-node", boost::program_options::value(), "RPC endpoint of a trusted validating node (required for delayed_node)") + ("trusted-node", boost::program_options::value(), + "RPC endpoint of a trusted validating node (required for delayed_node)") ; cfg.add(cli); } diff --git a/libraries/plugins/delayed_node/include/graphene/delayed_node/delayed_node_plugin.hpp b/libraries/plugins/delayed_node/include/graphene/delayed_node/delayed_node_plugin.hpp index 4e06c7fcfc..448d979782 100644 --- a/libraries/plugins/delayed_node/include/graphene/delayed_node/delayed_node_plugin.hpp +++ b/libraries/plugins/delayed_node/include/graphene/delayed_node/delayed_node_plugin.hpp @@ -32,12 +32,12 @@ class delayed_node_plugin : public graphene::app::plugin { std::unique_ptr my; public: - delayed_node_plugin(graphene::app::application& app); + explicit delayed_node_plugin(graphene::app::application& app); ~delayed_node_plugin() override; std::string plugin_name()const override { return "delayed_node"; } void plugin_set_program_options(boost::program_options::options_description&, - boost::program_options::options_description& cfg) override; + boost::program_options::options_description& cfg) override; void plugin_initialize(const boost::program_options::variables_map& options) override; void plugin_startup() override; void mainloop(); diff --git a/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp b/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp index 4eaa6643e9..d583afccc0 100644 --- a/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp +++ b/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp @@ -36,7 +36,7 @@ namespace detail class elasticsearch_plugin_impl { public: - elasticsearch_plugin_impl(elasticsearch_plugin& _plugin) + explicit elasticsearch_plugin_impl(elasticsearch_plugin& _plugin) : _self( _plugin ) { curl = curl_easy_init(); @@ -102,7 +102,6 @@ elasticsearch_plugin_impl::~elasticsearch_plugin_impl() curl_easy_cleanup(curl); curl = nullptr; } - return; } bool elasticsearch_plugin_impl::update_account_histories( const signed_block& b ) @@ -437,11 +436,10 @@ elasticsearch_plugin::elasticsearch_plugin(graphene::app::application& app) : plugin(app), my( std::make_unique(*this) ) { + // Nothing else to do } -elasticsearch_plugin::~elasticsearch_plugin() -{ -} +elasticsearch_plugin::~elasticsearch_plugin() = default; std::string elasticsearch_plugin::plugin_name()const { diff --git a/libraries/plugins/elasticsearch/include/graphene/elasticsearch/elasticsearch_plugin.hpp b/libraries/plugins/elasticsearch/include/graphene/elasticsearch/elasticsearch_plugin.hpp index 61f385efa0..fbd8366b3f 100644 --- a/libraries/plugins/elasticsearch/include/graphene/elasticsearch/elasticsearch_plugin.hpp +++ b/libraries/plugins/elasticsearch/include/graphene/elasticsearch/elasticsearch_plugin.hpp @@ -55,7 +55,7 @@ enum mode { only_save = 0 , only_query = 1, all = 2 }; class elasticsearch_plugin : public graphene::app::plugin { public: - elasticsearch_plugin(graphene::app::application& app); + explicit elasticsearch_plugin(graphene::app::application& app); ~elasticsearch_plugin() override; std::string plugin_name()const override; diff --git a/libraries/plugins/es_objects/es_objects.cpp b/libraries/plugins/es_objects/es_objects.cpp index e538edd370..2e0fd4613e 100644 --- a/libraries/plugins/es_objects/es_objects.cpp +++ b/libraries/plugins/es_objects/es_objects.cpp @@ -41,7 +41,7 @@ namespace detail class es_objects_plugin_impl { public: - es_objects_plugin_impl(es_objects_plugin& _plugin) + explicit es_objects_plugin_impl(es_objects_plugin& _plugin) : _self( _plugin ) { curl = curl_easy_init(); @@ -269,7 +269,6 @@ es_objects_plugin_impl::~es_objects_plugin_impl() curl_easy_cleanup(curl); curl = nullptr; } - return; } } // end namespace detail @@ -278,11 +277,10 @@ es_objects_plugin::es_objects_plugin(graphene::app::application& app) : plugin(app), my( std::make_unique(*this) ) { + // Nothing else to do } -es_objects_plugin::~es_objects_plugin() -{ -} +es_objects_plugin::~es_objects_plugin() = default; std::string es_objects_plugin::plugin_name()const { diff --git a/libraries/plugins/es_objects/include/graphene/es_objects/es_objects.hpp b/libraries/plugins/es_objects/include/graphene/es_objects/es_objects.hpp index b9bc339681..dff4812498 100644 --- a/libraries/plugins/es_objects/include/graphene/es_objects/es_objects.hpp +++ b/libraries/plugins/es_objects/include/graphene/es_objects/es_objects.hpp @@ -38,8 +38,8 @@ namespace detail class es_objects_plugin : public graphene::app::plugin { public: - es_objects_plugin(graphene::app::application& app); - ~es_objects_plugin(); + explicit es_objects_plugin(graphene::app::application& app); + ~es_objects_plugin() override; std::string plugin_name()const override; std::string plugin_description()const override; @@ -49,7 +49,7 @@ class es_objects_plugin : public graphene::app::plugin void plugin_initialize(const boost::program_options::variables_map& options) override; void plugin_startup() override; - friend class detail::es_objects_plugin_impl; + private: std::unique_ptr my; }; diff --git a/libraries/plugins/grouped_orders/grouped_orders_plugin.cpp b/libraries/plugins/grouped_orders/grouped_orders_plugin.cpp index da655026fd..b745ea494c 100644 --- a/libraries/plugins/grouped_orders/grouped_orders_plugin.cpp +++ b/libraries/plugins/grouped_orders/grouped_orders_plugin.cpp @@ -34,9 +34,8 @@ namespace detail class grouped_orders_plugin_impl { public: - grouped_orders_plugin_impl(grouped_orders_plugin& _plugin) + explicit grouped_orders_plugin_impl(grouped_orders_plugin& _plugin) :_self( _plugin ) {} - virtual ~grouped_orders_plugin_impl(); graphene::chain::database& database() { @@ -235,9 +234,6 @@ void limit_order_group_index::remove_order( const limit_order_object& o, bool re } } -grouped_orders_plugin_impl::~grouped_orders_plugin_impl() -{} - } // end namespace detail @@ -245,11 +241,10 @@ grouped_orders_plugin::grouped_orders_plugin(graphene::app::application& app) : plugin(app), my( std::make_unique(*this) ) { + // Nothing else to do } -grouped_orders_plugin::~grouped_orders_plugin() -{ -} +grouped_orders_plugin::~grouped_orders_plugin() = default; std::string grouped_orders_plugin::plugin_name()const { diff --git a/libraries/plugins/grouped_orders/include/graphene/grouped_orders/grouped_orders_plugin.hpp b/libraries/plugins/grouped_orders/include/graphene/grouped_orders/grouped_orders_plugin.hpp index 637e6e7925..4a0e4452ea 100644 --- a/libraries/plugins/grouped_orders/include/graphene/grouped_orders/grouped_orders_plugin.hpp +++ b/libraries/plugins/grouped_orders/include/graphene/grouped_orders/grouped_orders_plugin.hpp @@ -69,7 +69,7 @@ namespace detail class grouped_orders_plugin : public graphene::app::plugin { public: - grouped_orders_plugin(graphene::app::application& app); + explicit grouped_orders_plugin(graphene::app::application& app); ~grouped_orders_plugin() override; std::string plugin_name()const override; @@ -85,7 +85,6 @@ class grouped_orders_plugin : public graphene::app::plugin const map< limit_order_group_key, limit_order_group_data >& limit_order_groups(); private: - friend class detail::grouped_orders_plugin_impl; std::unique_ptr my; }; diff --git a/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp b/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp index 4021dad75e..bc70ae8794 100644 --- a/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp +++ b/libraries/plugins/market_history/include/graphene/market_history/market_history_plugin.hpp @@ -380,7 +380,7 @@ namespace detail class market_history_plugin : public graphene::app::plugin { public: - market_history_plugin(graphene::app::application& app); + explicit market_history_plugin(graphene::app::application& app); ~market_history_plugin() override; std::string plugin_name()const override; @@ -397,7 +397,6 @@ class market_history_plugin : public graphene::app::plugin uint32_t max_order_his_seconds_per_market()const; private: - friend class detail::market_history_plugin_impl; std::unique_ptr my; }; diff --git a/libraries/plugins/market_history/market_history_plugin.cpp b/libraries/plugins/market_history/market_history_plugin.cpp index f9211d1d36..adca4f5b77 100644 --- a/libraries/plugins/market_history/market_history_plugin.cpp +++ b/libraries/plugins/market_history/market_history_plugin.cpp @@ -43,9 +43,8 @@ namespace detail class market_history_plugin_impl { public: - market_history_plugin_impl(market_history_plugin& _plugin) + explicit market_history_plugin_impl(market_history_plugin& _plugin) :_self( _plugin ) {} - virtual ~market_history_plugin_impl(); /** this method is called as a callback after a block is applied * and will process/index all operations that were applied in the block. @@ -294,9 +293,6 @@ struct operation_process_fill_order } }; -market_history_plugin_impl::~market_history_plugin_impl() -{} - void market_history_plugin_impl::update_market_histories( const signed_block& b ) { graphene::chain::database& db = database(); @@ -731,19 +727,14 @@ void market_history_plugin_impl::update_liquidity_pool_histories( } // end namespace detail - - - - market_history_plugin::market_history_plugin(graphene::app::application& app) : plugin(app), my( std::make_unique(*this) ) { + // Nothing else to do } -market_history_plugin::~market_history_plugin() -{ -} +market_history_plugin::~market_history_plugin() = default; std::string market_history_plugin::plugin_name()const { diff --git a/libraries/plugins/template_plugin/include/graphene/template_plugin/template_plugin.hpp b/libraries/plugins/template_plugin/include/graphene/template_plugin/template_plugin.hpp index 12d4ae4d1e..b9ccee9b79 100644 --- a/libraries/plugins/template_plugin/include/graphene/template_plugin/template_plugin.hpp +++ b/libraries/plugins/template_plugin/include/graphene/template_plugin/template_plugin.hpp @@ -52,7 +52,7 @@ namespace detail class template_plugin : public graphene::app::plugin { public: - template_plugin(graphene::app::application& app); + explicit template_plugin(graphene::app::application& app); ~template_plugin() override; std::string plugin_name()const override; @@ -64,7 +64,6 @@ class template_plugin : public graphene::app::plugin void plugin_startup() override; void plugin_shutdown() override; - friend class detail::template_plugin_impl; private: void cleanup(); std::unique_ptr my; diff --git a/libraries/plugins/template_plugin/template_plugin.cpp b/libraries/plugins/template_plugin/template_plugin.cpp index 3f96a79081..72020a8588 100644 --- a/libraries/plugins/template_plugin/template_plugin.cpp +++ b/libraries/plugins/template_plugin/template_plugin.cpp @@ -32,9 +32,7 @@ namespace detail class template_plugin_impl { public: - template_plugin_impl(template_plugin& _plugin) - : _self( _plugin ) - { } + explicit template_plugin_impl( template_plugin& _plugin ); virtual ~template_plugin_impl(); void on_block( const signed_block& b ); @@ -44,12 +42,13 @@ class template_plugin_impl return _self.database(); } + friend class graphene::template_plugin::template_plugin; + + private: template_plugin& _self; std::string _plugin_option = ""; - private: - }; void template_plugin_impl::on_block( const signed_block& b ) @@ -57,9 +56,15 @@ void template_plugin_impl::on_block( const signed_block& b ) wdump((b.block_num())); } +template_plugin_impl::template_plugin_impl( template_plugin& _plugin ) : + _self( _plugin ) +{ + // Put other code here +} + template_plugin_impl::~template_plugin_impl() { - // Put the real code here + // Put the real code here. If none, remove the destructor. } } // end namespace detail