X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f3b7e5f4b4d7c87ee3e8827313ec966ea8fc8387..39c935d6d5ee86d153f6f7e6a10d723ae7c57f6f:/src/kernel/resource/profile/StochasticDatedValue.hpp diff --git a/src/kernel/resource/profile/StochasticDatedValue.hpp b/src/kernel/resource/profile/StochasticDatedValue.hpp index 9528da47e4..ff0fa0edfc 100644 --- a/src/kernel/resource/profile/StochasticDatedValue.hpp +++ b/src/kernel/resource/profile/StochasticDatedValue.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2021. 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. */ @@ -14,34 +14,30 @@ namespace simgrid { namespace kernel { namespace 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 date_params; - Distribution value_law; + Distribution value_law = Distribution::DET; std::vector 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(Distribution dl, std::vector dp, Distribution vl, std::vector vp) + explicit StochasticDatedValue(double d, double v) : date_params({d}), value_params({v}) {} + explicit StochasticDatedValue(Distribution dl, const std::vector& dp, Distribution vl, + const std::vector& vp) : date_law(dl), date_params(dp), value_law(vl), value_params(vp) { } bool operator==(StochasticDatedValue const& e2) const; private: - double draw(Distribution law, std::vector params); + static double draw(Distribution law, std::vector params); }; -std::ostream& operator<<(std::ostream& out, const StochasticDatedValue& e); - } // namespace profile } // namespace kernel } // namespace simgrid