From: Martin Quinson Date: Mon, 11 Jan 2016 23:44:21 +0000 (+0100) Subject: sg_functions should be wrapping the C++ public API, not internals X-Git-Tag: v3_13~1273 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b402376f49143b6c75515bd28b6610743c1a7dfc sg_functions should be wrapping the C++ public API, not internals --- diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 61e16110ce..3de390582e 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -60,6 +60,7 @@ XBT_PUBLIC(int) sg_host_is_on(sg_host_t host); XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host); XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host); XBT_PUBLIC(void) sg_host_set_pstate(sg_host_t host,int pstate); +XBT_PUBLIC(xbt_dict_t) sg_host_get_properties(sg_host_t host); SG_END_DECL() diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 14af54214c..84b400d1fe 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -297,9 +297,6 @@ static inline const char * surf_cpu_name(surf_cpu_t cpu) { return surf_resource_name((surf_cpp_resource_t)cpu); } -/** @brief Get the properties of an host */ -XBT_PUBLIC(xbt_dict_t) sg_host_get_properties(sg_host_t host); - /** @brief Get the available speed of cpu associated to a host */ XBT_PUBLIC(double) surf_host_get_available_speed(sg_host_t host); diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 236376bf19..482f21fe2e 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -162,6 +162,12 @@ void sg_host_set_pstate(sg_host_t host,int pstate) { host->setPState(pstate); } +/** @brief Get the properties of an host */ +xbt_dict_t sg_host_get_properties(sg_host_t host) { + return host->getProperties(); +} + + namespace simgrid { Host::Host(std::string const& id) @@ -196,7 +202,7 @@ bool Host::isOff() { /** Get the properties assigned to a host */ xbt_dict_t Host::getProperties() { - return simgrid::simix::kernel(std::bind(sg_host_get_properties, this)); + return simgrid::simix::kernel(std::bind(&simgrid::surf::Host::getProperties, this->extension(simgrid::surf::Host::EXTENSION_ID))); } /** Get the processes attached to the host */ diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 37ed364ebb..365ce8a037 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -245,9 +245,6 @@ surf_action_t surf_host_sleep(sg_host_t host, double duration){ return host->pimpl_cpu->sleep(duration); } -xbt_dict_t sg_host_get_properties(sg_host_t host) { - return get_casted_host(host)->getProperties(); -} double surf_host_get_available_speed(sg_host_t host){ return host->pimpl_cpu->getAvailableSpeed();