Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stick to our coding standards: getters should have get_ in their name
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 14 May 2020 16:01:34 +0000 (18:01 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 14 May 2020 16:01:34 +0000 (18:01 +0200)
src/plugins/link_energy.cpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp

index 5fa3a82..e75c128 100644 (file)
@@ -152,7 +152,7 @@ static void on_communicate(const simgrid::kernel::resource::NetworkAction& actio
                            const simgrid::s4u::Host*)
 {
   XBT_DEBUG("onCommunicate is called");
-  for (simgrid::kernel::resource::LinkImpl* link : action.links()) {
+  for (simgrid::kernel::resource::LinkImpl* link : action.get_links()) {
     if (link == nullptr || link->get_sharing_policy() == simgrid::s4u::Link::SharingPolicy::WIFI)
       continue;
 
@@ -217,13 +217,14 @@ void sg_link_energy_plugin_init()
                link.extension<LinkEnergy>()->get_consumed_energy());
   });
 
-  simgrid::s4u::Link::on_communication_state_change.connect([](
-      simgrid::kernel::resource::NetworkAction const& action, simgrid::kernel::resource::Action::State /* previous */) {
-    for (simgrid::kernel::resource::LinkImpl* link : action.links()) {
-      if (link != nullptr && link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI)
-        link->get_iface()->extension<LinkEnergy>()->update();
-    }
-  });
+  simgrid::s4u::Link::on_communication_state_change.connect(
+      [](simgrid::kernel::resource::NetworkAction const& action,
+         simgrid::kernel::resource::Action::State /* previous */) {
+        for (simgrid::kernel::resource::LinkImpl* link : action.get_links()) {
+          if (link != nullptr && link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::WIFI)
+            link->get_iface()->extension<LinkEnergy>()->update();
+        }
+      });
 
   simgrid::s4u::Link::on_communicate.connect(&on_communicate);
   simgrid::s4u::Engine::on_simulation_end.connect(&on_simulation_end);
index ccb7e03..5d9a7a5 100644 (file)
@@ -181,7 +181,7 @@ void NetworkAction::set_state(Action::State state)
 }
 
 /** @brief returns a list of all Links that this action is using */
-std::list<LinkImpl*> NetworkAction::links() const
+std::list<LinkImpl*> NetworkAction::get_links() const
 {
   std::list<LinkImpl*> retlist;
   int llen = get_variable()->get_number_of_constraint();
index 3ecd3bb..33515e8 100644 (file)
@@ -187,7 +187,7 @@ public:
   NetworkAction(Model* model, double cost, bool failed, lmm::Variable* var) : Action(model, cost, failed, var){};
 
   void set_state(Action::State state) override;
-  virtual std::list<LinkImpl*> links() const;
+  virtual std::list<LinkImpl*> get_links() const;
 
   double latency_    = {};
   double lat_current_ = {};
index 2792bcb..e57a70c 100644 (file)
@@ -365,7 +365,7 @@ void NetworkNS3Action::resume() {
   THROW_UNIMPLEMENTED;
 }
 
-std::list<LinkImpl*> NetworkNS3Action::links() const
+std::list<LinkImpl*> NetworkNS3Action::get_links() const
 {
   THROW_UNIMPLEMENTED;
 }
index f828efd..d305e96 100644 (file)
@@ -50,7 +50,7 @@ public:
 
   void suspend() override;
   void resume() override;
-  std::list<LinkImpl*> links() const override;
+  std::list<LinkImpl*> get_links() const override;
   void update_remains_lazy(double now) override;
 
   // private: