Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[KERNEL] Replaced literal strings with variable.
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 30 Oct 2017 09:21:13 +0000 (10:21 +0100)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 30 Oct 2017 12:26:14 +0000 (13:26 +0100)
This error message was hardcoded several times. Replaced
it with a const message.

src/kernel/routing/FatTreeZone.cpp

index 4eb5f29..92301b4 100644 (file)
@@ -361,11 +361,11 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   std::vector<std::string> parameters;
   std::vector<std::string> tmp;
   boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
   std::vector<std::string> parameters;
   std::vector<std::string> tmp;
   boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
+  const std::string error_msg {"Fat trees are defined by the levels number and 3 vectors, see the documentation for more information"};
 
   // TODO : we have to check for zeros and negative numbers, or it might crash
   if (parameters.size() != 4) {
 
   // TODO : we have to check for zeros and negative numbers, or it might crash
   if (parameters.size() != 4) {
-    surf_parse_error(
-        "Fat trees are defined by the levels number and 3 vectors, see the documentation for more information");
+    surf_parse_error(error_msg);
   }
 
   // The first parts of topo_parameters should be the levels number
   }
 
   // The first parts of topo_parameters should be the levels number
@@ -378,8 +378,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   // Then, a l-sized vector standing for the children number by level
   boost::split(tmp, parameters[1], boost::is_any_of(","));
   if (tmp.size() != this->levels_) {
   // Then, a l-sized vector standing for the children number by level
   boost::split(tmp, parameters[1], boost::is_any_of(","));
   if (tmp.size() != this->levels_) {
-    surf_parse_error("Fat trees are defined by the levels number and 3 vectors"
-                     ", see the documentation for more information");
+    surf_parse_error(error_msg);
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
@@ -392,8 +391,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   // Then, a l-sized vector standing for the parents number by level
   boost::split(tmp, parameters[2], boost::is_any_of(","));
   if (tmp.size() != this->levels_) {
   // Then, a l-sized vector standing for the parents number by level
   boost::split(tmp, parameters[2], boost::is_any_of(","));
   if (tmp.size() != this->levels_) {
-    surf_parse_error("Fat trees are defined by the levels number and 3 vectors"
-                     ", see the documentation for more information");
+    surf_parse_error(error_msg);
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
@@ -406,8 +404,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   // Finally, a l-sized vector standing for the ports number with the lower level
   boost::split(tmp, parameters[3], boost::is_any_of(","));
   if (tmp.size() != this->levels_) {
   // Finally, a l-sized vector standing for the ports number with the lower level
   boost::split(tmp, parameters[3], boost::is_any_of(","));
   if (tmp.size() != this->levels_) {
-    surf_parse_error("Fat trees are defined by the levels number and 3 vectors"
-                     ", see the documentation for more information");
+    surf_parse_error(error_msg);
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {