1 /* Copyright (c) 2010-2021. 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 "simgrid/jedule/jedule.hpp"
8 #include "simgrid/config.h"
9 #include "xbt/asserts.h"
11 #if SIMGRID_HAVE_JEDULE
16 void Jedule::add_meta_info(char* key, char* value)
18 xbt_assert(key != nullptr);
19 xbt_assert(value != nullptr);
21 this->meta_info_.insert({key, value});
24 void Jedule::add_event(const Event& event)
26 event_set_.emplace_back(event);
29 void Jedule::write_output(FILE* file)
31 if (not this->event_set_.empty()) {
32 fprintf(file, "<jedule>\n");
34 if (not this->meta_info_.empty()) {
35 fprintf(file, " <jedule_meta>\n");
36 for (auto const& elm : this->meta_info_)
37 fprintf(file, " <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
38 fprintf(file, " </jedule_meta>\n");
41 fprintf(file, " <platform>\n");
42 this->root_container_.print(file);
43 fprintf(file, " </platform>\n");
45 fprintf(file, " <events>\n");
46 for (auto const& event : this->event_set_)
48 fprintf(file, " </events>\n");
50 fprintf(file, "</jedule>\n");
55 } // namespace simgrid