Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The default destructor should be fine.
[simgrid.git] / src / mc / api / ActorState.hpp
index eda280894b3762813000f82543ef44f8c5f7b774..315ed8af38df6ddf8c3afc9401fcd2ee862ec3a0 100644 (file)
@@ -40,7 +40,7 @@ class ActorState {
    * such transitions such that `pending_transitions_[i]` represents
    * the variation of the transition with `times_considered = i`.
    *
-   * TODO: If only a subset of transitions of an actor that can
+   * @note: If only a subset of transitions of an actor that can
    * take multiple transitions in some state are truly enabled,
    * we would instead need to map `times_considered` to a transition,
    * as the map is currently implicit in the ordering of the transitions
@@ -98,6 +98,7 @@ public:
     return times_considered_++;
   }
   unsigned int get_times_considered() const { return times_considered_; }
+  unsigned int get_times_not_considered() const { return max_consider_ - times_considered_; }
   aid_t get_aid() const { return aid_; }
 
   /* returns whether the actor is marked as enabled in the application side */
@@ -114,7 +115,7 @@ public:
   }
   void mark_done() { this->state_ = InterleavingType::done; }
 
-  inline Transition* get_transition(unsigned times_considered)
+  inline Transition* get_transition(unsigned times_considered) const
   {
     xbt_assert(times_considered < this->pending_transitions_.size(),
                "Actor %ld does not have a state available transition with `times_considered = %u`,\n"
@@ -123,7 +124,7 @@ public:
     return this->pending_transitions_[times_considered].get();
   }
 
-  inline void set_transition(std::unique_ptr<Transition> t, unsigned times_considered)
+  inline void set_transition(std::shared_ptr<Transition> t, unsigned times_considered)
   {
     xbt_assert(times_considered < this->pending_transitions_.size(),
                "Actor %ld does not have a state available transition with `times_considered = %u`, "
@@ -131,6 +132,11 @@ public:
                aid_, times_considered);
     this->pending_transitions_[times_considered] = std::move(t);
   }
+
+  const std::vector<std::shared_ptr<Transition>>& get_enabled_transitions() const
+  {
+    return this->pending_transitions_;
+  };
 };
 
 } // namespace simgrid::mc