From: Arnaud Giersch Date: Tue, 14 May 2019 09:43:21 +0000 (+0200) Subject: Specialize return types. X-Git-Tag: v3.22.4~127^2~16 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9775891b158eef2641387589cb44b52adbfc9f82 Specialize return types. --- diff --git a/src/surf/StorageImpl.hpp b/src/surf/StorageImpl.hpp index da13a3ced4..1e38c513f8 100644 --- a/src/surf/StorageImpl.hpp +++ b/src/surf/StorageImpl.hpp @@ -82,7 +82,7 @@ public: void turn_off() override; void destroy(); // Must be called instead of the destructor - virtual Action* io_start(sg_size_t size, s4u::Io::OpType type) = 0; + virtual StorageAction* io_start(sg_size_t size, s4u::Io::OpType type) = 0; /** * @brief Read a file * diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 4b273c70a5..a011ad3c73 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -48,6 +48,8 @@ public: * Resource * ************/ +class CpuAction; + /** @ingroup SURF_cpu_interface * @brief SURF cpu resource interface class * @details A Cpu represent a cpu associated to a host @@ -90,7 +92,7 @@ public: * @param size The value of the processing amount (in flop) needed to process * @return The CpuAction corresponding to the processing */ - virtual Action* execution_start(double size) = 0; + virtual CpuAction* execution_start(double size) = 0; /** * @brief Execute some quantity of computation on more than one core @@ -99,7 +101,7 @@ public: * @param requested_cores The desired amount of cores. Must be >= 1 * @return The CpuAction corresponding to the processing */ - virtual Action* execution_start(double size, int requested_cores) = 0; + virtual CpuAction* execution_start(double size, int requested_cores) = 0; /** * @brief Make a process sleep for duration (in seconds) @@ -107,7 +109,7 @@ public: * @param duration The number of seconds to sleep * @return The CpuAction corresponding to the sleeping */ - virtual Action* sleep(double duration) = 0; + virtual CpuAction* sleep(double duration) = 0; /** @brief Get the amount of cores */ virtual int get_core_count(); diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 2bcdfabf2c..f304375052 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -112,7 +112,7 @@ public: bool is_used() override; CpuAction* execution_start(double size) override; - Action* execution_start(double, int) override + CpuAction* execution_start(double, int) override { THROW_UNIMPLEMENTED; return nullptr; diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 19e985e3f1..384656cf45 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -131,9 +131,9 @@ void HostL07Model::update_actions_state(double /*now*/, double delta) } } -kernel::resource::Action* HostL07Model::execute_parallel(const std::vector& host_list, - const double* flops_amount, const double* bytes_amount, - double rate) +kernel::resource::CpuAction* HostL07Model::execute_parallel(const std::vector& host_list, + const double* flops_amount, const double* bytes_amount, + double rate) { return new L07Action(this, host_list, flops_amount, bytes_amount, rate); } @@ -254,20 +254,20 @@ LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwid s4u::Link::on_creation(this->piface_); } -kernel::resource::Action* CpuL07::execution_start(double size) +kernel::resource::CpuAction* CpuL07::execution_start(double size) { std::vector host_list = {get_host()}; double* flops_amount = new double[host_list.size()](); flops_amount[0] = size; - kernel::resource::Action* res = + kernel::resource::CpuAction* res = static_cast(get_model())->hostModel_->execute_parallel(host_list, flops_amount, nullptr, -1); static_cast(res)->free_arrays_ = true; return res; } -kernel::resource::Action* CpuL07::sleep(double duration) +kernel::resource::CpuAction* CpuL07::sleep(double duration) { L07Action *action = static_cast(execution_start(1.0)); action->set_max_duration(duration); diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 568618a08d..523e00f167 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -42,8 +42,8 @@ public: double next_occuring_event(double now) override; void update_actions_state(double now, double delta) override; - kernel::resource::Action* execute_parallel(const std::vector& host_list, const double* flops_amount, - const double* bytes_amount, double rate) override; + kernel::resource::CpuAction* execute_parallel(const std::vector& host_list, const double* flops_amount, + const double* bytes_amount, double rate) override; }; class CpuL07Model : public kernel::resource::CpuModel { @@ -83,13 +83,13 @@ public: ~CpuL07() override; bool is_used() override; void apply_event(kernel::profile::Event* event, double value) override; - kernel::resource::Action* execution_start(double size) override; - kernel::resource::Action* execution_start(double, int) override + kernel::resource::CpuAction* execution_start(double size) override; + kernel::resource::CpuAction* execution_start(double, int) override { THROW_UNIMPLEMENTED; return nullptr; } - kernel::resource::Action* sleep(double duration) override; + kernel::resource::CpuAction* sleep(double duration) override; protected: void on_speed_change() override; @@ -112,10 +112,10 @@ public: * Action * **********/ class L07Action : public kernel::resource::CpuAction { - friend Action *CpuL07::execution_start(double size); - friend Action *CpuL07::sleep(double duration); - friend Action* HostL07Model::execute_parallel(const std::vector& host_list, const double* flops_amount, - const double* bytes_amount, double rate); + friend CpuAction* CpuL07::execution_start(double size); + friend CpuAction* CpuL07::sleep(double duration); + friend CpuAction* HostL07Model::execute_parallel(const std::vector& host_list, const double* flops_amount, + const double* bytes_amount, double rate); friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate); public: