Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implement pthread_join in MC mode for sthread
[simgrid.git] / src / mc / udpor_global.hpp
index bc01589125e70234426f140d37db668272e32ce5..60a6eb0947fee4416a3fc0ee33e0016975ead80c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2022. 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. */
@@ -8,9 +8,9 @@
 
 #include <iostream>
 #include <queue>
+#include <string_view>
 
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 class UnfoldingEvent;
 using EventSet = std::deque<UnfoldingEvent*>;
@@ -18,9 +18,9 @@ using EventSet = std::deque<UnfoldingEvent*>;
 class EvtSetTools {
 public:
   static bool contains(const EventSet& events, const UnfoldingEvent* e);
-  static UnfoldingEvent* find(const EventSet events, const UnfoldingEvent* e);
+  static UnfoldingEvent* find(const EventSet& events, const UnfoldingEvent* e);
   static void subtract(EventSet& events, EventSet const& otherSet);
-  static bool depends(EventSet const& events, EventSet const& otherSet);
+  static bool depends(const EventSet& events, const EventSet& otherSet);
   static bool isEmptyIntersection(EventSet evtS1, EventSet evtS2);
   static EventSet makeUnion(const EventSet& s1, const EventSet& s2);
   static void pushBack(EventSet& events, UnfoldingEvent* e);
@@ -58,7 +58,6 @@ public:
 
 class UnfoldingEvent {
 public:
-  EventSet causes; // used to store directed ancestors of event e
   UnfoldingEvent(unsigned int nb_events, std::string const& trans_tag, EventSet const& causes, int sid = -1);
   UnfoldingEvent(const UnfoldingEvent&) = default;
   UnfoldingEvent& operator=(UnfoldingEvent const&) = default;
@@ -83,9 +82,10 @@ public:
   inline void set_state_id(int sid) { state_id = sid; }
 
   inline std::string get_transition_tag() const { return transition_tag; }
-  inline void set_transition_tag(std::string const& tr_tag) { transition_tag = tr_tag; }
+  inline void set_transition_tag(std::string_view tr_tag) { transition_tag = tr_tag; }
 
 private:
+  EventSet causes; // used to store directed ancestors of event e
   int id = -1;
   int state_id{-1};
   std::string transition_tag{""}; // The tag of the last transition that lead to creating the event
@@ -93,6 +93,5 @@ private:
   bool transition_is_ISend(const UnfoldingEvent* testedEvt, const UnfoldingEvent* SdRcEvt) const;
   bool check_tr_concern_same_comm(bool& chk1, bool& chk2, UnfoldingEvent* evt1, UnfoldingEvent* evt2) const;
 };
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc
 #endif