1 /* Copyright (c) 2010-2020. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "xbt/asserts.h"
8 #include "simgrid/jedule/jedule.hpp"
10 #if SIMGRID_HAVE_JEDULE
15 void Jedule::add_meta_info(char* key, char* value)
17 xbt_assert(key != nullptr);
18 xbt_assert(value != nullptr);
20 this->meta_info_.insert({key, value});
23 void Jedule::add_event(const Event& event)
25 event_set_.emplace_back(event);
28 void Jedule::write_output(FILE* file)
30 if (not this->event_set_.empty()) {
31 fprintf(file, "<jedule>\n");
33 if (not this->meta_info_.empty()) {
34 fprintf(file, " <jedule_meta>\n");
35 for (auto const& elm : this->meta_info_)
36 fprintf(file, " <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
37 fprintf(file, " </jedule_meta>\n");
40 fprintf(file, " <platform>\n");
41 this->root_container_.print(file);
42 fprintf(file, " </platform>\n");
44 fprintf(file, " <events>\n");
45 for (auto const& event : this->event_set_)
47 fprintf(file, " </events>\n");
49 fprintf(file, "</jedule>\n");
54 } // namespace simgrid