Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
jedule: obey our coding standards
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 18 Jun 2018 13:20:14 +0000 (15:20 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 18 Jun 2018 21:54:03 +0000 (23:54 +0200)
At least in surface

include/simgrid/jedule/jedule.hpp
include/simgrid/jedule/jedule_events.hpp
include/simgrid/jedule/jedule_platform.hpp
src/instr/jedule/jedule.cpp
src/instr/jedule/jedule_events.cpp
src/instr/jedule/jedule_platform.cpp
src/instr/jedule/jedule_sd_binding.cpp

index 1a1e859..93a1b69 100644 (file)
@@ -18,9 +18,9 @@ class XBT_PUBLIC Jedule {
 public:
   Jedule()=default;
   ~Jedule();
-  std::vector<Event *> event_set;
-  Container* root_container = nullptr;
-  std::unordered_map<char*, char*> meta_info;
+  std::vector<Event*> event_set_;
+  Container* root_container_ = nullptr;
+  std::unordered_map<char*, char*> meta_info_;
   void add_meta_info(char* key, char* value);
   void cleanup_output();
   void write_output(FILE* file);
index 54d0002..3c853e3 100644 (file)
@@ -42,13 +42,13 @@ public:
   }
 
 private:
-  std::string name;
-  double start_time;
-  double end_time;
-  std::string type;
-  std::vector<jed_subset_t>* resource_subsets;
-  std::vector<char*> characteristics_list;   /* just a list of names (strings) */
-  std::unordered_map<char*, char*> info_map; /* key/value pairs */
+  std::string name_;
+  double start_time_;
+  double end_time_;
+  std::string type_;
+  std::vector<jed_subset_t>* resource_subsets_;
+  std::vector<char*> characteristics_list_;   /* just a list of names */
+  std::unordered_map<char*, char*> info_map_; /* key/value pairs */
 };
 }
 }
index e5d5f64..d291109 100644 (file)
@@ -20,8 +20,9 @@ public:
   explicit Container(std::string name);
   virtual ~Container();
 private:
-  int last_id;
-  int is_lowest = 0;
+  int last_id_;
+  int is_lowest_ = 0;
+
 public:
   std::string name;
   std::unordered_map<const char*, unsigned int> name2id;
