Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make Time::date const; kill useless getter.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 19 Mar 2021 14:03:24 +0000 (15:03 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 19 Mar 2021 15:12:51 +0000 (16:12 +0100)
include/simgrid/simix.hpp
src/kernel/actor/ActorImpl.cpp
src/simix/smx_global.cpp

index 7345acf..9c62626 100644 (file)
@@ -102,15 +102,13 @@ inline auto& simix_timers() // avoid static initialization order fiasco
 
 /** @brief Timer datatype */
 class Timer {
-  double date = 0.0;
-
 public:
+  const double date;
   std::remove_reference_t<decltype(simix_timers())>::handle_type handle_;
 
   Timer(double date, simgrid::xbt::Task<void()>&& callback) : date(date), callback(std::move(callback)) {}
 
   simgrid::xbt::Task<void()> callback;
-  double get_date() const { return date; }
   void remove();
 
   template <class F> static inline Timer* set(double date, F callback)
index 0fcaa4b..1d6cb85 100644 (file)
@@ -288,7 +288,7 @@ void ActorImpl::set_kill_time(double kill_time)
 
 double ActorImpl::get_kill_time() const
 {
-  return kill_timer_ ? kill_timer_->get_date() : 0;
+  return kill_timer_ ? kill_timer_->date : 0.0;
 }
 
 void ActorImpl::yield()
index 4b4a165..930a257 100644 (file)
@@ -600,7 +600,7 @@ void SIMIX_timer_remove(smx_timer_t timer) // XBT_ATTRIB_DEPRECATED_v329
 /** @brief Returns the date at which the timer will trigger (or 0 if nullptr timer) */
 double SIMIX_timer_get_date(smx_timer_t timer) // XBT_ATTRIB_DEPRECATED_v329
 {
-  return timer ? timer->get_date() : 0;
+  return timer ? timer->date : 0.0;
 }
 
 void SIMIX_display_process_status() // XBT_ATTRIB_DEPRECATED_v329