An event collects the information for one event for the sweep-line
| 128 | typedef enum {EVENT_CHCK, EVENT_PROF, EVENT_PRUN} ev_t; |
| 129 | /// An event collects the information for one event for the sweep-line |
| 130 | class Event |
| 131 | { |
| 132 | public: |
| 133 | /// The type of the event |
| 134 | ev_t e; |
| 135 | /// The task this event refers to |
| 136 | int task; |
| 137 | /// The date of this event |
| 138 | int date; |
| 139 | /// The quantity changed by this event (if any) |
| 140 | int inc; |
| 141 | /** If the type is EVENT_PROF and it is the first of the pair, |
| 142 | * this value is true. Added to handle contribution-values |
| 143 | * correctly for both at_most and at_least. |
| 144 | */ |
| 145 | bool first_prof; |
| 146 | |
| 147 | /// Simple constructor |
| 148 | Event(ev_t _e, int _task, int _date, int _inc = 0, bool _first_prof = false) |
| 149 | : e(_e), task(_task), date(_date), inc(_inc), first_prof(_first_prof) |
| 150 | {} |
| 151 | |
| 152 | // Default constructor for region-allocated memory |
| 153 | Event(void) {} |
| 154 | |
| 155 | /// Order events based on date. |
| 156 | bool operator <(const Event& ev) const { |
| 157 | if (date == ev.date) { |
| 158 | if (e == EVENT_PROF && ev.e != EVENT_PROF) return true; |
| 159 | if (e == EVENT_CHCK && ev.e == EVENT_PRUN) return true; |
| 160 | return false; |
| 161 | } |
| 162 | return date < ev.date; |
| 163 | } |
| 164 | }; |
| 165 | |
| 166 | template<class ViewM, class ViewP, class ViewU, class View> |
| 167 | ExecStatus |