Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference parameters in src/kernel/.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 27 Dec 2019 22:45:30 +0000 (23:45 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 27 Dec 2019 22:50:33 +0000 (23:50 +0100)
include/simgrid/kernel/routing/FatTreeZone.hpp
include/simgrid/kernel/routing/RoutedZone.hpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp
src/kernel/context/ContextSwapped.cpp
src/kernel/lmm/maxmin.cpp
src/kernel/lmm/maxmin.hpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/RoutedZone.cpp

index 0e69e0d..a176471 100644 (file)
@@ -51,7 +51,7 @@ public:
    * instead of passing by an upper level switch.
    */
   resource::LinkImpl* loopback;
    * instead of passing by an upper level switch.
    */
   resource::LinkImpl* loopback;
-  FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int position);
+  FatTreeNode(const ClusterCreationArgs* cluster, int id, int level, int position);
 };
 
 /** @brief Link in a fat tree (@ref FatTreeZone).
 };
 
 /** @brief Link in a fat tree (@ref FatTreeZone).
@@ -61,7 +61,7 @@ public:
  */
 class FatTreeLink {
 public:
  */
 class FatTreeLink {
 public:
-  FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* source, FatTreeNode* destination);
+  FatTreeLink(const ClusterCreationArgs* cluster, FatTreeNode* source, FatTreeNode* destination);
   /** Link going up in the tree */
   resource::LinkImpl* up_link_;
   /** Link going down in the tree */
   /** Link going up in the tree */
   resource::LinkImpl* up_link_;
   /** Link going down in the tree */
index 55995aa..0d8a73e 100644 (file)
@@ -61,7 +61,7 @@ protected:
                                                 bool symmetrical, bool change_order);
   void get_route_check_params(NetPoint* src, NetPoint* dst);
   void add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                                                 bool symmetrical, bool change_order);
   void get_route_check_params(NetPoint* src, NetPoint* dst);
   void add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                              std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
+                              const std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
 };
 } // namespace routing
 } // namespace kernel
 };
 } // namespace routing
 } // namespace kernel
index f9b38a5..fdf73a3 100644 (file)
@@ -392,7 +392,7 @@ void ActorImpl::resume()
   XBT_OUT();
 }
 
   XBT_OUT();
 }
 
