diff options
Diffstat (limited to 'src/components/policy')
57 files changed, 286 insertions, 283 deletions
diff --git a/src/components/policy/policy_external/include/policy/access_remote_impl.h b/src/components/policy/policy_external/include/policy/access_remote_impl.h index 0fa53b0237..cee2a8774f 100644 --- a/src/components/policy/policy_external/include/policy/access_remote_impl.h +++ b/src/components/policy/policy_external/include/policy/access_remote_impl.h @@ -35,7 +35,7 @@ #include <map> #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<CacheManager> cache); + explicit AccessRemoteImpl(std::shared_ptr<CacheManager> cache); /** * @brief CheckModuleType check if module type is allowed for application * @param app_id application id @@ -144,7 +144,7 @@ class AccessRemoteImpl : public AccessRemote { /** * @brief cache_ contains pointer to cache manager instance */ - utils::SharedPtr<CacheManager> cache_; + std::shared_ptr<CacheManager> cache_; /** * @brief hmi_types_ contains list of default HMI types for applications diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h index f41ddb14cd..36ddaf0415 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager.h +++ b/src/components/policy/policy_external/include/policy/cache_manager.h @@ -35,7 +35,7 @@ #include <map> -#include "utils/shared_ptr.h" + #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" #include "policy/usage_statistics/statistics_manager.h" @@ -232,7 +232,7 @@ class CacheManager : public CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot(); + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot(); /** * Applies policy table to the current table @@ -720,7 +720,7 @@ class CacheManager : public CacheManagerInterface { void SetExternalConsentForApp(const PermissionConsent& permissions) OVERRIDE; #ifdef BUILD_TESTS - utils::SharedPtr<policy_table::Table> GetPT() const { + std::shared_ptr<policy_table::Table> GetPT() const { return pt_; } #endif @@ -782,10 +782,10 @@ class CacheManager : public CacheManagerInterface { policy::Permissions& permission); private: - utils::SharedPtr<policy_table::Table> pt_; - utils::SharedPtr<policy_table::Table> snapshot_; - utils::SharedPtr<PTRepresentation> backup_; - utils::SharedPtr<PTExtRepresentation> ex_backup_; + std::shared_ptr<policy_table::Table> pt_; + std::shared_ptr<policy_table::Table> snapshot_; + std::shared_ptr<PTRepresentation> backup_; + std::shared_ptr<PTExtRepresentation> ex_backup_; bool update_required; typedef std::set<std::string> UnpairedDevices; UnpairedDevices is_unpaired_; diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h index 1d74780f19..bb9ce14c7f 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h @@ -38,7 +38,7 @@ #include "policy/policy_table/types.h" #include "policy/pt_representation.h" -#include "utils/shared_ptr.h" + #include "policy/usage_statistics/counter.h" #include "policy/policy_types.h" #include "policy/policy_settings.h" @@ -237,7 +237,7 @@ class CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() = 0; /** * Applies policy table to the current table @@ -823,16 +823,16 @@ class CacheManagerInterface { #ifdef BUILD_TESTS /** - * @brief GetPT allows to obtain SharedPtr to PT. + * @brief GetPT 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<policy_table::Table> GetPT() const = 0; + virtual std::shared_ptr<policy_table::Table> GetPT() const = 0; #endif }; -typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; +typedef std::shared_ptr<CacheManagerInterface> CacheManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_external/include/policy/policy_helper.h b/src/components/policy/policy_external/include/policy/policy_helper.h index e399b44719..e446c0b2e3 100644 --- a/src/components/policy/policy_external/include/policy/policy_helper.h +++ b/src/components/policy/policy_external/include/policy/policy_helper.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_HELPER_H_ #include "policy/policy_table/functions.h" -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" namespace policy { @@ -85,8 +85,8 @@ bool operator!=(const policy_table::ApplicationParams& first, */ struct CheckAppPolicy { CheckAppPolicy(PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot, + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot, CheckAppPolicyResults& out_results); bool operator()(const AppPoliciesValueType& app_policy); @@ -202,8 +202,8 @@ struct CheckAppPolicy { private: PolicyManagerImpl* pm_; - const utils::SharedPtr<policy_table::Table> update_; - const utils::SharedPtr<policy_table::Table> snapshot_; + const std::shared_ptr<policy_table::Table> update_; + const std::shared_ptr<policy_table::Table> snapshot_; CheckAppPolicyResults& out_results_; }; diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index 67756c053d..3837dda1fa 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_ #include <list> -#include "utils/shared_ptr.h" + #include "utils/lock.h" #include "policy/policy_manager.h" #include "policy/policy_table.h" @@ -472,7 +472,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<AccessRemote> access_remote) OVERRIDE; + void set_access_remote(std::shared_ptr<AccessRemote> access_remote) OVERRIDE; /** * @brief Sends notification about application HMI level changed @@ -717,7 +717,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr<policy_table::Table> Parse( + virtual std::shared_ptr<policy_table::Table> Parse( const BinaryMessage& pt_content); private: @@ -736,8 +736,8 @@ class PolicyManagerImpl : public PolicyManager { * @return Collection per-application results */ CheckAppPolicyResults CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); /** * @brief Processes results from policy table update analysis done by @@ -860,7 +860,7 @@ class PolicyManagerImpl : public PolicyManager { * @param type policy table type * @return true if policy table valid, otherwise false */ - bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, + bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; /** @@ -1017,7 +1017,7 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief pointer to AccessRemote instance for working with RC applications */ - utils::SharedPtr<AccessRemote> access_remote_; + std::shared_ptr<AccessRemote> access_remote_; /** * @brief lock guard for protecting applications list access diff --git a/src/components/policy/policy_external/include/policy/policy_table.h b/src/components/policy/policy_external/include/policy/policy_table.h index ecbd56c2e4..27f4cc33a2 100644 --- a/src/components/policy/policy_external/include/policy/policy_table.h +++ b/src/components/policy/policy_external/include/policy/policy_table.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_H_ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_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<PTRepresentation> pt_data); + explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data); virtual ~PolicyTable(); /** @@ -50,12 +50,12 @@ class PolicyTable { * actual class storing policy table. * @return PTRepresentation* Policy Table Content Handler */ - utils::SharedPtr<PTRepresentation> pt_data() const { + std::shared_ptr<PTRepresentation> pt_data() const { return pt_data_; } private: - utils::SharedPtr<PTRepresentation> pt_data_; + std::shared_ptr<PTRepresentation> pt_data_; }; } // namespace policy diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index 9682b3d58d..078595e8b1 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -39,7 +39,7 @@ #include <map> #include <set> #include <utility> -#include "utils/shared_ptr.h" + #include "utils/helpers.h" #include "transport_manager/common.h" @@ -79,7 +79,7 @@ enum PolicyTableStatus { // Code generator uses String class name, so this typedef was renamed to PTSring typedef std::string PTString; typedef std::vector<uint8_t> BinaryMessage; -typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr; +typedef std::shared_ptr<BinaryMessage> BinaryMessageSptr; typedef std::string HMILevel; typedef std::string Parameter; diff --git a/src/components/policy/policy_external/include/policy/pt_representation.h b/src/components/policy/policy_external/include/policy/pt_representation.h index 66a9218771..f25fcc6cab 100644 --- a/src/components/policy/policy_external/include/policy/pt_representation.h +++ b/src/components/policy/policy_external/include/policy/pt_representation.h @@ -213,7 +213,7 @@ class PTRepresentation { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const = 0; virtual bool Save(const policy_table::Table& table) = 0; diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h index d56f6aeba2..13816eb6c5 100644 --- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h @@ -85,7 +85,7 @@ class SQLPTRepresentation : public virtual PTRepresentation { bool Clear(); bool Drop(); virtual void WriteDb(); - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const; + virtual std::shared_ptr<policy_table::Table> 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_external/include/policy/update_status_manager.h b/src/components/policy/policy_external/include/policy/update_status_manager.h index b663610a5b..cdd1225ef7 100644 --- a/src/components/policy/policy_external/include/policy/update_status_manager.h +++ b/src/components/policy/policy_external/include/policy/update_status_manager.h @@ -66,14 +66,14 @@ class UpdateStatusManager { * @brief Set next status during event processing * @param status Status shared pointer */ - void SetNextStatus(utils::SharedPtr<Status> status); + void SetNextStatus(std::shared_ptr<Status> status); /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - void SetPostponedStatus(utils::SharedPtr<Status> status); + void SetPostponedStatus(std::shared_ptr<Status> status); /** * @brief Sets listener pointer @@ -199,17 +199,17 @@ class UpdateStatusManager { /** * @brief Current update status */ - utils::SharedPtr<Status> current_status_; + std::shared_ptr<Status> current_status_; /** * @brief Next status after current to be set */ - utils::SharedPtr<Status> next_status_; + std::shared_ptr<Status> next_status_; /** * @brief Status to be set after 'next' status */ - utils::SharedPtr<Status> postponed_status_; + std::shared_ptr<Status> postponed_status_; sync_primitives::Lock status_lock_; UpdateEvent last_processed_event_; diff --git a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h index adaef0eb28..c145bb432b 100644 --- a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h +++ b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h @@ -36,7 +36,7 @@ #include <ctime> #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<StatisticsManager> statistics_manager, + GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type); void operator++() const; private: GlobalCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppCounter { public: - AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + AppCounter(std::shared_ptr<StatisticsManager> 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<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppInfo { public: - AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, + AppInfo(std::shared_ptr<StatisticsManager> 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<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppStopwatchImpl : public AppStopwatch { public: - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id); - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, std::uint32_t timeout); ~AppStopwatchImpl(); @@ -97,7 +97,7 @@ class AppStopwatchImpl : public AppStopwatch { // Fields std::string app_id_; AppStopwatchId stopwatch_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; timer::Timer timer_; const std::uint32_t time_out_; DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl); diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc index d042d8c402..26c8c5e38e 100644 --- a/src/components/policy/policy_external/src/access_remote_impl.cc +++ b/src/components/policy/policy_external/src/access_remote_impl.cc @@ -89,7 +89,7 @@ struct ToModuleType { AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} -AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) +AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) : cache_(cache) {} bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 00bb1e4a1c..b30ed3c224 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -1627,8 +1627,8 @@ void CacheManager::CheckSnapshotInitialization() { void CacheManager::PersistData() { LOG4CXX_AUTO_TRACE(logger_); - if (backup_.valid()) { - if (pt_.valid()) { + if (backup_.use_count() != 0) { + if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor // call policy_table::Table copy_pt( @@ -1670,7 +1670,7 @@ void CacheManager::PersistData() { } // In case of extended policy the meta info should be backuped as well. - if (ex_backup_.valid()) { + if (ex_backup_.use_count() != 0) { ex_backup_->SetMetaInfo( *(*copy_pt.policy_table.module_meta).ccpu_version, *(*copy_pt.policy_table.module_meta).wers_country_code, @@ -1750,7 +1750,7 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id, return false; } -utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() { +std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { CACHE_MANAGER_CHECK(snapshot_); snapshot_ = new policy_table::Table(); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -2237,7 +2237,7 @@ bool CacheManager::Init(const std::string& file_name, LOG4CXX_AUTO_TRACE(logger_); settings_ = settings; InitResult init_result = backup_->Init(settings); - ex_backup_ = utils::SharedPtr<PTRepresentation>::dynamic_pointer_cast< + ex_backup_ = std::dynamic_pointer_cast< PTExtRepresentation>(backup_); bool result = true; @@ -2261,7 +2261,7 @@ bool CacheManager::Init(const std::string& file_name, case InitResult::SUCCESS: { LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); result = LoadFromFile(file_name, *pt_); - utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); LOG4CXX_DEBUG(logger_, diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index 39b9399c24..ed12cdde3a 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -122,8 +122,8 @@ bool operator!=(const policy_table::ApplicationParams& first, CheckAppPolicy::CheckAppPolicy( PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot, + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot, CheckAppPolicyResults& out_results) : pm_(pm) , update_(update) diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 4ac66c0d53..c75d14a67a 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -49,7 +49,7 @@ #include "policy/cache_manager.h" #include "policy/update_status_manager.h" #include "config_profile/profile.h" -#include "utils/make_shared.h" + #include "policy/access_remote.h" #include "policy/access_remote_impl.h" @@ -214,7 +214,7 @@ PolicyManagerImpl::PolicyManagerImpl() , listener_(NULL) , cache_(new CacheManager) , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) + std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) @@ -225,7 +225,7 @@ PolicyManagerImpl::PolicyManagerImpl(bool in_memory) , listener_(NULL) , cache_(new CacheManager(in_memory)) , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) + std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) @@ -239,7 +239,7 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { update_status_manager_.set_listener(listener); } -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; @@ -247,7 +247,7 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( if (reader.parse(json.c_str(), value)) { return new policy_table::Table(&value); } else { - return utils::SharedPtr<policy_table::Table>(); + return std::shared_ptr<policy_table::Table>(); } } @@ -279,7 +279,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); // Parse message into table struct - utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); + std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); if (!pt_update) { LOG4CXX_WARN(logger_, "Parsed table pointer is NULL."); update_status_manager_.OnWrongUpdateReceived(); @@ -301,7 +301,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, sync_primitives::AutoLock lock(apps_registration_lock_); // Get current DB data, since it could be updated during awaiting of PTU - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR( @@ -363,8 +363,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, } CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> pt_update, - const utils::SharedPtr<policy_table::Table> snapshot) { + const std::shared_ptr<policy_table::Table> pt_update, + const std::shared_ptr<policy_table::Table> snapshot) { LOG4CXX_INFO(logger_, "Checking incoming permissions."); // Replace predefined policies with its actual setting, e.g. "123":"default" @@ -468,7 +468,7 @@ void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, void PolicyManagerImpl::RequestPTUpdate() { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); @@ -1276,7 +1276,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() { } bool PolicyManagerImpl::IsPTValid( - utils::SharedPtr<policy_table::Table> policy_table, + std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { @@ -1367,7 +1367,7 @@ void PolicyManagerImpl::SendPermissionsToApp( Permissions notification_data; // Need to get rid of this call - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); PrepareNotificationData( @@ -1775,11 +1775,11 @@ StatusNotifier PolicyManagerImpl::AddApplication( sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { AddNewApplication(application_id, device_consent); - return utils::MakeShared<CallStatusChange>(update_status_manager_, + return std::make_shared<CallStatusChange>(update_status_manager_, device_consent); } else { PromoteExistedApplication(application_id, device_consent); - return utils::MakeShared<utils::CallNothing>(); + return std::make_shared<utils::CallNothing>(); } } @@ -2024,7 +2024,7 @@ bool PolicyManagerImpl::GetModuleTypes( } void PolicyManagerImpl::set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) { + std::shared_ptr<AccessRemote> access_remote) { access_remote_ = access_remote; } diff --git a/src/components/policy/policy_external/src/policy_table.cc b/src/components/policy/policy_external/src/policy_table.cc index 7a63fac50d..8ca6b698d1 100644 --- a/src/components/policy/policy_external/src/policy_table.cc +++ b/src/components/policy/policy_external/src/policy_table.cc @@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTExtRepresentation()) {} -PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) +PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 3cd7388672..47a7cb6623 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -513,10 +513,10 @@ bool SQLPTRepresentation::RefreshDB() { return true; } -utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() +std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); + std::shared_ptr<policy_table::Table> table = new policy_table::Table(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts); diff --git a/src/components/policy/policy_external/src/status.cc b/src/components/policy/policy_external/src/status.cc index 31fc7f110b..34f65339c1 100644 --- a/src/components/policy/policy_external/src/status.cc +++ b/src/components/policy/policy_external/src/status.cc @@ -32,7 +32,7 @@ #include "policy/status.h" #include "policy/update_status_manager.h" -#include "utils/make_shared.h" + policy::UpToDateStatus::UpToDateStatus() : Status(kUpToDate, policy::PolicyTableStatus::StatusUpToDate) {} @@ -45,7 +45,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManager* manager, case kScheduleUpdate: case kScheduleManualUpdate: case kOnResetRetrySequence: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -59,14 +59,14 @@ void policy::UpdateNeededStatus::ProcessEvent( policy::UpdateStatusManager* manager, policy::UpdateEvent event) { switch (event) { case kOnUpdateSentOut: - manager->SetNextStatus(utils::MakeShared<UpdatingStatus>()); + manager->SetNextStatus(std::make_shared<UpdatingStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; default: break; @@ -85,23 +85,23 @@ void policy::UpdatingStatus::ProcessEvent(policy::UpdateStatusManager* manager, switch (event) { case kOnValidUpdateReceived: case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnWrongUpdateReceived: case kOnUpdateTimeout: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kScheduleUpdate: case kScheduleManualUpdate: case kOnResetRetrySequence: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc index 087db1149b..aee22a3b0c 100644 --- a/src/components/policy/policy_external/src/update_status_manager.cc +++ b/src/components/policy/policy_external/src/update_status_manager.cc @@ -33,7 +33,7 @@ #include "policy/update_status_manager.h" #include "policy/policy_listener.h" #include "utils/logger.h" -#include "utils/make_shared.h" + namespace policy { @@ -41,7 +41,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) - , current_status_(utils::MakeShared<UpToDateStatus>()) + , current_status_(std::make_shared<UpToDateStatus>()) , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) { @@ -67,11 +67,11 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { DoTransition(); } -void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) { next_status_ = status; } -void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) { postponed_status_ = status; } diff --git a/src/components/policy/policy_external/src/usage_statistics/counter.cc b/src/components/policy/policy_external/src/usage_statistics/counter.cc index 661ea29704..a7e8368239 100644 --- a/src/components/policy/policy_external/src/usage_statistics/counter.cc +++ b/src/components/policy/policy_external/src/usage_statistics/counter.cc @@ -36,13 +36,13 @@ #include <cassert> #include "policy/usage_statistics/counter.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace usage_statistics { GlobalCounter::GlobalCounter( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, GlobalCounterId counter_type) : counter_type_(counter_type), statistics_manager_(statistics_manager) {} @@ -53,7 +53,7 @@ void GlobalCounter::operator++() const { } AppCounter::AppCounter( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type) : app_id_(app_id) @@ -67,7 +67,7 @@ void AppCounter::operator++() const { } AppInfo::AppInfo( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type) : app_id_(app_id) @@ -81,7 +81,7 @@ void AppInfo::Update(const std::string& new_info) const { } AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, const std::string& app_id) : app_id_(app_id) , stopwatch_type_(SECONDS_HMI_NONE) @@ -92,7 +92,7 @@ AppStopwatchImpl::AppStopwatchImpl( , time_out_(60) {} AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, uint32_t timeout) : app_id_(app_id) diff --git a/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h index 995c63ed20..3870e4ece1 100644 --- a/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h +++ b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h @@ -78,7 +78,7 @@ class MockPTRepresentation : virtual public ::policy::PTRepresentation { MOCK_METHOD0(Close, bool()); MOCK_METHOD0(Clear, bool()); MOCK_METHOD0(Drop, bool()); - MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(Save, bool(const policy_table::Table& table)); MOCK_CONST_METHOD0(UpdateRequired, bool()); MOCK_METHOD1(SaveUpdateRequired, void(bool value)); diff --git a/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h index e753751308..23701e86de 100644 --- a/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h +++ b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h @@ -54,7 +54,7 @@ using ::policy::PolicyManagerImpl; typedef std::multimap<std::string, policy_table::Rpcs&> UserConsentPromptToRpcsConnections; -typedef utils::SharedPtr<policy_table::Table> PolicyTableSPtr; +typedef std::shared_ptr<policy_table::Table> PolicyTableSPtr; namespace { const std::string kSdlPreloadedPtJson = "json/sdl_preloaded_pt.json"; @@ -203,7 +203,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { void EmulatePTAppRevoked(const std::string& ptu_name); - utils::SharedPtr<policy_table::Table> PreconditionForBasicValidateSnapshot(); + std::shared_ptr<policy_table::Table> PreconditionForBasicValidateSnapshot(); template <typename ParentType, typename Value> bool IsKeyExisted(const ParentType& parent, const Value& value) const { @@ -236,7 +236,7 @@ class PolicyManagerImplTest_RequestTypes : public ::testing::Test { const std::string app_storage_folder_; const std::string preloaded_pt_filename_; - utils::SharedPtr<PolicyManagerImpl> policy_manager_impl_sptr_; + std::shared_ptr<PolicyManagerImpl> policy_manager_impl_sptr_; NiceMock<MockPolicyListener> listener_; NiceMock<policy_handler_test::MockPolicySettings> policy_settings_; diff --git a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc index 947bb5d3ad..537e40e170 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc @@ -1092,7 +1092,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT(preloaded_pt_filename_); GetPTU(kValidSdlPtUpdateJson); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); policy_table::ModuleConfig& module_config = pt->policy_table.module_config; ::policy::VehicleInfo vehicle_info = policy_manager_->GetVehicleInfo(); @@ -1202,7 +1202,7 @@ TEST_F( HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) { // Arrange CreateLocalPT(preloaded_pt_filename_); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); ::policy_table::PolicyTableType type1 = ::policy_table::PolicyTableType::PT_PRELOADED; @@ -1302,7 +1302,7 @@ TEST_F(PolicyManagerImplTest2, actual_groups_permissions[index].group_name); EXPECT_EQ(group1_perm.group_id, actual_groups_permissions[index].group_id); EXPECT_EQ(group1_perm.state, actual_groups_permissions[index].state); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); uint32_t ucr_size = 0; ::policy_table::DeviceData& device_data = *pt->policy_table.device_data; diff --git a/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc index e666ac82de..c1ff31f748 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc @@ -84,7 +84,7 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) { EXPECT_TRUE(cache->IsPTPreloaded()); // Arrange - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Get FunctionalGroupings policy_table::FunctionalGroupings& fc = table->policy_table.functional_groupings; @@ -119,7 +119,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT(preloaded_pt_filename_); policy_manager_->SetSystemLanguage("it-it"); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); ::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta); EXPECT_EQ("it-it", static_cast<std::string>(*(ModuleMeta.language))); @@ -130,7 +130,7 @@ TEST_F(PolicyManagerImplTest2, SetVINValue_ExpectVINSetSuccessfully) { CreateLocalPT(preloaded_pt_filename_); std::string vin_code("1FAPP6242VH100001"); policy_manager_->SetVINValue(vin_code); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); ::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta); EXPECT_EQ(vin_code, static_cast<std::string>(*(ModuleMeta.vin))); @@ -141,7 +141,7 @@ TEST_F(PolicyManagerImplTest2, SetSystemInfo_ExpectSystemInfoSetSuccessfully) { CreateLocalPT(preloaded_pt_filename_); policy_manager_->SetSystemInfo("4.1.3.B_EB355B", "WAEGB", "ru-ru"); policy::CacheManagerInterfaceSPtr cache = policy_manager_->GetCache(); - utils::SharedPtr<policy_table::Table> pt = cache->GetPT(); + std::shared_ptr<policy_table::Table> pt = cache->GetPT(); ::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta); EXPECT_EQ("ru-ru", static_cast<std::string>(*(ModuleMeta.language))); EXPECT_EQ("4.1.3.B_EB355B", @@ -189,7 +189,7 @@ TEST_F(PolicyManagerImplTest2, CleanUnpairedDevice_ExpectDevicesDeleted) { policy_manager_->AddDevice("AAA123456789RRR", "Bluetooth"); policy_manager_->SetDeviceInfo("AAA123456789RRR", dev_info3); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); // Try to find first device in PT policy_table::DeviceData::const_iterator iter = @@ -316,7 +316,7 @@ TEST_F(PolicyManagerImplTest2, AddDevice_RegisterDevice_TRUE) { const bool result = (policy_manager_->GetCache())->AddDevice(device_id_1_, connection_type); // Get Policy table - const utils::SharedPtr<policy_table::Table> policy_table = + const std::shared_ptr<policy_table::Table> policy_table = policy_manager_->GetCache()->GetPT(); // Get preloaded_pt flag from Policy table const bool is_preloaded_pt = diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_test.cc index f4e922e647..f049018848 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test.cc @@ -37,8 +37,8 @@ #include <utility> #include "policy/policy_manager_impl_test_base.h" -#include "utils/make_shared.h" -#include "utils/shared_ptr.h" + + using ::testing::_; using ::testing::Return; @@ -148,7 +148,7 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) { std::string json = table.toStyledString(); ::policy::BinaryMessage msg(json.begin(), json.end()); - utils::SharedPtr<policy_table::Table> snapshot = + std::shared_ptr<policy_table::Table> snapshot = new policy_table::Table(update.policy_table); // Assert EXPECT_CALL(*cache_manager_, GenerateSnapshot()).WillOnce(Return(snapshot)); @@ -236,8 +236,8 @@ TEST_F(PolicyManagerImplTest2, TimeOutExchange) { TEST_F(PolicyManagerImplTest, RequestPTUpdate_SetPT_GeneratedSnapshotAndPTUpdate) { Json::Value table = createPTforLoad(); - utils::SharedPtr<policy_table::Table> p_table = - utils::MakeShared<policy_table::Table>(&table); + std::shared_ptr<policy_table::Table> p_table = + std::make_shared<policy_table::Table>(&table); ASSERT_TRUE(p_table); p_table->SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE); EXPECT_TRUE(IsValid(*p_table)); @@ -249,8 +249,8 @@ TEST_F(PolicyManagerImplTest, } TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidPT_PTUpdateFail) { - utils::SharedPtr<policy_table::Table> p_table = - utils::MakeShared<policy_table::Table>(); + std::shared_ptr<policy_table::Table> p_table = + std::make_shared<policy_table::Table>(); ASSERT_TRUE(p_table); EXPECT_FALSE(IsValid(*p_table)); @@ -261,7 +261,7 @@ TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidPT_PTUpdateFail) { } TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidSnapshot_PTUpdateFail) { - utils::SharedPtr<policy_table::Table> p_table; + std::shared_ptr<policy_table::Table> p_table; EXPECT_FALSE(p_table); EXPECT_CALL(listener_, OnSnapshotCreated(_, _, _)).Times(0); @@ -355,7 +355,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppGroupsAndConsents(); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Checking groups consents before setting ExternalConsent status @@ -420,7 +420,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppGroupsAndConsents(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Checking ExternalConsent consents before setting new ExternalConsent status @@ -484,7 +484,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppPolicy(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -552,7 +552,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppPolicy(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -634,7 +634,7 @@ TEST_F( HmiTypes(policy_table::AHT_DEFAULT)); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -724,7 +724,7 @@ TEST_F( HmiTypes(policy_table::AHT_DEFAULT)); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -818,7 +818,7 @@ TEST_F(PolicyManagerImplTest_ExternalConsent, policy_manager_->AddApplication(app_id_1_, HmiTypes(policy_table::AHT_DEFAULT)); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Check ExternalConsent consents for application @@ -943,7 +943,7 @@ TEST_F(PolicyManagerImplTest_ExternalConsent, policy_manager_->AddApplication(app_id_1_, HmiTypes(policy_table::AHT_DEFAULT)); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Check ExternalConsent consents for application @@ -1046,7 +1046,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppGroupsAndConsents(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Checking ExternalConsent consents before setting new ExternalConsent status diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc index 48e86d24b7..86b7cdc9ef 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc @@ -38,7 +38,7 @@ #include "policy/policy_manager_impl_test_base.h" #include "utils/file_system.h" -#include "utils/make_shared.h" + #include "utils/gen_hash.h" #include "json/reader.h" @@ -414,7 +414,7 @@ void PolicyManagerImplTest2::GetFunctionalGroupingsFromManager( // Get cache ::policy::CacheManagerInterfaceSPtr cache = policy_manager_->GetCache(); // Get table_snapshot - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Set functional groupings from policy table input_functional_groupings = table->policy_table.functional_groupings; } @@ -639,7 +639,7 @@ void PolicyManagerImplTest_RequestTypes::SetUp() { file_system::CreateDirectory(app_storage_folder_); const bool in_memory = true; - policy_manager_impl_sptr_ = utils::MakeShared<PolicyManagerImpl>(in_memory); + policy_manager_impl_sptr_ = std::make_shared<PolicyManagerImpl>(in_memory); policy_manager_impl_sptr_->set_listener(&listener_); } diff --git a/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc index 2f2162494f..404991c969 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc @@ -395,7 +395,7 @@ TEST_F(PolicyManagerImplTest2, uint32_t size = result.size(); EXPECT_GT(size, 0u); std::vector< ::policy::UserFriendlyMessage>::iterator result_iter; - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); policy_table::ConsumerFriendlyMessages& consumer_friendly_messages = @@ -456,7 +456,7 @@ TEST_F(PolicyManagerImplTest2, TEST_F(PolicyManagerImplTest2, SetDeviceInfo_ExpectDevInfoAddedToPT) { // Arrange ::policy::DeviceInfo dev_info; - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); dev_info.hardware = "hardware IPX"; dev_info.firmware_rev = "v.8.0.1"; diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc index 92525c646d..fc4b0ae7b0 100644 --- a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc @@ -44,8 +44,8 @@ #include "rpc_base/rpc_base.h" #include "policy/policy_table/types.h" #include "policy/mock_policy_settings.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + using namespace ::policy; namespace policy_table = rpc::policy_table_interface_base; @@ -393,7 +393,7 @@ TEST_F(SQLPTExtRepresentationTest, ASSERT_TRUE(reps_->Save(update)); // Act - utils::SharedPtr<policy_table::Table> snapshot = reps_->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = reps_->GenerateSnapshot(); snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); policy_table["module_meta"] = Json::Value(Json::objectValue); @@ -1506,7 +1506,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveUserConsentRecords_ExpectedSaved) { // Act EXPECT_TRUE(reps_->Save(original_table)); - utils::SharedPtr<Table> loaded_table = reps_->GenerateSnapshot(); + std::shared_ptr<Table> loaded_table = reps_->GenerateSnapshot(); // GetData/GetKeyData methods do internal existence check - no need to do it // separately. In case of data is missing expectations will be violated. @@ -1591,7 +1591,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) { // Act EXPECT_TRUE(reps_->Save(original_table)); - utils::SharedPtr<Table> loaded_table = reps_->GenerateSnapshot(); + std::shared_ptr<Table> loaded_table = reps_->GenerateSnapshot(); FunctionalGroupings loaded_groupings = GetData<Table, FunctionalGroupings>(*loaded_table); diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc index a5589cc904..bfcf9f2172 100644 --- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc @@ -49,7 +49,7 @@ #include "policy/policy_table/enums.h" #include "rpc_base/rpc_base.h" #include "policy/mock_policy_settings.h" -#include "utils/shared_ptr.h" + namespace policy_table = rpc::policy_table_interface_base; using policy::SQLPTRepresentation; @@ -1585,7 +1585,7 @@ TEST_F(SQLPTRepresentationTest, ASSERT_TRUE(reps->Save(update)); // Act - utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot(); snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); // Remove fields which must be absent in snapshot table["policy_table"]["consumer_friendly_messages"].removeMember("messages"); diff --git a/src/components/policy/policy_external/test/update_status_manager_test.cc b/src/components/policy/policy_external/test/update_status_manager_test.cc index 5546984ff4..278c4fc43a 100644 --- a/src/components/policy/policy_external/test/update_status_manager_test.cc +++ b/src/components/policy/policy_external/test/update_status_manager_test.cc @@ -34,7 +34,7 @@ #include "policy/mock_policy_listener.h" #include "policy/policy_manager_impl.h" #include "policy/update_status_manager.h" -#include "utils/make_shared.h" + #include "utils/conditional_variable.h" namespace test { @@ -48,7 +48,7 @@ using testing::NiceMock; class UpdateStatusManagerTest : public ::testing::Test { protected: - utils::SharedPtr<UpdateStatusManager> manager_; + std::shared_ptr<UpdateStatusManager> manager_; PolicyTableStatus status_; const uint32_t k_timeout_; NiceMock<MockPolicyListener> listener_; @@ -58,7 +58,7 @@ class UpdateStatusManagerTest : public ::testing::Test { public: UpdateStatusManagerTest() - : manager_(utils::MakeShared<UpdateStatusManager>()) + : manager_(std::make_shared<UpdateStatusManager>()) , k_timeout_(1000) , listener_() , up_to_date_status_("UP_TO_DATE") 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 <map> #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<CacheManager> cache); + explicit AccessRemoteImpl(std::shared_ptr<CacheManager> 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<CacheManager> cache_; + std::shared_ptr<CacheManager> 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 <map> -#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<policy_table::Table> GenerateSnapshot(); + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot(); /** * Applies policy table to the current table @@ -723,7 +723,7 @@ class CacheManager : public CacheManagerInterface { const PolicySettings& get_settings() const; - utils::SharedPtr<policy_table::Table> pt() const { + std::shared_ptr<policy_table::Table> pt() const { return pt_; } @@ -775,9 +775,9 @@ class CacheManager : public CacheManagerInterface { policy::Permissions& permission); private: - utils::SharedPtr<policy_table::Table> pt_; - utils::SharedPtr<policy_table::Table> snapshot_; - utils::SharedPtr<PTRepresentation> backup_; + std::shared_ptr<policy_table::Table> pt_; + std::shared_ptr<policy_table::Table> snapshot_; + std::shared_ptr<PTRepresentation> backup_; bool update_required; typedef std::set<std::string> 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 <string> #include <vector> -#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<policy_table::Table> GenerateSnapshot() = 0; + virtual std::shared_ptr<policy_table::Table> 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<policy_table::Table> pt() const = 0; + virtual std::shared_ptr<policy_table::Table> 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<CacheManagerInterface> CacheManagerInterfaceSPtr; +typedef std::shared_ptr<CacheManagerInterface> 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<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); bool operator()(const AppPoliciesValueType& app_policy); private: @@ -131,8 +131,8 @@ struct CheckAppPolicy { private: PolicyManagerImpl* pm_; - const utils::SharedPtr<policy_table::Table> update_; - const utils::SharedPtr<policy_table::Table> snapshot_; + const std::shared_ptr<policy_table::Table> update_; + const std::shared_ptr<policy_table::Table> 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 <list> #include <cstdint> -#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<AccessRemote> access_remote) OVERRIDE; + void set_access_remote(std::shared_ptr<AccessRemote> 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<policy_table::Table> Parse( + virtual std::shared_ptr<policy_table::Table> 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<policy_table::Table> ParseArray( + virtual std::shared_ptr<policy_table::Table> ParseArray( const BinaryMessage& pt_content); #endif @@ -705,8 +705,8 @@ class PolicyManagerImpl : public PolicyManager { * @return Collection per-application results */ void CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> 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::Table> policy_table, + bool IsPTValid(std::shared_ptr<policy_table::Table> 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<AccessRemote> access_remote_; + std::shared_ptr<AccessRemote> 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<PTRepresentation> pt_data); + explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data); virtual ~PolicyTable(); /** @@ -50,12 +50,12 @@ class PolicyTable { * actual class storing policy table. * @return PTRepresentation* Policy Table Content Handler */ - utils::SharedPtr<PTRepresentation> pt_data() const { + std::shared_ptr<PTRepresentation> pt_data() const { return pt_data_; } private: - utils::SharedPtr<PTRepresentation> pt_data_; + std::shared_ptr<PTRepresentation> 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 <map> #include <set> #include <utility> -#include "utils/shared_ptr.h" +#include <memory> + #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<uint8_t> BinaryMessage; -typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr; +typedef std::shared_ptr<BinaryMessage> 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 <vector> #include <string> +#include <memory> #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<policy_table::Table> GenerateSnapshot() const = 0; + virtual std::shared_ptr<policy_table::Table> 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<policy_table::Table> GenerateSnapshot() const; + virtual std::shared_ptr<policy_table::Table> 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> status); + void SetNextStatus(std::shared_ptr<Status> status); /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - void SetPostponedStatus(utils::SharedPtr<Status> status); + void SetPostponedStatus(std::shared_ptr<Status> status); /** * @brief Sets listener pointer @@ -198,17 +198,17 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { /** * @brief Current update status */ - utils::SharedPtr<Status> current_status_; + std::shared_ptr<Status> current_status_; /** * @brief Next status after current to be set */ - utils::SharedPtr<Status> next_status_; + std::shared_ptr<Status> next_status_; /** * @brief Status to be set after 'next' status */ - utils::SharedPtr<Status> postponed_status_; + std::shared_ptr<Status> 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> status) = 0; + virtual void SetNextStatus(std::shared_ptr<Status> 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> status) = 0; + virtual void SetPostponedStatus(std::shared_ptr<Status> 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<UpdateStatusManagerInterface> +typedef std::shared_ptr<UpdateStatusManagerInterface> 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 <ctime> #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<StatisticsManager> statistics_manager, + GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type); void operator++() const; private: GlobalCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppCounter { public: - AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + AppCounter(std::shared_ptr<StatisticsManager> 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<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppInfo { public: - AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, + AppInfo(std::shared_ptr<StatisticsManager> 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<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppStopwatchImpl : public AppStopwatch { public: - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id); - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> 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<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; timer::Timer timer_; const std::uint32_t time_out_; DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl); diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc index f99b226f2e..f743a4d56e 100644 --- a/src/components/policy/policy_regular/src/access_remote_impl.cc +++ b/src/components/policy/policy_regular/src/access_remote_impl.cc @@ -89,7 +89,7 @@ struct ToModuleType { AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} -AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) +AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) : cache_(cache) {} bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 1d51b81af4..4530e6692b 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -934,8 +934,8 @@ void CacheManager::CheckSnapshotInitialization() { void CacheManager::PersistData() { LOG4CXX_AUTO_TRACE(logger_); - if (backup_.valid()) { - if (pt_.valid()) { + if (backup_.use_count() != 0) { + if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor // call policy_table::Table copy_pt( @@ -1029,10 +1029,10 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id, return false; } -utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() { +std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { CACHE_MANAGER_CHECK(snapshot_); - snapshot_ = new policy_table::Table(); + snapshot_ = std::make_shared<policy_table::Table>(); // Copy all members of policy table except messages in consumer friendly // messages @@ -1426,7 +1426,7 @@ bool CacheManager::Init(const std::string& file_name, result = LoadFromFile(file_name, *pt_); - utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: " << std::boolalpha << result); diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 796dd25ec4..bae9fceb49 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -121,8 +121,8 @@ bool operator!=(const policy_table::ApplicationParams& first, CheckAppPolicy::CheckAppPolicy( PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot) + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot) : pm_(pm), update_(update), snapshot_(snapshot) {} bool policy::CheckAppPolicy::HasRevokedGroups( diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index d01631a2a2..f1e51f3f83 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -44,12 +44,12 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "policy/cache_manager.h" #include "policy/update_status_manager.h" #include "config_profile/profile.h" #include "utils/timer_task_impl.h" -#include "utils/make_shared.h" + #include "policy/access_remote.h" #include "policy/access_remote_impl.h" @@ -74,7 +74,7 @@ PolicyManagerImpl::PolicyManagerImpl() , listener_(NULL) , cache_(new CacheManager) , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) + std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(kDefaultRetryTimeoutInMSec) , retry_sequence_index_(0) , timer_retry_sequence_("Retry sequence timer", @@ -93,21 +93,21 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { #ifdef USE_HMI_PTU_DECRYPTION -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; Json::Reader reader; if (reader.parse(json.c_str(), value)) { - return new policy_table::Table(&value); + return std::make_shared<policy_table::Table>(&value); } else { - return utils::SharedPtr<policy_table::Table>(); + return std::make_shared<policy_table::Table>(); } } #else -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; @@ -121,7 +121,7 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( return new policy_table::Table(&value); } } else { - return utils::SharedPtr<policy_table::Table>(); + return std::shared_ptr<policy_table::Table>(); } } @@ -154,11 +154,11 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, // Assuemes Policy Table was parsed, formatted, and/or decrypted by // the HMI after system request before calling OnReceivedPolicyUpdate // Parse message into table struct - utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); + std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); #else // Message Received from server unecnrypted with PTU in first element // of 'data' array. No Parsing was done by HMI. - utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content); + std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content); #endif if (!pt_update) { LOG4CXX_WARN(logger_, "Parsed table pointer is 0."); @@ -187,7 +187,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, sync_primitives::AutoLock lock(apps_registration_lock_); // Get current DB data, since it could be updated during awaiting of PTU - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR( @@ -238,8 +238,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, } void PolicyManagerImpl::CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> pt_update, - const utils::SharedPtr<policy_table::Table> snapshot) { + const std::shared_ptr<policy_table::Table> pt_update, + const std::shared_ptr<policy_table::Table> snapshot) { LOG4CXX_INFO(logger_, "Checking incoming permissions."); // Replace predefined policies with its actual setting, e.g. "123":"default" @@ -274,7 +274,7 @@ void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, bool PolicyManagerImpl::RequestPTUpdate() { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); @@ -806,7 +806,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() { } bool PolicyManagerImpl::IsPTValid( - utils::SharedPtr<policy_table::Table> policy_table, + std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { @@ -1066,11 +1066,11 @@ StatusNotifier PolicyManagerImpl::AddApplication( sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { AddNewApplication(application_id, device_consent); - return utils::MakeShared<CallStatusChange>(update_status_manager_, + return std::make_shared<CallStatusChange>(update_status_manager_, device_consent); } else { PromoteExistedApplication(application_id, device_consent); - return utils::MakeShared<utils::CallNothing>(); + return std::make_shared<utils::CallNothing>(); } } @@ -1164,8 +1164,8 @@ void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { } void PolicyManagerImpl::set_cache_manager( - CacheManagerInterface* cache_manager) { - cache_ = cache_manager; + CacheManagerInterface* cache_manager) { + cache_ = std::shared_ptr<CacheManagerInterface>(cache_manager); } void PolicyManagerImpl::RetrySequence() { @@ -1287,7 +1287,7 @@ bool PolicyManagerImpl::GetModuleTypes( } void PolicyManagerImpl::set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) { + std::shared_ptr<AccessRemote> access_remote) { access_remote_ = access_remote; } diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc index c5c6e3e132..b0fa5739da 100644 --- a/src/components/policy/policy_regular/src/policy_table.cc +++ b/src/components/policy/policy_regular/src/policy_table.cc @@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {} -PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) +PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index b1e574578e..00f3349050 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -483,10 +483,10 @@ bool SQLPTRepresentation::RefreshDB() { return true; } -utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() +std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); + auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts); diff --git a/src/components/policy/policy_regular/src/status.cc b/src/components/policy/policy_regular/src/status.cc index 8d65c606d0..306fa87529 100644 --- a/src/components/policy/policy_regular/src/status.cc +++ b/src/components/policy/policy_regular/src/status.cc @@ -32,7 +32,7 @@ #include "policy/status.h" #include "policy/update_status_manager_interface.h" -#include "utils/make_shared.h" + policy::UpToDateStatus::UpToDateStatus() : Status("UP_TO_DATE", policy::PolicyTableStatus::StatusUpToDate) {} @@ -44,7 +44,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManagerInterface* manager, case kOnResetPolicyTableRequireUpdate: case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -59,17 +59,17 @@ void policy::UpdateNeededStatus::ProcessEvent( policy::UpdateStatusManagerInterface* manager, policy::UpdateEvent event) { switch (event) { case kOnUpdateSentOut: - manager->SetNextStatus(utils::MakeShared<UpdatingStatus>()); + manager->SetNextStatus(std::make_shared<UpdatingStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -88,22 +88,22 @@ void policy::UpdatingStatus::ProcessEvent( switch (event) { case kOnValidUpdateReceived: case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnWrongUpdateReceived: case kOnUpdateTimeout: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc index 941113c753..401de1ea79 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -33,7 +33,7 @@ #include "policy/update_status_manager.h" #include "policy/policy_listener.h" #include "utils/logger.h" -#include "utils/make_shared.h" + namespace policy { @@ -41,7 +41,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) - , current_status_(utils::MakeShared<UpToDateStatus>()) + , current_status_(std::make_shared<UpToDateStatus>()) , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) {} @@ -55,11 +55,11 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { DoTransition(); } -void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) { next_status_ = status; } -void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) { postponed_status_ = status; } diff --git a/src/components/policy/policy_regular/src/usage_statistics/counter.cc b/src/components/policy/policy_regular/src/usage_statistics/counter.cc index 60e34a929d..199b5ae779 100644 --- a/src/components/policy/policy_regular/src/usage_statistics/counter.cc +++ b/src/components/policy/policy_regular/src/usage_statistics/counter.cc @@ -36,13 +36,13 @@ #include <cassert> #include "policy/usage_statistics/counter.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace usage_statistics { GlobalCounter::GlobalCounter( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type) : counter_type_(counter_type), statistics_manager_(statistics_manager) {} @@ -52,7 +52,7 @@ void GlobalCounter::operator++() const { } } -AppCounter::AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, +AppCounter::AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type) : app_id_(app_id) @@ -65,7 +65,7 @@ void AppCounter::operator++() const { } } -AppInfo::AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, +AppInfo::AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type) : app_id_(app_id) @@ -79,7 +79,7 @@ void AppInfo::Update(const std::string& new_info) const { } AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id) : app_id_(app_id) , stopwatch_type_(SECONDS_HMI_NONE) @@ -90,7 +90,7 @@ AppStopwatchImpl::AppStopwatchImpl( , time_out_(60) {} AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, uint32_t timeout) : app_id_(app_id) diff --git a/src/components/policy/policy_regular/test/access_remote_impl_test.cc b/src/components/policy/policy_regular/test/access_remote_impl_test.cc index d086144d86..f79bb683f8 100644 --- a/src/components/policy/policy_regular/test/access_remote_impl_test.cc +++ b/src/components/policy/policy_regular/test/access_remote_impl_test.cc @@ -37,7 +37,7 @@ namespace policy { TEST(AccessRemoteImplTest, CheckModuleType) { AccessRemoteImpl access_remote; - access_remote.cache_->pt_ = new policy_table::Table(); + access_remote.cache_->pt_ = std::make_shared<policy_table::Table>(); // No application EXPECT_FALSE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO)); @@ -81,7 +81,7 @@ TEST(AccessRemoteImplTest, GetGroups) { ApplicationOnDevice who = {"dev1", "1234"}; access_remote.hmi_types_[who].push_back(policy_table::AHT_REMOTE_CONTROL); - access_remote.cache_->pt_ = new policy_table::Table(); + access_remote.cache_->pt_ = std::make_shared<policy_table::Table>(); policy_table::ApplicationPolicies& apps = access_remote.cache_->pt_->policy_table.app_policies_section.apps; apps["1234"].groups.push_back("group_default"); diff --git a/src/components/policy/policy_regular/test/counter_test.cc b/src/components/policy/policy_regular/test/counter_test.cc index 2c0ab73c0b..a333ec2ee5 100644 --- a/src/components/policy/policy_regular/test/counter_test.cc +++ b/src/components/policy/policy_regular/test/counter_test.cc @@ -53,7 +53,7 @@ TEST( StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); GlobalCounter reboots_counter(msm, SYNC_REBOOTS); // Assert @@ -67,7 +67,7 @@ TEST( StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); GlobalCounter reboots_counter(msm, SYNC_REBOOTS); // Assert @@ -82,7 +82,7 @@ TEST( StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); // Assert @@ -96,7 +96,7 @@ TEST( StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); // Assert @@ -110,7 +110,7 @@ TEST( TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallONCE_StatisticsManagerSetMethodCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); // Assert @@ -123,7 +123,7 @@ TEST(StatisticsManagerSetMethod, TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallTWICE_StatisticsManagerSetMethodCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); // Assert @@ -138,7 +138,7 @@ TEST(StatisticsManagerSetMethod, TEST(StatisticsManagerAddMethod, AppStopwatchStartMethod_CallONCE_StatisticsManagerAddMethodCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); const std::uint32_t time_out = 1; AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out); @@ -155,7 +155,7 @@ TEST(StatisticsManagerAddMethod, TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_Call_StatisticsManagerAddMethodCalled) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp"); hmi_full_stopwatch.Start(SECONDS_HMI_FULL); @@ -171,7 +171,7 @@ TEST( StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); const std::uint32_t time_out = 1; AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out); diff --git a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h index 8a47e7ca97..72f183175c 100644 --- a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h +++ b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h @@ -76,7 +76,7 @@ class MockPTRepresentation : virtual public PTRepresentation { MOCK_METHOD0(Close, bool()); MOCK_METHOD0(Clear, bool()); MOCK_METHOD0(Drop, bool()); - MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(Save, bool(const policy_table::Table& table)); MOCK_CONST_METHOD0(UpdateRequired, bool()); MOCK_METHOD1(SaveUpdateRequired, void(bool value)); diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc index e4e361c52c..86df87d534 100644 --- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc @@ -51,7 +51,7 @@ #include "utils/macro.h" #include "utils/file_system.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/gen_hash.h" #include "policy/mock_access_remote.h" @@ -145,14 +145,14 @@ class PolicyManagerImplTest : public ::testing::Test { MockCacheManagerInterface* cache_manager; NiceMock<MockPolicyListener> listener; const std::string device_id; - utils::SharedPtr<access_remote_test::MockAccessRemote> access_remote; + std::shared_ptr<access_remote_test::MockAccessRemote> access_remote; void SetUp() OVERRIDE { manager = new PolicyManagerImpl(); manager->set_listener(&listener); cache_manager = new MockCacheManagerInterface(); manager->set_cache_manager(cache_manager); - access_remote = new access_remote_test::MockAccessRemote(); + access_remote = std::shared_ptr<access_remote_test::MockAccessRemote>(); manager->set_access_remote(access_remote); } @@ -352,7 +352,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { // Get cache ::policy::CacheManagerInterfaceSPtr cache = manager->GetCache(); // Get table_snapshot - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Set functional groupings from policy table input_functional_groupings = table->policy_table.functional_groupings; } @@ -720,8 +720,8 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) { const std::string json = table.toStyledString(); ::policy::BinaryMessage msg(json.begin(), json.end()); - utils::SharedPtr<policy_table::Table> snapshot = - utils::MakeShared<policy_table::Table>(update.policy_table); + std::shared_ptr<policy_table::Table> snapshot = + std::make_shared<policy_table::Table>(update.policy_table); // Assert EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(snapshot)); EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true)); @@ -961,7 +961,7 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) { // Arrange ::policy::CacheManagerInterfaceSPtr cache = manager->GetCache(); - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Get FunctionalGroupings policy_table::FunctionalGroupings& fc = table->policy_table.functional_groupings; @@ -1253,7 +1253,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT("sdl_preloaded_pt.json"); GetPTU("valid_sdl_pt_update.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); + std::shared_ptr<policy_table::Table> pt = (manager->GetCache())->pt(); policy_table::ModuleConfig& module_config = pt->policy_table.module_config; ::policy::VehicleInfo vehicle_info = manager->GetVehicleInfo(); @@ -1334,7 +1334,7 @@ TEST_F( HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) { // Arrange CreateLocalPT("sdl_preloaded_pt.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); + std::shared_ptr<policy_table::Table> pt = (manager->GetCache())->pt(); ::policy_table::PolicyTableType type1 = ::policy_table::PolicyTableType::PT_PRELOADED; pt->SetPolicyTableType(type1); diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc index 40dae10a4f..70db02b8a7 100644 --- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc @@ -47,8 +47,8 @@ #include "json/writer.h" #include "json/reader.h" #include "rpc_base/rpc_base.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "utils/file_system.h" #include "utils/sqlite_wrapper/sql_database.h" @@ -1517,7 +1517,7 @@ TEST_F(SQLPTRepresentationTest, ASSERT_TRUE(reps->Save(update)); // Act - utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot(); snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); // Remove fields which must be absent in snapshot table["policy_table"]["consumer_friendly_messages"].removeMember("messages"); diff --git a/src/components/policy/policy_regular/test/update_status_manager_test.cc b/src/components/policy/policy_regular/test/update_status_manager_test.cc index 9d0326d0be..7c73a11175 100644 --- a/src/components/policy/policy_regular/test/update_status_manager_test.cc +++ b/src/components/policy/policy_regular/test/update_status_manager_test.cc @@ -34,7 +34,7 @@ #include "policy/mock_policy_listener.h" #include "policy/policy_manager_impl.h" #include "policy/update_status_manager.h" -#include "utils/make_shared.h" + namespace test { namespace components { @@ -46,13 +46,13 @@ using ::testing::Return; class UpdateStatusManagerTest : public ::testing::Test { protected: - utils::SharedPtr<UpdateStatusManager> manager_; - utils::SharedPtr<MockPolicyListener> listener_; + std::shared_ptr<UpdateStatusManager> manager_; + std::shared_ptr<MockPolicyListener> listener_; public: UpdateStatusManagerTest() - : manager_(utils::MakeShared<UpdateStatusManager>()) - , listener_(utils::MakeShared<MockPolicyListener>()) {} + : manager_(std::make_shared<UpdateStatusManager>()) + , listener_(std::make_shared<MockPolicyListener>()) {} void SetUp() OVERRIDE { manager_->set_listener(listener_.get()); |