index 762b1d4..3200459 100644 (file)
@@ -13,10 +13,10 @@ namespace simgrid{
 namespace jedule {
 
 Jedule::~Jedule() {
-  delete this->root_container;
-  for (auto const& evt : this->event_set)
+  delete this->root_container_;
+  for (auto const& evt : this->event_set_)
     delete evt;
-  this->event_set.clear();
+  this->event_set_.clear();
 }
 
 void Jedule::add_meta_info(char* key, char* value)
@@ -24,27 +24,27 @@ void Jedule::add_meta_info(char* key, char* value)
   xbt_assert(key != nullptr);
   xbt_assert(value != nullptr);
 
-  this->meta_info.insert({key, value});
+  this->meta_info_.insert({key, value});
 }
 
 void Jedule::write_output(FILE* file)
 {
-  if (not this->event_set.empty()) {
+  if (not this->event_set_.empty()) {
     fprintf(file, "<jedule>\n");
 
-    if (not this->meta_info.empty()) {
+    if (not this->meta_info_.empty()) {
       fprintf(file, "  <jedule_meta>\n");
-      for (auto const& elm : this->meta_info)
+      for (auto const& elm : this->meta_info_)
         fprintf(file, "        <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
       fprintf(file, "  </jedule_meta>\n");
     }
 
     fprintf(file, "  <platform>\n");
-    this->root_container->print(file);
+    this->root_container_->print(file);
     fprintf(file, "  </platform>\n");
 
     fprintf(file, "  <events>\n");
-    for (auto const& event : this->event_set)
+    for (auto const& event : this->event_set_)
       event->print(file);
     fprintf(file, "  </events>\n");
 
index 7047f22..b03a59d 100644 (file)
@@ -13,48 +13,48 @@ namespace simgrid{
 namespace jedule{
 
 Event::Event(std::string name, double start_time, double end_time, std::string type)
-  : name(name), start_time(start_time), end_time(end_time), type(type)
+    : name_(name), start_time_(start_time), end_time_(end_time), type_(type)
 {
-  this->resource_subsets = new std::vector<jed_subset_t>();
+  this->resource_subsets_ = new std::vector<jed_subset_t>();
 }
 
 Event::~Event()
 {
-  if (not this->resource_subsets->empty()) {
-    for (auto const& subset : *this->resource_subsets)
+  if (not this->resource_subsets_->empty()) {
+    for (auto const& subset : *this->resource_subsets_)
       delete subset;
-    delete this->resource_subsets;
+    delete this->resource_subsets_;
   }
 }
 
 void Event::add_resources(std::vector<sg_host_t>* host_selection)
 {
-  get_resource_selection_by_hosts(this->resource_subsets, host_selection);
+  get_resource_selection_by_hosts(this->resource_subsets_, host_selection);
 }
 
 void Event::add_characteristic(char* characteristic)
 {
   xbt_assert( characteristic != nullptr );
-  this->characteristics_list.push_back(characteristic);
+  this->characteristics_list_.push_back(characteristic);
 }
 
 void Event::add_info(char* key, char* value)
 {
   xbt_assert((key != nullptr) && value != nullptr);
-  this->info_map.insert({key, value});
+  this->info_map_.insert({key, value});
 }
 
 void Event::print(FILE *jed_file)
 {
   fprintf(jed_file, "    <event>\n");
-  fprintf(jed_file, "      <prop key=\"name\" value=\"%s\" />\n", this->name.c_str());
-  fprintf(jed_file, "      <prop key=\"start\" value=\"%g\" />\n", this->start_time);
-  fprintf(jed_file, "      <prop key=\"end\" value=\"%g\" />\n", this->end_time);
-  fprintf(jed_file, "      <prop key=\"type\" value=\"%s\" />\n", this->type.c_str());
+  fprintf(jed_file, "      <prop key=\"name\" value=\"%s\" />\n", this->name_.c_str());
+  fprintf(jed_file, "      <prop key=\"start\" value=\"%g\" />\n", this->start_time_);
+  fprintf(jed_file, "      <prop key=\"end\" value=\"%g\" />\n", this->end_time_);
+  fprintf(jed_file, "      <prop key=\"type\" value=\"%s\" />\n", this->type_.c_str());
 
-  xbt_assert(not this->resource_subsets->empty());
+  xbt_assert(not this->resource_subsets_->empty());
   fprintf(jed_file, "      <res_util>\n");
-  for (auto const& subset : *this->resource_subsets) {
+  for (auto const& subset : *this->resource_subsets_) {
     fprintf(jed_file, "        <select resources=\"");
     fprintf(jed_file, "%s", subset->parent->get_hierarchy_as_string().c_str());
     fprintf(jed_file, ".[%d-%d]", subset->start_idx, subset->start_idx + subset->nres-1);
@@ -62,16 +62,16 @@ void Event::print(FILE *jed_file)
   }
   fprintf(jed_file, "      </res_util>\n");
 
-  if (not this->characteristics_list.empty()) {
+  if (not this->characteristics_list_.empty()) {
     fprintf(jed_file, "      <characteristics>\n");
-    for (auto const& ch : this->characteristics_list)
+    for (auto const& ch : this->characteristics_list_)
       fprintf(jed_file, "          <characteristic name=\"%s\" />\n", ch);
     fprintf(jed_file, "      </characteristics>\n");
   }
 
-  if (not this->info_map.empty()) {
+  if (not this->info_map_.empty()) {
     fprintf(jed_file, "      <info>\n");
-    for (auto const& elm : this->info_map)
+    for (auto const& elm : this->info_map_)
       fprintf(jed_file, "        <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
     fprintf(jed_file, "      </info>\n");
   }
index 1c4ad33..2b80a60 100644 (file)
@@ -46,16 +46,16 @@ void Container::add_child(jed_container_t child)
 
 void Container::add_resources(std::vector<sg_host_t> hosts)
 {
-  this->is_lowest = 1;
+  this->is_lowest_ = 1;
   this->children.clear();
-  this->last_id = 0;
+  this->last_id_ = 0;
 
   //FIXME do we need to sort?: xbt_dynar_sort_strings(host_names);
 
   for (auto const& host : hosts) {
     const char *host_name = sg_host_get_name(host);
-    this->name2id.insert({host_name, this->last_id});
-    (this->last_id)++;
+    this->name2id.insert({host_name, this->last_id_});
+    (this->last_id_)++;
     host2_simgrid_parent_container.insert({host_name, this});
     this->resource_list.push_back(host);
   }
index bc3e415..769ca21 100644 (file)
@@ -23,7 +23,7 @@ void jedule_log_sd_event(SD_task_t task)
   jed_event_t event = new simgrid::jedule::Event(std::string(SD_task_get_name(task)),
                                                  SD_task_get_start_time(task), SD_task_get_finish_time(task), "SD");
   event->add_resources(task->allocation);
-  my_jedule->event_set.push_back(event);
+  my_jedule->event_set_.push_back(event);
 }
 
 void jedule_sd_init()
@@ -35,7 +35,7 @@ void jedule_sd_init()
 
   jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->get_cname()));
   root_container->create_hierarchy(root_comp);
-  my_jedule->root_container = root_container;
+  my_jedule->root_container_ = root_container;
 }
 
 void jedule_sd_exit()