X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dc9b8feaddd53842f6204f4f24409b2382393fa9..83f0364920918d0380a5d538216193bfe00ddc47:/src/instr/jedule/jedule_events.cpp diff --git a/src/instr/jedule/jedule_events.cpp b/src/instr/jedule/jedule_events.cpp index c166df4451..eba1deae1d 100644 --- a/src/instr/jedule/jedule_events.cpp +++ b/src/instr/jedule/jedule_events.cpp @@ -1,10 +1,11 @@ -/* Copyright (c) 2010-2019. The SimGrid Team. +/* Copyright (c) 2010-2021. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/jedule/jedule.hpp" +#include "simgrid/config.h" #include "simgrid/s4u/NetZone.hpp" #include "xbt/asserts.h" @@ -12,30 +13,15 @@ namespace simgrid{ namespace jedule{ -Event::Event(const std::string& name, double start_time, double end_time, const std::string& type) - : name_(name), start_time_(start_time), end_time_(end_time), type_(type) -{ - this->resource_subsets_ = new std::vector(); -} - -Event::~Event() -{ - if (not this->resource_subsets_->empty()) { - for (auto const& subset : *this->resource_subsets_) - delete subset; - delete this->resource_subsets_; - } -} - -void Event::add_resources(std::vector* host_selection) +void Event::add_resources(const std::vector& host_selection) { get_resource_selection_by_hosts(this->resource_subsets_, host_selection); } -void Event::add_characteristic(char* characteristic) +void Event::add_characteristic(const char* characteristic) { xbt_assert( characteristic != nullptr ); - this->characteristics_list_.push_back(characteristic); + this->characteristics_list_.emplace_back(characteristic); } void Event::add_info(char* key, char* value) @@ -44,7 +30,7 @@ void Event::add_info(char* key, char* value) this->info_map_.insert({key, value}); } -void Event::print(FILE *jed_file) +void Event::print(FILE* jed_file) const { fprintf(jed_file, " \n"); fprintf(jed_file, " \n", this->name_.c_str()); @@ -52,12 +38,12 @@ void Event::print(FILE *jed_file) fprintf(jed_file, " \n", this->end_time_); fprintf(jed_file, " \n", this->type_.c_str()); - xbt_assert(not this->resource_subsets_->empty()); + xbt_assert(not this->resource_subsets_.empty()); fprintf(jed_file, " \n"); - for (auto const& subset : *this->resource_subsets_) { + for (auto const& subset : this->resource_subsets_) { fprintf(jed_file, "