From 01d031bf9f5de10a19af1fced6e3b7bd48b41b69 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Wed, 8 Jan 2020 11:32:09 +0100 Subject: [PATCH] [sonar] Don't mix public and private data members (easy ones) --- include/simgrid/kernel/resource/Resource.hpp | 3 +- include/simgrid/plugins/file_system.h | 29 +++++++++----------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/include/simgrid/kernel/resource/Resource.hpp b/include/simgrid/kernel/resource/Resource.hpp index d85f7c79c2..f2b4fc1b51 100644 --- a/include/simgrid/kernel/resource/Resource.hpp +++ b/include/simgrid/kernel/resource/Resource.hpp @@ -34,6 +34,7 @@ protected: double scale; /**< Current availability of the metric according to the profiles, in [0,1] */ profile::Event* event; /**< The associated profile event associated to the metric */ }; + profile::Event* state_event_ = nullptr; public: /** @@ -82,8 +83,6 @@ public: /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */ lmm::Constraint* get_constraint() const { return constraint_; } - - profile::Event* state_event_ = nullptr; }; } // namespace resource } // namespace kernel diff --git a/include/simgrid/plugins/file_system.h b/include/simgrid/plugins/file_system.h index d180a9a561..6c92f19916 100644 --- a/include/simgrid/plugins/file_system.h +++ b/include/simgrid/plugins/file_system.h @@ -104,6 +104,10 @@ class XBT_PUBLIC File : public xbt::Extendable { std::string path_; std::string fullpath_; sg_size_t current_position_ = SEEK_SET; + int desc_id = 0; + Disk* local_disk_ = nullptr; + Storage* local_storage_ = nullptr; + std::string mount_point_; Storage* find_local_storage_on(Host* host); Disk* find_local_disk_on(const Host* host); @@ -143,14 +147,15 @@ public: int unlink(); /** Remove a file from the contents of a disk */ void dump(); - - int desc_id = 0; - Disk* local_disk_ = nullptr; - Storage* local_storage_ = nullptr; - std::string mount_point_; }; class XBT_PUBLIC FileSystemDiskExt { + std::unique_ptr> content_; + std::map remote_mount_points_; + std::string mount_point_; + sg_size_t used_size_ = 0; + sg_size_t size_ = static_cast(500 * 1024) * 1024 * 1024; + public: static simgrid::xbt::Extension EXTENSION_ID; explicit FileSystemDiskExt(const Disk* ptr); @@ -168,16 +173,13 @@ public: sg_size_t get_used_size() const { return used_size_; } void decr_used_size(sg_size_t size) { used_size_ -= size; } void incr_used_size(sg_size_t size) { used_size_ += size; } +}; -private: +class XBT_PUBLIC FileSystemStorageExt { std::unique_ptr> content_; - std::map remote_mount_points_; - std::string mount_point_; sg_size_t used_size_ = 0; - sg_size_t size_ = static_cast(500 * 1024) * 1024 * 1024; -}; + sg_size_t size_ = 0; -class XBT_PUBLIC FileSystemStorageExt { public: static simgrid::xbt::Extension EXTENSION_ID; explicit FileSystemStorageExt(const Storage* ptr); @@ -189,11 +191,6 @@ public: sg_size_t get_used_size() { return used_size_; } void decr_used_size(sg_size_t size) { used_size_ -= size; } void incr_used_size(sg_size_t size) { used_size_ += size; } - -private: - std::unique_ptr> content_; - sg_size_t used_size_ = 0; - sg_size_t size_ = 0; }; class XBT_PUBLIC FileDescriptorHostExt { -- 2.20.1