Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
consistency in host/storage/netpoint registering
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 24 Apr 2018 12:35:20 +0000 (14:35 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 24 Apr 2018 12:38:57 +0000 (14:38 +0200)
include/simgrid/s4u/Engine.hpp
src/kernel/routing/NetPoint.cpp
src/kernel/routing/NetZoneImpl.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Storage.cpp

index f71fff5..52f96c5 100644 (file)
@@ -75,10 +75,14 @@ public:
 protected:
   friend s4u::Host;
   friend s4u::Storage;
-  void add_host(std::string name, simgrid::s4u::Host* host);
-  void del_host(std::string name);
-  void add_storage(std::string name, simgrid::s4u::Storage* storage);
-  void del_storage(std::string name);
+  friend kernel::routing::NetPoint;
+  friend kernel::routing::NetZoneImpl;
+  void host_register(std::string name, simgrid::s4u::Host* host);
+  void host_unregister(std::string name);
+  void storage_register(std::string name, simgrid::s4u::Storage* storage);
+  void storage_unregister(std::string name);
+  void netpoint_register(simgrid::kernel::routing::NetPoint* card);
+  void netpoint_unregister(simgrid::kernel::routing::NetPoint* card);
 
 public:
   size_t get_host_count();
@@ -114,8 +118,6 @@ public:
   /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
   simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(std::string name);
   void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
-  void netpointRegister(simgrid::kernel::routing::NetPoint * card);
-  void netpointUnregister(simgrid::kernel::routing::NetPoint * card);
 
   /** Returns whether SimGrid was initialized yet -- mostly for internal use */
   static bool isInitialized();
index 6c38c0c..e1b0510 100644 (file)
@@ -22,7 +22,7 @@ NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl*
     id_ = netzone_p->addComponent(this);
   else
     id_ = static_cast<decltype(id_)>(-1);
-  simgrid::s4u::Engine::getInstance()->netpointRegister(this);
+  simgrid::s4u::Engine::getInstance()->netpoint_register(this);
   simgrid::kernel::routing::NetPoint::onCreation(this);
 }
 }
index 240309e..94603ef 100644 (file)
@@ -40,7 +40,7 @@ NetZoneImpl::~NetZoneImpl()
   for (auto const& kv : bypass_routes_)
     delete kv.second;
 
-  simgrid::s4u::Engine::getInstance()->netpointUnregister(netpoint_);
+  simgrid::s4u::Engine::getInstance()->netpoint_unregister(netpoint_);
 }
 
 simgrid::s4u::Host* NetZoneImpl::create_host(const char* name, std::vector<double>* speedPerPstate, int coreAmount,
index 4f59ca7..6b174d5 100644 (file)
@@ -106,12 +106,12 @@ std::vector<Host*> Engine::get_all_hosts()
   return res;
 }
 
-void Engine::add_host(std::string name, simgrid::s4u::Host* host)
+void Engine::host_register(std::string name, simgrid::s4u::Host* host)
 {
   pimpl->hosts_[name] = host;
 }
 
-void Engine::del_host(std::string name)
+void Engine::host_unregister(std::string name)
 {
   pimpl->hosts_.erase(name);
 }
@@ -153,12 +153,12 @@ simgrid::s4u::Storage* Engine::storage_by_name_or_null(std::string name)
   return storage == pimpl->storages_.end() ? nullptr : storage->second;
 }
 
-void Engine::add_storage(std::string name, simgrid::s4u::Storage* storage)
+void Engine::storage_register(std::string name, simgrid::s4u::Storage* storage)
 {
   pimpl->storages_[name] = storage;
 }
 
-void Engine::del_storage(std::string name)
+void Engine::storage_unregister(std::string name)
 {
   pimpl->storages_.erase(name);
 }
@@ -225,14 +225,14 @@ void Engine::getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*>* l
     list->push_back(kv.second);
 }
 /** @brief Register a new netpoint to the system */
-void Engine::netpointRegister(simgrid::kernel::routing::NetPoint* point)
+void Engine::netpoint_register(simgrid::kernel::routing::NetPoint* point)
 {
   // simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread
   pimpl->netpoints_[point->get_name()] = point;
   // });
 }
 /** @brief Unregister a given netpoint */
-void Engine::netpointUnregister(simgrid::kernel::routing::NetPoint* point)
+void Engine::netpoint_unregister(simgrid::kernel::routing::NetPoint* point)
 {
   simgrid::simix::kernelImmediate([this, point] {
     pimpl->netpoints_.erase(point->get_name());
index 7ab0c6f..8c448a8 100644 (file)
@@ -30,7 +30,7 @@ simgrid::xbt::signal<void(Host&)> Host::onSpeedChange;
 Host::Host(const char* name) : name_(name)
 {
   xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name);
-  Engine::getInstance()->add_host(std::string(name_), this);
+  Engine::getInstance()->host_register(std::string(name_), this);
   new simgrid::surf::HostImpl(this);
 }
 
@@ -40,7 +40,7 @@ Host::~Host()
 
   delete pimpl_;
   if (pimpl_netpoint != nullptr) // not removed yet by a children class
-    simgrid::s4u::Engine::getInstance()->netpointUnregister(pimpl_netpoint);
+    simgrid::s4u::Engine::getInstance()->netpoint_unregister(pimpl_netpoint);
   delete pimpl_cpu;
   delete mounts;
 }
@@ -58,7 +58,7 @@ void Host::destroy()
   if (not currentlyDestroying_) {
     currentlyDestroying_ = true;
     onDestruction(*this);
-    Engine::getInstance()->del_host(std::string(name_));
+    Engine::getInstance()->host_unregister(std::string(name_));
     delete this;
   }
 }
index cc6c203..a4e08df 100644 (file)
@@ -29,7 +29,7 @@ void XBT_ATTRIB_DEPRECATED_v322(
 
 Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
 {
-  simgrid::s4u::Engine::getInstance()->add_storage(name, this);
+  simgrid::s4u::Engine::getInstance()->storage_register(name, this);
 }
 
 Storage* Storage::byName(std::string name)