Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Forbid to modify a sealed netzone
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 23 Mar 2021 00:41:23 +0000 (01:41 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 23 Mar 2021 00:41:23 +0000 (01:41 +0100)
include/simgrid/kernel/routing/NetZoneImpl.hpp
src/kernel/routing/NetZoneImpl.cpp

index 421fa3e..89ddb84 100644 (file)
@@ -128,7 +128,7 @@ public:
   /** @brief Returns the list of direct children (no grand-children). This returns the internal data, no copy.
    * Don't mess with it.*/
   std::vector<NetZoneImpl*>* get_children() { return &children_; }
-  void add_child(NetZoneImpl* new_zone) { children_.push_back(new_zone); }
+  void add_child(NetZoneImpl* new_zone);
 
   /** @brief Retrieves the name of that netzone as a C++ string */
   const std::string& get_name() const { return name_; }
index f11c9cd..09ff9b9 100644 (file)
@@ -40,6 +40,12 @@ NetZoneImpl::~NetZoneImpl()
   s4u::Engine::get_instance()->netpoint_unregister(netpoint_);
 }
 
+void NetZoneImpl::add_child(NetZoneImpl* new_zone)
+{
+  xbt_assert(not sealed_, "Cannot add a new child to the sealed zone %s", get_cname(););
+  children_.push_back(new_zone);
+}
+
 /** @brief Returns the list of the hosts found in this NetZone (not recursively)
  *
  * Only the hosts that are directly contained in this NetZone are retrieved,