From af537f85d61a303b8f2c0b0707fbb3116dca2126 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 17 Apr 2019 20:46:11 +0200 Subject: [PATCH] Uniformize get_impl(): const attribute, and return raw pointer. --- include/simgrid/s4u/Activity.hpp | 2 +- include/simgrid/s4u/Link.hpp | 2 +- include/simgrid/s4u/Mailbox.hpp | 2 +- include/simgrid/s4u/NetZone.hpp | 2 +- include/simgrid/s4u/Storage.hpp | 2 +- src/msg/msg_comm.cpp | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/simgrid/s4u/Activity.hpp b/include/simgrid/s4u/Activity.hpp index 8d123ef09e..de5b14adba 100644 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -92,7 +92,7 @@ public: /** Retrieve the user data of the Activity */ void* get_user_data() { return user_data_; } - kernel::activity::ActivityImplPtr get_impl() { return pimpl_; } + kernel::activity::ActivityImpl* get_impl() const { return pimpl_.get(); } #ifndef DOXYGEN XBT_ATTRIB_DEPRECATED_v324("Please use Activity::wait_for()") virtual void wait(double timeout) = 0; diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index 4a1189db43..74fb9e9648 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -33,7 +33,7 @@ class XBT_PUBLIC Link : public xbt::Extendable { public: enum class SharingPolicy { SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 }; - kernel::resource::LinkImpl* get_impl() { return pimpl_; } + kernel::resource::LinkImpl* get_impl() const { return pimpl_; } /** @brief Retrieve a link from its name */ static Link* by_name(const std::string& name); diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index 069618a9df..faffc353ca 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -26,7 +26,7 @@ class XBT_PUBLIC Mailbox { public: /** private function, do not use. FIXME: make me protected */ - kernel::activity::MailboxImpl* get_impl() { return pimpl_; } + kernel::activity::MailboxImpl* get_impl() const { return pimpl_; } /** @brief Retrieves the name of that mailbox as a C++ string */ const xbt::string& get_name() const; diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 0ba5c13e77..8004e96991 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -41,7 +41,7 @@ public: std::vector get_all_hosts(); int get_host_count(); - kernel::routing::NetZoneImpl* get_impl() { return pimpl_; } + kernel::routing::NetZoneImpl* get_impl() const { return pimpl_; } private: kernel::routing::NetZoneImpl* const pimpl_; diff --git a/include/simgrid/s4u/Storage.hpp b/include/simgrid/s4u/Storage.hpp index dce77c584b..09c09e2cf2 100644 --- a/include/simgrid/s4u/Storage.hpp +++ b/include/simgrid/s4u/Storage.hpp @@ -70,7 +70,7 @@ public: IoPtr write_async(sg_size_t size); sg_size_t write(sg_size_t size); - kernel::resource::StorageImpl* get_impl() { return pimpl_; } + kernel::resource::StorageImpl* get_impl() const { return pimpl_; } private: Host* attached_to_ = nullptr; diff --git a/src/msg/msg_comm.cpp b/src/msg/msg_comm.cpp index 1f7b29ce41..28db1e5402 100644 --- a/src/msg/msg_comm.cpp +++ b/src/msg/msg_comm.cpp @@ -101,7 +101,7 @@ int MSG_comm_testany(xbt_dynar_t comms) msg_comm_t comm; unsigned int cursor; xbt_dynar_foreach (comms, cursor, comm) { - s_comms.push_back(static_cast(comm->s_comm->get_impl().get())); + s_comms.push_back(static_cast(comm->s_comm->get_impl())); } msg_error_t status = MSG_OK; @@ -180,7 +180,7 @@ int MSG_comm_waitany(xbt_dynar_t comms) msg_comm_t comm; unsigned int cursor; xbt_dynar_foreach (comms, cursor, comm) { - s_comms.push_back(static_cast(comm->s_comm->get_impl().get())); + s_comms.push_back(static_cast(comm->s_comm->get_impl())); } msg_error_t status = MSG_OK; -- 2.20.1