-typedef std::pair<double, simgrid::kernel::resource::Action*> heap_element_type;
-typedef boost::heap::pairing_heap<heap_element_type, boost::heap::constant_time_size<false>, boost::heap::stable<true>,
- boost::heap::compare<simgrid::xbt::HeapComparator<heap_element_type>>>
- heap_type;
+using heap_element_type = std::pair<double, Action*>;
+using heap_type =
+ boost::heap::pairing_heap<heap_element_type, boost::heap::constant_time_size<false>, boost::heap::stable<true>,
+ boost::heap::compare<simgrid::xbt::HeapComparator<heap_element_type>>>;
+
+class XBT_PUBLIC ActionHeap : public heap_type {
+ friend Action;
+
+public:
+ enum class Type {
+ latency = 100, /* this is a heap entry to warn us when the latency is paid */
+ max_duration, /* this is a heap entry to warn us when the max_duration limit (timeout) is reached */
+ normal, /* this is a normal heap entry stating the date to finish transmitting */
+ unset
+ };
+
+ double top_date() const;
+ void insert(Action* action, double date, ActionHeap::Type type);
+ void update(Action* action, double date, ActionHeap::Type type);
+ void remove(Action* action);
+ Action* pop();
+};
+
+/** @details An action is a consumption on a resource (e.g.: a communication for the network).
+ *
+ * It is related (but still different) from activities, that are the stuff on which an actor can be blocked.
+ *
+ * - A sequential execution activity encompasses 2 actions: one for the exec itself,
+ * and a time-limited sleep used as timeout detector.
+ * - A point-to-point communication activity encompasses 3 actions: one for the comm itself
+ * (which spans on all links of the path), and one infinite sleep used as failure detector
+ * on both sender and receiver hosts.
+ * - Synchronization activities may possibly be connected to no action.