Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More doc for SMPI
[simgrid.git] / src / kernel / resource / profile / StochasticDatedValue.cpp
index 0695de3e53a642938e36a0fd94d27b98ff2c2bab..c1d383ebe7830fb679e5e34bb6e23169dd59501f 100644 (file)
@@ -1,16 +1,16 @@
-/* Copyright (c) 2004-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/resource/profile/StochasticDatedValue.hpp"
-#include "xbt.h"
+
+#include "xbt/asserts.h"
 #include "xbt/random.hpp"
+
 #include <math.h>
 
-namespace simgrid {
-namespace kernel {
-namespace profile {
+namespace simgrid::kernel::profile {
 
 double StochasticDatedValue::draw(Distribution law, std::vector<double> params)
 {
@@ -24,19 +24,21 @@ double StochasticDatedValue::draw(Distribution law, std::vector<double> params)
     case Distribution::NORM:
       return simgrid::xbt::random::normal(params[0], params[1]);
     default:
-      xbt_assert(false, "Unimplemented distribution");
-      return 0;
+      xbt_die("Unimplemented distribution");
   }
 }
-double StochasticDatedValue::get_value()
+
+double StochasticDatedValue::get_value() const
 {
   return draw(value_law, value_params);
 }
-double StochasticDatedValue::get_date()
+
+double StochasticDatedValue::get_date() const
 {
   return draw(date_law, date_params);
 }
-DatedValue StochasticDatedValue::get_datedvalue()
+
+DatedValue StochasticDatedValue::get_datedvalue() const
 {
   DatedValue event;
   event.date_  = get_date();
@@ -50,6 +52,4 @@ bool StochasticDatedValue::operator==(StochasticDatedValue const& e2) const
          (e2.date_params == date_params);
 }
 
-} // namespace profile
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::profile