7 #ifndef SRC_INCLUDE_SMASH_ACTIONS_H_
8 #define SRC_INCLUDE_SMASH_ACTIONS_H_
42 explicit Actions(ActionList&& action_list) :
data_(std::move(action_list)) {
61 throw std::runtime_error(
"Empty actions list!");
64 ActionPtr act = std::move(
data_.back());
80 for (
auto& a : new_acts) {
93 data_.push_back(std::move(action));
98 ActionList::size_type
size()
const {
return data_.size(); }
104 std::vector<ActionPtr>::const_reverse_iterator
begin()
const {
105 return data_.crbegin();
109 std::vector<ActionPtr>::const_reverse_iterator
end()
const {
110 return data_.crend();
122 static bool cmp(
const ActionPtr& a,
const ActionPtr& b) {
123 return a->time_of_execution() > b->time_of_execution();
The Actions class abstracts the storage and manipulation of actions.
Actions()
Default constructor, creating an empty Actions object.
void insert(ActionPtr &&action)
Insert an action into this container.
ActionPtr pop()
Return the first action in the list and removes it from the list.
Actions(ActionList &&action_list)
Creates a new Actions object from an ActionList.
double earliest_time() const
Return time of execution of earliest action.
static bool cmp(const ActionPtr &a, const ActionPtr &b)
Compare two action pointer such that the maximum is the most recent action.
Actions & operator=(const Actions &)=delete
Cannot be copied.
ActionList::size_type size() const
void insert(ActionList &&new_acts)
Insert a list of actions into this object.
std::vector< ActionPtr > data_
Dynamic data.
std::vector< ActionPtr >::const_reverse_iterator end() const
Actions(const Actions &)=delete
Cannot be copied.
std::vector< ActionPtr >::const_reverse_iterator begin() const
void clear()
Delete all actions.