Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'python-repr' into 'master'
[simgrid.git] / src / mc / mc_record.hpp
index 753ffafa9fd14a78a83e87908a619eb051a3a29a..a2f73106280c5dc35badbcefba7f5cb96bd98571 100644 (file)
 #include "src/mc/mc_forward.hpp"
 #include "xbt/base.h"
 
+#include <deque>
 #include <string>
-#include <vector>
 
 namespace simgrid::mc {
 
 class RecordTrace {
-  std::vector<Transition*> transitions_;
+  std::deque<Transition*> transitions_;
 
 public:
-  RecordTrace() = default;
+  // Use rule-of-three, and implicitely disable the move constructor which cannot be 'noexcept' (as required by C++ Core
+  // Guidelines), due to the std::deque member.
+  RecordTrace()                   = default;
+  RecordTrace(const RecordTrace&) = default;
+  ~RecordTrace()                  = default;
 
   /** Build a trace that can be replayed from a string representation */
   explicit RecordTrace(const char* data);
   /** Make a string representation that can later be used to create a new trace */
   std::string to_string() const;
 
+  void push_front(Transition* t) { transitions_.push_front(t); }
   void push_back(Transition* t) { transitions_.push_back(t); }
-  std::vector<Transition*>::const_iterator begin() const { return transitions_.begin(); }
-  std::vector<Transition*>::const_iterator end() const { return transitions_.end(); }
+  std::deque<Transition*>::const_iterator begin() const { return transitions_.begin(); }
+  std::deque<Transition*>::const_iterator end() const { return transitions_.end(); }
 
   /** Replay all transitions of a trace */
   void replay() const;