Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
some cosmetics to please sonar
[simgrid.git] / src / s4u / s4u_host.cpp
index e602ceb..10eec1d 100644 (file)
@@ -55,7 +55,7 @@ Host::~Host()
 
   delete pimpl_;
   if (pimpl_netpoint != nullptr) // not removed yet by a children class
-    simgrid::s4u::Engine::instance()->netcardUnregister(pimpl_netpoint);
+    simgrid::s4u::Engine::instance()->netpointUnregister(pimpl_netpoint);
   delete pimpl_cpu;
   delete mounts;
 }
@@ -141,6 +141,14 @@ int Host::pstatesCount() const {
  * by calling each "get_route" function in each routing component.
  */
 void Host::routeTo(Host* dest, std::vector<Link*>* links, double* latency)
+{
+  std::vector<surf::LinkImpl*> linkImpls;
+  this->routeTo(dest, &linkImpls, latency);
+  for (surf::LinkImpl* l : linkImpls)
+    links->push_back(&l->piface_);
+}
+/** @brief Just like Host::routeTo, but filling an array of link implementations */
+void Host::routeTo(Host* dest, std::vector<surf::LinkImpl*>* links, double* latency)
 {
   simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netpoint, dest->pimpl_netpoint, links, latency);
   if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
@@ -218,14 +226,14 @@ int Host::coreCount() {
 /** @brief Set the pstate at which the host should run */
 void Host::setPstate(int pstate_index)
 {
-  simgrid::simix::kernelImmediate(std::bind(
-      &simgrid::surf::Cpu::setPState, pimpl_cpu, pstate_index
-  ));
+  simgrid::simix::kernelImmediate([&](){
+      this->pimpl_cpu->setPState(pstate_index);
+  });
 }
 /** @brief Retrieve the pstate at which the host is currently running */
 int Host::pstate()
 {
-  return pimpl_cpu->getPState();
+  return this->pimpl_cpu->getPState();
 }
 
 /**