Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
naming consistency (+snake_casing)
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 10 Jun 2018 21:49:20 +0000 (23:49 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 10 Jun 2018 22:05:59 +0000 (00:05 +0200)
Christian recently added get_filtered_actors(), which is a nice name.

examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/NetZone.hpp
src/bindings/java/jmsg_as.cpp
src/instr/instr_platform.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Netzone.cpp
src/surf/sg_platf.cpp

index 21b5837..1ae6c53 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char* argv[])
   e.load_platform(argv[1]);
 
   std::vector<simgrid::kernel::routing::ClusterZone*> clusters =
-      e.filter_netzones_by_type<simgrid::kernel::routing::ClusterZone>();
+      e.get_filtered_netzones<simgrid::kernel::routing::ClusterZone>();
 
   for (auto c : clusters) {
     XBT_INFO("%s", c->get_cname());
@@ -25,12 +25,12 @@ int main(int argc, char* argv[])
   }
 
   std::vector<simgrid::kernel::routing::DragonflyZone*> dragonfly_clusters =
-      e.filter_netzones_by_type<simgrid::kernel::routing::DragonflyZone>();
+      e.get_filtered_netzones<simgrid::kernel::routing::DragonflyZone>();
 
   if (not dragonfly_clusters.empty()) {
     for (auto d : dragonfly_clusters) {
       XBT_INFO("%s' dragonfly topology:", d->get_cname());
-      for (int i = 0; i < d->getHostCount(); i++) {
+      for (int i = 0; i < d->get_host_count(); i++) {
         unsigned int coords[4];
         d->rankId_to_coords(i, coords);
         XBT_INFO("   %d: (%u, %u, %u, %u)", i, coords[0], coords[1], coords[2], coords[3]);
index 93b6531..a0f10cf 100644 (file)
@@ -130,10 +130,10 @@ public:
   simgrid::s4u::NetZone* netzone_by_name_or_null(const char* name);
 
   /** @brief Retrieves all netzones of the type indicated by the template argument */
-  template <class T> std::vector<T*> filter_netzones_by_type()
+  template <class T> std::vector<T*> get_filtered_netzones()
   {
     std::vector<T*> res;
-    filter_netzones_by_type_recursive(get_netzone_root(), &res);
+    get_filtered_netzones_recursive(get_netzone_root(), &res);
     return res;
   }
 
@@ -242,7 +242,7 @@ public:
   XBT_ATTRIB_DEPRECATED_v323("Please use Engine::filter_netzones_by_type()") void getNetzoneByType(
       std::vector<T*>* whereto)
   {
-    filter_netzones_by_type_recursive(get_netzone_root(), whereto);
+    get_filtered_netzones_recursive(get_netzone_root(), whereto);
   }
 
   XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_instance()") static s4u::Engine* getInstance()
@@ -273,10 +273,10 @@ extern XBT_PUBLIC xbt::signal<void(double)> on_time_advance;
 /** Callback fired when the time cannot jump because of inter-actors deadlock */
 extern XBT_PUBLIC xbt::signal<void(void)> on_deadlock;
 
-template <class T> XBT_PRIVATE void filter_netzones_by_type_recursive(s4u::NetZone* current, std::vector<T*>* whereto)
+template <class T> XBT_PRIVATE void get_filtered_netzones_recursive(s4u::NetZone* current, std::vector<T*>* whereto)
 {
-  for (auto const& elem : *(current->getChildren())) {
-    filter_netzones_by_type_recursive(elem, whereto);
+  for (auto const& elem : *(current->get_children())) {
+    get_filtered_netzones_recursive(elem, whereto);
     if (elem == dynamic_cast<T*>(elem))
       whereto->push_back(dynamic_cast<T*>(elem));
   }
index 4b485bb..8eb0e8c 100644 (file)
@@ -37,12 +37,12 @@ public:
   const std::string& get_name() const { return name_; }
   /** @brief Retrieves the name of that netzone as a C string */
   const char* get_cname() const;
+
   NetZone* get_father();
+  std::vector<NetZone*>* get_children(); // Sub netzones
 
   std::vector<Host*> get_all_hosts();
-
-  std::vector<NetZone*>* getChildren();             // Sub netzones
-  int getHostCount();
+  int get_host_count();
 
 private:
   std::unordered_map<std::string, std::string> properties_;
@@ -126,8 +126,13 @@ public: // Deprecation wrappers
   {
     return get_vertices();
   }
+  XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_host_count()") int getHostCount() { return get_host_count(); }
   XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_all_hosts()") void getHosts(
       std::vector<s4u::Host*>* whereto); // retrieve my content as a vector of hosts
+  XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_children()") std::vector<NetZone*>* getChildren()
+  {
+    return get_children();
+  }
 };
 }
 }; // Namespace simgrid::s4u
index 2bf2499..607f4a9 100644 (file)
@@ -69,14 +69,14 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job
   if (not cls)
     return nullptr;
 
-  jtable = env->NewObjectArray(static_cast<jsize>(self_as->getChildren()->size()), cls, nullptr);
+  jtable = env->NewObjectArray(static_cast<jsize>(self_as->get_children()->size()), cls, nullptr);
 
   if (not jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
     return nullptr;
   }
 
-  for (auto const& tmp_as : *self_as->getChildren()) {
+  for (auto const& tmp_as : *self_as->get_children()) {
     jobject tmp_jas = jnetzone_new_instance(env);
     if (not tmp_jas) {
       jxbt_throw_jni(env, "java As instantiation failed");
index 6bf58f3..0184c25 100644 (file)
@@ -127,9 +127,9 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
     return;
   }
   XBT_DEBUG("Graph extraction for NetZone = %s", netzone->get_cname());
-  if (not netzone->getChildren()->empty()) {
+  if (not netzone->get_children()->empty()) {
     // bottom-up recursion
-    for (auto const& nz_son : *netzone->getChildren()) {
+    for (auto const& nz_son : *netzone->get_children()) {
       container_t child_container = container->children_.at(nz_son->get_cname());
       recursiveGraphExtraction(nz_son, child_container, filter);
     }
@@ -466,9 +466,9 @@ static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string,
                                         std::map<std::string, xbt_edge_t>* edges, sg_netzone_t netzone,
                                         container_t container)
 {
-  if (not netzone->getChildren()->empty()) {
+  if (not netzone->get_children()->empty()) {
     // bottom-up recursion
-    for (auto const& netzone_child : *netzone->getChildren()) {
+    for (auto const& netzone_child : *netzone->get_children()) {
       container_t child_container = container->children_.at(netzone_child->get_cname());
       recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
     }
index eefc262..ac01c07 100644 (file)
@@ -273,7 +273,7 @@ static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const char
   if (not strcmp(current->get_cname(), name))
     return current;
 
-  for (auto const& elem : *(current->getChildren())) {
+  for (auto const& elem : *(current->get_children())) {
     simgrid::s4u::NetZone* tmp = netzone_by_name_recursive(elem, name);
     if (tmp != nullptr) {
       return tmp;
index a01bd94..d361ce0 100644 (file)
@@ -57,7 +57,7 @@ void NetZone::set_property(const char* key, const char* value)
  *
  * This function returns the internal copy of the children, not a copy. Don't mess with it!
  */
-std::vector<NetZone*>* NetZone::getChildren()
+std::vector<NetZone*>* NetZone::get_children()
 {
   return children_;
 }
@@ -96,7 +96,7 @@ void NetZone::getHosts(std::vector<s4u::Host*>* whereto)
   }
 }
 
-int NetZone::getHostCount()
+int NetZone::get_host_count()
 {
   int count = 0;
   for (auto const& card : vertices_) {
@@ -142,7 +142,7 @@ sg_netzone_t sg_zone_get_by_name(const char* name)
 
 void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto)
 {
-  for (auto const& elem : *netzone->getChildren()) {
+  for (auto const& elem : *netzone->get_children()) {
     xbt_dict_set(whereto, elem->get_cname(), static_cast<void*>(elem), nullptr);
   }
 }
index bf7afcc..24def5e 100644 (file)
@@ -606,7 +606,7 @@ simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCre
     if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
       current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive;
     /* add to the sons dictionary */
-    current_routing->getChildren()->push_back(static_cast<simgrid::s4u::NetZone*>(new_zone));
+    current_routing->get_children()->push_back(static_cast<simgrid::s4u::NetZone*>(new_zone));
   }
 
   /* set the new current component of the tree */