Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Default is not to use sleep-set to agree with existing tests
[simgrid.git] / src / kernel / resource / profile / StochasticDatedValue.hpp
index 29bc98916f4adf05b8dd1bce1389d7894a18d0b2..aaa9978d9c1de1f521c09b26b661f8a98b107cb0 100644 (file)
@@ -1,4 +1,4 @@
-/* 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. */
@@ -7,29 +7,24 @@
 #define SIMGRID_KERNEL_PROFILE_STOCHASTICDATEDVALUE
 
 #include "simgrid/forward.h"
-#include "src/kernel/resource/profile/DatedValue.hpp"
+#include "simgrid/kernel/ProfileBuilder.hpp"
 #include <vector>
 
-namespace simgrid {
-namespace kernel {
-namespace profile {
+namespace simgrid::kernel::profile {
 
-enum Distribution { Dist_Exp, Dist_Norm, Dist_Unif, Dist_Det };
+enum class Distribution { EXP, NORM, UNIF, DET };
 
 class XBT_PUBLIC StochasticDatedValue {
 public:
-  Distribution date_law;
+  Distribution date_law = Distribution::DET;
   std::vector<double> date_params;
-  Distribution value_law;
+  Distribution value_law = Distribution::DET;
   std::vector<double> value_params;
-  DatedValue get_datedvalue();
-  double get_date();
-  double get_value();
+  DatedValue get_datedvalue() const;
+  double get_date() const;
+  double get_value() const;
   explicit StochasticDatedValue() = default;
-  explicit StochasticDatedValue(double d, double v)
-      : date_law(Dist_Det), date_params({d}), value_law(Dist_Det), value_params({v})
-  {
-  }
+  explicit StochasticDatedValue(double d, double v) : date_params({d}), value_params({v}) {}
   explicit StochasticDatedValue(Distribution dl, const std::vector<double>& dp, Distribution vl,
                                 const std::vector<double>& vp)
       : date_law(dl), date_params(dp), value_law(vl), value_params(vp)
@@ -38,13 +33,11 @@ public:
   bool operator==(StochasticDatedValue const& e2) const;
 
 private:
-  double draw(Distribution law, std::vector<double> params);
+  static double draw(Distribution law, std::vector<double> params);
 };
 
-std::ostream& operator<<(std::ostream& out, const StochasticDatedValue& e);
+} // namespace simgrid::kernel::profile
 
-} // namespace profile
-} // namespace kernel
-} // namespace simgrid
+std::vector<simgrid::kernel::profile::StochasticDatedValue> trace2selist( const char* c_str );
 
 #endif