From a1b0cdb824467c344c252bc5dcd5f8103ba9ed40 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 9 Apr 2019 17:29:25 +0200 Subject: [PATCH 1/1] A simcall seems superfluous here (+ constify). --- include/simgrid/s4u/Actor.hpp | 4 ++-- src/s4u/s4u_Actor.cpp | 8 ++++---- src/surf/PropertyHolder.cpp | 2 +- src/surf/PropertyHolder.hpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index a089020e60..7bde9ca723 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -290,8 +290,8 @@ public: /** Retrieve the property value (or nullptr if not set) */ std::unordered_map* - get_properties(); // FIXME: do not export the map, but only the keys or something - const char* get_property(const std::string& key); + get_properties() const; // FIXME: do not export the map, but only the keys or something + const char* get_property(const std::string& key) const; void set_property(const std::string& key, const std::string& value); #ifndef DOXYGEN diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 91709314d5..ef457c6d7e 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -232,15 +232,15 @@ void Actor::kill_all() simix::simcall([self] { self->kill_all(); }); } -std::unordered_map* Actor::get_properties() +std::unordered_map* Actor::get_properties() const { - return simix::simcall([this] { return this->pimpl_->get_properties(); }); + return pimpl_->get_properties(); } /** Retrieve the property value (or nullptr if not set) */ -const char* Actor::get_property(const std::string& key) +const char* Actor::get_property(const std::string& key) const { - return simix::simcall([this, &key] { return pimpl_->get_property(key); }); + return pimpl_->get_property(key); } void Actor::set_property(const std::string& key, const std::string& value) diff --git a/src/surf/PropertyHolder.cpp b/src/surf/PropertyHolder.cpp index 39be42b685..d1378fb47c 100644 --- a/src/surf/PropertyHolder.cpp +++ b/src/surf/PropertyHolder.cpp @@ -13,7 +13,7 @@ PropertyHolder::~PropertyHolder() { } /** @brief Return the property associated to the provided key (or nullptr if not existing) */ -const char* PropertyHolder::get_property(const std::string& key) +const char* PropertyHolder::get_property(const std::string& key) const { if (properties_ == nullptr) return nullptr; diff --git a/src/surf/PropertyHolder.hpp b/src/surf/PropertyHolder.hpp index 95d7987d6b..d2b5631931 100644 --- a/src/surf/PropertyHolder.hpp +++ b/src/surf/PropertyHolder.hpp @@ -23,7 +23,7 @@ public: PropertyHolder& operator=(const PropertyHolder&) = delete; ~PropertyHolder(); - const char* get_property(const std::string& key); + const char* get_property(const std::string& key) const; void set_property(const std::string& id, const std::string& value); /* FIXME: This should not be exposed, as users may do bad things with the map they got (it's not a copy). -- 2.20.1