From 5019af50b9a2236dd75e630aae5b82e440be9620 Mon Sep 17 00:00:00 2001 From: Conlain Kelly Date: Wed, 18 Jul 2018 11:13:50 -0400 Subject: Replace utils::SharedPtr with std::shared_ptr, remove non-standard usage --- .../include/policy/access_remote_impl.h | 6 +++--- .../policy_regular/include/policy/cache_manager.h | 12 ++++++------ .../include/policy/cache_manager_interface.h | 12 ++++++------ .../policy_regular/include/policy/policy_helper.h | 10 +++++----- .../include/policy/policy_manager_impl.h | 16 ++++++++-------- .../policy_regular/include/policy/policy_table.h | 8 ++++---- .../policy_regular/include/policy/policy_types.h | 5 +++-- .../include/policy/pt_representation.h | 4 +++- .../include/policy/sql_pt_representation.h | 2 +- .../include/policy/update_status_manager.h | 10 +++++----- .../include/policy/update_status_manager_interface.h | 8 ++++---- .../include/policy/usage_statistics/counter.h | 20 ++++++++++---------- 12 files changed, 58 insertions(+), 55 deletions(-) (limited to 'src/components/policy/policy_regular/include/policy') diff --git a/src/components/policy/policy_regular/include/policy/access_remote_impl.h b/src/components/policy/policy_regular/include/policy/access_remote_impl.h index 933690dc49..dbe317667a 100644 --- a/src/components/policy/policy_regular/include/policy/access_remote_impl.h +++ b/src/components/policy/policy_regular/include/policy/access_remote_impl.h @@ -35,7 +35,7 @@ #include #include "policy/policy_table/types.h" #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "policy/access_remote.h" #include "policy/cache_manager.h" @@ -46,7 +46,7 @@ namespace policy { class AccessRemoteImpl : public AccessRemote { public: AccessRemoteImpl(); - explicit AccessRemoteImpl(utils::SharedPtr cache); + explicit AccessRemoteImpl(std::shared_ptr cache); /** * @brief CheckModuleType check if module type is allowed for application * @param app_id application id @@ -139,7 +139,7 @@ class AccessRemoteImpl : public AccessRemote { /** * @brief cache_ contains pointer to cache manager instance */ - utils::SharedPtr cache_; + std::shared_ptr cache_; /** * @brief hmi_types_ contains list of default HMI types for applications diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h index 4a0a09db83..236722415f 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager.h @@ -35,7 +35,7 @@ #include -#include "utils/shared_ptr.h" + #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" #include "policy/usage_statistics/statistics_manager.h" @@ -216,7 +216,7 @@ class CacheManager : public CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr GenerateSnapshot(); + virtual std::shared_ptr GenerateSnapshot(); /** * Applies policy table to the current table @@ -723,7 +723,7 @@ class CacheManager : public CacheManagerInterface { const PolicySettings& get_settings() const; - utils::SharedPtr pt() const { + std::shared_ptr pt() const { return pt_; } @@ -775,9 +775,9 @@ class CacheManager : public CacheManagerInterface { policy::Permissions& permission); private: - utils::SharedPtr pt_; - utils::SharedPtr snapshot_; - utils::SharedPtr backup_; + std::shared_ptr pt_; + std::shared_ptr snapshot_; + std::shared_ptr backup_; bool update_required; typedef std::set UnpairedDevices; UnpairedDevices is_unpaired_; diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h index 3dd2953865..ba6728c520 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h @@ -36,7 +36,7 @@ #include #include -#include "utils/shared_ptr.h" + #include "policy/usage_statistics/counter.h" #include "policy/policy_types.h" #include "policy/policy_settings.h" @@ -222,7 +222,7 @@ class CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr GenerateSnapshot() = 0; + virtual std::shared_ptr GenerateSnapshot() = 0; /** * Applies policy table to the current table @@ -670,12 +670,12 @@ class CacheManagerInterface { virtual std::string GetCertificate() const = 0; /** - * @brief pt allows to obtain SharedPtr to PT. + * @brief pt allows to obtain std::shared_ptr to PT. * Used ONLY in Unit tests - * @return SharedPTR to PT + * @return std::shared_ptr to PT * */ - virtual utils::SharedPtr pt() const = 0; + virtual std::shared_ptr pt() const = 0; /** * @brief OnDeviceSwitching Processes existing policy permissions for devices @@ -687,7 +687,7 @@ class CacheManagerInterface { const std::string& device_id_to) = 0; }; -typedef utils::SharedPtr CacheManagerInterfaceSPtr; +typedef std::shared_ptr CacheManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/policy_helper.h b/src/components/policy/policy_regular/include/policy/policy_helper.h index 7f27ab2676..3ca0f93ebd 100644 --- a/src/components/policy/policy_regular/include/policy/policy_helper.h +++ b/src/components/policy/policy_regular/include/policy/policy_helper.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_HELPER_H_ #include "policy/policy_table/functions.h" -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" namespace policy { @@ -82,8 +82,8 @@ bool operator!=(const policy_table::ApplicationParams& first, */ struct CheckAppPolicy { CheckAppPolicy(PolicyManagerImpl* pm, - const utils::SharedPtr update, - const utils::SharedPtr snapshot); + const std::shared_ptr update, + const std::shared_ptr snapshot); bool operator()(const AppPoliciesValueType& app_policy); private: @@ -131,8 +131,8 @@ struct CheckAppPolicy { private: PolicyManagerImpl* pm_; - const utils::SharedPtr update_; - const utils::SharedPtr snapshot_; + const std::shared_ptr update_; + const std::shared_ptr snapshot_; }; /* diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index c162d73011..549fdd5a53 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -37,7 +37,7 @@ #include #include -#include "utils/shared_ptr.h" + #include "utils/lock.h" #include "policy/policy_manager.h" #include "policy/policy_table.h" @@ -467,7 +467,7 @@ class PolicyManagerImpl : public PolicyManager { * @brief Setter for access_remote instance * @param access_remote pointer to new access_remote instance */ - void set_access_remote(utils::SharedPtr access_remote) OVERRIDE; + void set_access_remote(std::shared_ptr access_remote) OVERRIDE; /** * @brief Sends notification about application HMI level changed @@ -671,7 +671,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr Parse( + virtual std::shared_ptr Parse( const BinaryMessage& pt_content); #else /** @@ -679,7 +679,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr ParseArray( + virtual std::shared_ptr ParseArray( const BinaryMessage& pt_content); #endif @@ -705,8 +705,8 @@ class PolicyManagerImpl : public PolicyManager { * @return Collection per-application results */ void CheckPermissionsChanges( - const utils::SharedPtr update, - const utils::SharedPtr snapshot); + const std::shared_ptr update, + const std::shared_ptr snapshot); /** * @brief Fill structure to be sent with OnPermissionsChanged notification @@ -803,7 +803,7 @@ class PolicyManagerImpl : public PolicyManager { * @param type policy table type * @return true if policy table valid, otherwise false */ - bool IsPTValid(utils::SharedPtr policy_table, + bool IsPTValid(std::shared_ptr policy_table, policy_table::PolicyTableType type) const; /** @@ -867,7 +867,7 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief pointer to AccessRemote instance for working with RC applications */ - utils::SharedPtr access_remote_; + std::shared_ptr access_remote_; /** * @brief lock guard for protecting applications list access diff --git a/src/components/policy/policy_regular/include/policy/policy_table.h b/src/components/policy/policy_regular/include/policy/policy_table.h index afee8a34e4..9531bb8c79 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table.h +++ b/src/components/policy/policy_regular/include/policy/policy_table.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_ -#include "utils/shared_ptr.h" + #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" @@ -42,7 +42,7 @@ namespace policy { class PolicyTable { public: PolicyTable(); - explicit PolicyTable(utils::SharedPtr pt_data); + explicit PolicyTable(std::shared_ptr pt_data); virtual ~PolicyTable(); /** @@ -50,12 +50,12 @@ class PolicyTable { * actual class storing policy table. * @return PTRepresentation* Policy Table Content Handler */ - utils::SharedPtr pt_data() const { + std::shared_ptr pt_data() const { return pt_data_; } private: - utils::SharedPtr pt_data_; + std::shared_ptr pt_data_; }; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/policy_types.h b/src/components/policy/policy_regular/include/policy/policy_types.h index e0fc808e2f..276a0a5dca 100644 --- a/src/components/policy/policy_regular/include/policy/policy_types.h +++ b/src/components/policy/policy_regular/include/policy/policy_types.h @@ -39,7 +39,8 @@ #include #include #include -#include "utils/shared_ptr.h" +#include + #include "utils/helpers.h" #include "transport_manager/common.h" @@ -79,7 +80,7 @@ enum PolicyTableStatus { // Code generator uses String class name, so this typedef was renamed to PTSring typedef std::string PTString; typedef std::vector BinaryMessage; -typedef utils::SharedPtr BinaryMessageSptr; +typedef std::shared_ptr BinaryMessageSptr; typedef std::string HMILevel; typedef std::string Parameter; diff --git a/src/components/policy/policy_regular/include/policy/pt_representation.h b/src/components/policy/policy_regular/include/policy/pt_representation.h index 08bd6d4923..378a294532 100644 --- a/src/components/policy/policy_regular/include/policy/pt_representation.h +++ b/src/components/policy/policy_regular/include/policy/pt_representation.h @@ -35,9 +35,11 @@ #include #include +#include #include "policy/policy_types.h" #include "policy/policy_table/types.h" #include "policy/policy_settings.h" +#include "utils/macro.h" namespace policy { namespace policy_table = rpc::policy_table_interface_base; @@ -208,7 +210,7 @@ class PTRepresentation { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr GenerateSnapshot() const = 0; + virtual std::shared_ptr GenerateSnapshot() const = 0; virtual bool Save(const policy_table::Table& table) = 0; diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h index b26b2c9ede..0e9302dfac 100644 --- a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h @@ -84,7 +84,7 @@ class SQLPTRepresentation : public virtual PTRepresentation { bool Clear(); bool Drop(); virtual void WriteDb(); - virtual utils::SharedPtr GenerateSnapshot() const; + virtual std::shared_ptr GenerateSnapshot() const; virtual bool Save(const policy_table::Table& table); bool GetInitialAppData(const std::string& app_id, StringArray* nicknames = NULL, diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager.h b/src/components/policy/policy_regular/include/policy/update_status_manager.h index a68d986d10..52d5b92b8a 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager.h @@ -66,14 +66,14 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { * @brief Set next status during event processing * @param status Status shared pointer */ - void SetNextStatus(utils::SharedPtr status); + void SetNextStatus(std::shared_ptr status); /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - void SetPostponedStatus(utils::SharedPtr status); + void SetPostponedStatus(std::shared_ptr status); /** * @brief Sets listener pointer @@ -198,17 +198,17 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { /** * @brief Current update status */ - utils::SharedPtr current_status_; + std::shared_ptr current_status_; /** * @brief Next status after current to be set */ - utils::SharedPtr next_status_; + std::shared_ptr next_status_; /** * @brief Status to be set after 'next' status */ - utils::SharedPtr postponed_status_; + std::shared_ptr postponed_status_; sync_primitives::Lock status_lock_; UpdateEvent last_processed_event_; diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h index e118f9974f..520615489a 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" #include "policy/status.h" @@ -55,14 +55,14 @@ class UpdateStatusManagerInterface { * @brief Set next status during event processing * @param status Status shared pointer */ - virtual void SetNextStatus(utils::SharedPtr status) = 0; + virtual void SetNextStatus(std::shared_ptr status) = 0; /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - virtual void SetPostponedStatus(utils::SharedPtr status) = 0; + virtual void SetPostponedStatus(std::shared_ptr status) = 0; /** * @brief Sets listener pointer * @param listener Pointer to policy listener implementation @@ -112,7 +112,7 @@ class UpdateStatusManagerInterface { virtual void OnPolicyInit(bool is_update_required) = 0; }; -typedef utils::SharedPtr +typedef std::shared_ptr UpdateStatusManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h index 1e263ec9df..72ae5fd9e0 100644 --- a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h +++ b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h @@ -36,7 +36,7 @@ #include #include "policy/usage_statistics/statistics_manager.h" #include "policy/usage_statistics/app_stopwatch.h" -#include "utils/shared_ptr.h" + #include "utils/timer.h" #include "utils/macro.h" @@ -46,18 +46,18 @@ using timer::Timer; class GlobalCounter { public: - GlobalCounter(utils::SharedPtr statistics_manager, + GlobalCounter(std::shared_ptr statistics_manager, GlobalCounterId counter_type); void operator++() const; private: GlobalCounterId counter_type_; - utils::SharedPtr statistics_manager_; + std::shared_ptr statistics_manager_; }; class AppCounter { public: - AppCounter(utils::SharedPtr statistics_manager, + AppCounter(std::shared_ptr statistics_manager, const std::string& app_id, AppCounterId counter_type); void operator++() const; @@ -65,12 +65,12 @@ class AppCounter { private: std::string app_id_; AppCounterId counter_type_; - utils::SharedPtr statistics_manager_; + std::shared_ptr statistics_manager_; }; class AppInfo { public: - AppInfo(utils::SharedPtr statistics_manager, + AppInfo(std::shared_ptr statistics_manager, const std::string& app_id, AppInfoId info_type); void Update(const std::string& new_info) const; @@ -78,14 +78,14 @@ class AppInfo { private: std::string app_id_; AppInfoId info_type_; - utils::SharedPtr statistics_manager_; + std::shared_ptr statistics_manager_; }; class AppStopwatchImpl : public AppStopwatch { public: - AppStopwatchImpl(utils::SharedPtr statistics_manager, + AppStopwatchImpl(std::shared_ptr statistics_manager, const std::string& app_id); - AppStopwatchImpl(utils::SharedPtr statistics_manager, + AppStopwatchImpl(std::shared_ptr statistics_manager, const std::string& app_id, std::uint32_t timeout); void Start(AppStopwatchId stopwatch_type) OVERRIDE; @@ -96,7 +96,7 @@ class AppStopwatchImpl : public AppStopwatch { // Fields std::string app_id_; AppStopwatchId stopwatch_type_; - utils::SharedPtr statistics_manager_; + std::shared_ptr statistics_manager_; timer::Timer timer_; const std::uint32_t time_out_; DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl); -- cgit v1.2.1