X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3ebb95127bac9bc6d8ba66319f1db561e9a5c6c1..b3a756fa6fe08c4f377ce22d205ef5c1b28bd250:/src/instr/jedule/jedule_events.cpp diff --git a/src/instr/jedule/jedule_events.cpp b/src/instr/jedule/jedule_events.cpp index d363720508..afe12f3cac 100644 --- a/src/instr/jedule/jedule_events.cpp +++ b/src/instr/jedule/jedule_events.cpp @@ -1,44 +1,39 @@ -/* Copyright (c) 2010-2014. The SimGrid Team. +/* Copyright (c) 2010-2016. 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_events.hpp" #include "simgrid/jedule/jedule.hpp" -#include -#include -#include - +#include "simgrid/s4u/NetZone.hpp" #include "xbt/asserts.h" -#if HAVE_JEDULE +#if SIMGRID_HAVE_JEDULE namespace simgrid{ namespace jedule{ -Event::~Event(){ - while (!this->resource_subsets.empty()){ - xbt_free(this->resource_subsets.back()); - this->resource_subsets.pop_back(); - } +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) +{ + this->resource_subsets = new std::vector(); } -void Event::addResources(std::vector *host_selection) { - xbt_dynar_t resource_subset_list; - jed_res_subset_t res_set; - unsigned int i; - - resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), nullptr); - - jed_simgrid_get_resource_selection_by_hosts(resource_subset_list, host_selection); - xbt_dynar_foreach(resource_subset_list, i, res_set) { - this->resource_subsets.push_back(res_set); +Event::~Event() +{ + if (not this->resource_subsets->empty()) { + for (auto subset: *this->resource_subsets) + delete subset; + delete this->resource_subsets; } +} - xbt_dynar_free_container(&resource_subset_list); +void Event::addResources(std::vector *host_selection) +{ + get_resource_selection_by_hosts(this->resource_subsets, host_selection); } -void Event::addCharacteristic(char *characteristic) { +void Event::addCharacteristic(char *characteristic) +{ xbt_assert( characteristic != nullptr ); this->characteristics_list.push_back(characteristic); } @@ -48,31 +43,32 @@ void Event::addInfo(char* key, char *value) { this->info_map.insert({key, value}); } -void Event::print(FILE *jed_file){ +void Event::print(FILE *jed_file) +{ fprintf(jed_file, " \n"); fprintf(jed_file, " \n", this->name.c_str()); fprintf(jed_file, " \n", this->start_time); fprintf(jed_file, " \n", this->end_time); fprintf(jed_file, " \n", this->type.c_str()); - xbt_assert(!this->resource_subsets.empty()); + xbt_assert(not this->resource_subsets->empty()); fprintf(jed_file, " \n"); - for (auto subset: this->resource_subsets) { + for (auto subset: *this->resource_subsets) { fprintf(jed_file, "