-activity::ActivityImplPtr ActorImpl::join(ActorImpl* actor, double timeout)
+activity::ActivityImplPtr ActorImpl::join(const ActorImpl* actor, double timeout)
 {
   activity::ActivityImplPtr sleep = this->sleep(timeout);
   actor->on_exit->emplace_back([sleep](bool) {
 {
   activity::ActivityImplPtr sleep = this->sleep(timeout);
   actor->on_exit->emplace_back([sleep](bool) {
index e7ea0d9..47225f3 100644 (file)
@@ -133,7 +133,7 @@ public:
   s4u::Actor* restart();
   void suspend();
   void resume();
   s4u::Actor* restart();
   void suspend();
   void resume();
-  activity::ActivityImplPtr join(ActorImpl* actor, double timeout);
+  activity::ActivityImplPtr join(const ActorImpl* actor, double timeout);
   activity::ActivityImplPtr sleep(double duration);
   /** Ask the actor to throw an exception right away */
   void throw_exception(std::exception_ptr e);
   activity::ActivityImplPtr sleep(double duration);
   /** Ask the actor to throw an exception right away */
   void throw_exception(std::exception_ptr e);
index e2ca416..862ef93 100644 (file)
@@ -162,7 +162,7 @@ void SwappedContextFactory::run_all()
     //     It only yields back to worker_context when the work array is exhausted.
     //   - So, resume() is only launched from the parmap for the first job of each minion.
     parmap_->apply(
     //     It only yields back to worker_context when the work array is exhausted.
     //   - So, resume() is only launched from the parmap for the first job of each minion.
     parmap_->apply(
-        [](smx_actor_t process) {
+        [](const actor::ActorImpl* process) {
           SwappedContext* context = static_cast<SwappedContext*>(process->context_.get());
           context->resume();
         },
           SwappedContext* context = static_cast<SwappedContext*>(process->context_.get());
           context->resume();
         },
index aeceb03..bf87775 100644 (file)
@@ -396,7 +396,7 @@ static inline void saturated_constraints_update(double usage, int cnst_light_num
   }
 }
 
   }
 }
 
-static inline void saturated_variable_set_update(ConstraintLight* cnst_light_tab,
+static inline void saturated_variable_set_update(const ConstraintLight* cnst_light_tab,
                                                  const dyn_light_t& saturated_constraints, System* sys)
 {
   /* Add active variables (i.e. variables that need to be set) from the set of constraints to saturate
                                                  const dyn_light_t& saturated_constraints, System* sys)
 {
   /* Add active variables (i.e. variables that need to be set) from the set of constraints to saturate
@@ -872,7 +872,7 @@ void System::update_constraint_bound(Constraint* cnst, double bound)
  *  A recursive algorithm to optimize the system recalculation selecting only constraints that have changed. Each
  *  constraint change is propagated to the list of constraints for each variable.
  */
  *  A recursive algorithm to optimize the system recalculation selecting only constraints that have changed. Each
  *  constraint change is propagated to the list of constraints for each variable.
  */
-void System::update_modified_set_rec(Constraint* cnst)
+void System::update_modified_set_rec(const Constraint* cnst)
 {
   for (Element const& elem : cnst->enabled_element_set_) {
     Variable* var = elem.variable;
 {
   for (Element const& elem : cnst->enabled_element_set_) {
     Variable* var = elem.variable;
index 3f7dd38..468aee3 100644 (file)
@@ -439,7 +439,7 @@ public:
   /** @brief Update a constraint bound */
   void update_constraint_bound(Constraint * cnst, double bound);
 
   /** @brief Update a constraint bound */
   void update_constraint_bound(Constraint * cnst, double bound);
 
-  int constraint_used(Constraint* cnst) { return cnst->active_constraint_set_hook_.is_linked(); }
+  int constraint_used(const Constraint* cnst) const { return cnst->active_constraint_set_hook_.is_linked(); }
 
   /** @brief Print the lmm system */
   void print() const;
 
   /** @brief Print the lmm system */
   void print() const;
@@ -505,8 +505,8 @@ private:
    */
   void update(Constraint * cnst, Variable * var, double value);
 
    */
   void update(Constraint * cnst, Variable * var, double value);
 
-  void update_modified_set(Constraint * cnst);
-  void update_modified_set_rec(Constraint * cnst);
+  void update_modified_set(Constraint* cnst);
+  void update_modified_set_rec(const Constraint* cnst);
 
   /** @brief Remove all constraints of the modified_constraint_set. */
   void remove_all_modified_set();
 
   /** @brief Remove all constraints of the modified_constraint_set. */
   void remove_all_modified_set();
index 475e034..9e7d2cc 100644 (file)
@@ -438,7 +438,7 @@ void FatTreeZone::generate_dot_file(const std::string& filename) const
   file.close();
 }
 
   file.close();
 }
 
-FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int position)
+FatTreeNode::FatTreeNode(const ClusterCreationArgs* cluster, int id, int level, int position)
     : id(id), level(level), position(position)
 {
   LinkCreationArgs linkTemplate;
     : id(id), level(level), position(position)
 {
   LinkCreationArgs linkTemplate;
@@ -460,7 +460,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po
   }
 }
 
   }
 }
 
-FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, FatTreeNode* upNode)
+FatTreeLink::FatTreeLink(const ClusterCreationArgs* cluster, FatTreeNode* downNode, FatTreeNode* upNode)
     : up_node_(upNode), down_node_(downNode)
 {
   static int uniqueId = 0;
     : up_node_(upNode), down_node_(downNode)
 {
   static int uniqueId = 0;
index 135b624..04eaf94 100644 (file)
@@ -166,7 +166,7 @@ void RoutedZone::get_route_check_params(NetPoint* src, NetPoint* dst)
              src->get_cname(), dst->get_cname(), src_as->get_cname(), dst_as->get_cname(), get_cname());
 }
 void RoutedZone::add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
              src->get_cname(), dst->get_cname(), src_as->get_cname(), dst_as->get_cname(), get_cname());
 }
 void RoutedZone::add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                                        std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
+                                        const std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
 {
   const char* srcName = src->get_cname();
   const char* dstName = dst->get_cname();
 {
   const char* srcName = src->get_cname();
   const char* dstName = dst->get_cname();