10 #ifndef WRENCH_SIMULATIONTRACE_H
11 #define WRENCH_SIMULATIONTRACE_H
19 #include "wrench/simulation/SimulationTimestamp.h"
29 class GenericSimulationTrace {
32 virtual ~GenericSimulationTrace() {}
59 this->trace.push_back(timestamp);
69 std::vector<SimulationTimestamp<T> *>
getTrace() {
77 for (
auto ×tamp : this->trace) {
84 std::vector<SimulationTimestamp<T> *> trace;
100 auto hostname = new_timestamp->
getContent()->getHostname();
102 auto hostname_search = latest_timestamps_by_host.find(hostname);
103 if (hostname_search == latest_timestamps_by_host.end()) {
105 this->trace.push_back(new_timestamp);
106 this->latest_timestamps_by_host[hostname] = this->trace.size() - 1;
114 if (std::fabs(new_timestamp->
getDate() - latest_timestamp->
getDate()) < DBL_EPSILON) {
115 std::swap(new_timestamp, latest_timestamp);
120 delete new_timestamp;
123 this->trace.push_back(new_timestamp);
124 this->latest_timestamps_by_host[hostname] = this->trace.size() - 1;
126 throw std::runtime_error(
127 "SimulationTrace<SimulationTimestampPstateSet>::addTimestamp() timestamps out of order");
137 std::vector<SimulationTimestamp<SimulationTimestampPstateSet> *>
getTrace() {
145 for (
auto ×tamp: this->trace) {
151 std::map<std::string, size_t> latest_timestamps_by_host;
152 std::vector<SimulationTimestamp<SimulationTimestampPstateSet> *> trace;
162 #endif //WRENCH_SIMULATIONTRACE_H