From 4e0879e02f32153ee997c27cbe0255309a2668db Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 23 Dec 2015 02:07:30 +0100 Subject: [PATCH 1/1] move createHost higher in the surf::HostModel hierarchy There is no need to specialize that function, actually --- src/surf/host_clm03.cpp | 8 -------- src/surf/host_clm03.hpp | 1 - src/surf/host_interface.cpp | 7 +++++++ src/surf/host_interface.hpp | 2 +- src/surf/host_ptask_L07.cpp | 7 ------- src/surf/host_ptask_L07.hpp | 1 - src/surf/virtual_machine.hpp | 2 -- 7 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index 33457c9dc8..21fd55e5e0 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -47,14 +47,6 @@ void surf_host_model_init_compound() namespace simgrid { namespace surf { -Host *HostCLM03Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props){ - Host *host = new simgrid::surf::Host(surf_host_model, name, props, - (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL), - netElm, cpu); - XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage)); - return host; -} - double HostCLM03Model::shareResources(double now){ adjustWeightOfDummyCpuActions(); diff --git a/src/surf/host_clm03.hpp b/src/surf/host_clm03.hpp index ef4ec1c51b..9c9c12339f 100644 --- a/src/surf/host_clm03.hpp +++ b/src/surf/host_clm03.hpp @@ -31,7 +31,6 @@ class HostCLM03Model : public HostModel { public: HostCLM03Model(): HostModel(){} ~HostCLM03Model() {} - Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props) override; double shareResources(double now) override; void updateActionsState(double now, double delta) override; diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index 9d740e6ce1..5899b0186d 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -36,6 +36,13 @@ simgrid::xbt::Extension Host::EXTENSION_ID; /********* * Model * *********/ +Host *HostModel::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props){ + Host *host = new simgrid::surf::Host(surf_host_model, name, props, + (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL), + netElm, cpu); + XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage)); + return host; +} /* Each VM has a dummy CPU action on the PM layer. This CPU action works as the * constraint (capacity) of the VM in the PM layer. If the VM does not have any diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index 7e1095d52f..9755b61435 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -52,7 +52,7 @@ public: HostModel() : Model() {} ~HostModel() {} - virtual Host *createHost(const char *name, RoutingEdge *net, Cpu *cpu, xbt_dict_t props)=0; + Host *createHost(const char *name, RoutingEdge *net, Cpu *cpu, xbt_dict_t props); void addTraces() override {DIE_IMPOSSIBLE;} virtual void adjustWeightOfDummyCpuActions(); diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 7a6c1eb09e..9ac974c7a5 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -270,13 +270,6 @@ Action *HostL07Model::executeParallelTask(int host_nb, return action; } -Host *HostL07Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props) -{ - return new simgrid::surf::Host(this, name, props, - (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL), - netElm, cpu); -} - Action *NetworkL07Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate) { diff --git a/src/surf/host_ptask_L07.hpp b/src/surf/host_ptask_L07.hpp index e5a892a5fe..b69b496863 100644 --- a/src/surf/host_ptask_L07.hpp +++ b/src/surf/host_ptask_L07.hpp @@ -45,7 +45,6 @@ public: double shareResources(double now) override; void updateActionsState(double now, double delta); - Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu, xbt_dict_t props) override; Action *executeParallelTask(int host_nb, sg_host_t *host_list, double *flops_amount, diff --git a/src/surf/virtual_machine.hpp b/src/surf/virtual_machine.hpp index baef9f2e76..fff482a981 100644 --- a/src/surf/virtual_machine.hpp +++ b/src/surf/virtual_machine.hpp @@ -111,8 +111,6 @@ public: VMModel() :HostModel(){} ~VMModel(){}; - Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu,xbt_dict_t props) override {DIE_IMPOSSIBLE;} - /** * @brief Create a new VM * -- 2.20.1