#include <actions.h>
The Actions class abstracts the storage and manipulation of actions.
- Note
 - The Actions object cannot be copied, because it does not make sense semantically. Move semantics make sense and can be implemented when needed. 
 
Definition at line 29 of file actions.h.
 
 | 
| static bool  | cmp (const ActionPtr &a, const ActionPtr &b) | 
|   | Compare two action pointer such that the maximum is the most recent action.  More...
  | 
|   | 
◆ Actions() [1/3]
  
  
      
        
          | smash::Actions::Actions  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Default constructor, creating an empty Actions object. 
Definition at line 32 of file actions.h.
 
 
◆ Actions() [2/3]
  
  
      
        
          | smash::Actions::Actions  | 
          ( | 
          ActionList &&  | 
          action_list | ) | 
           | 
         
       
   | 
  
inlineexplicit   | 
  
 
Creates a new Actions object from an ActionList. 
The actions are stored in a heap and not sorted. The entries of the ActionList are rendered invalid by this constructor.
- Parameters
 - 
  
    | [in] | action_list | The ActionList from which to construct the Actions object  | 
  
   
Definition at line 42 of file actions.h.
   42                                              : 
data_(std::move(action_list)) {
 
 
 
 
◆ Actions() [3/3]
  
  
      
        
          | smash::Actions::Actions  | 
          ( | 
          const Actions &  | 
           | ) | 
           | 
         
       
   | 
  
delete   | 
  
 
 
◆ operator=()
◆ is_empty()
  
  
      
        
          | bool smash::Actions::is_empty  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
- Returns
 - whether the list of actions is empty. 
 
Definition at line 52 of file actions.h.
   52 { 
return data_.empty(); }
 
 
 
 
◆ pop()
  
  
      
        
          | ActionPtr smash::Actions::pop  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Return the first action in the list and removes it from the list. 
- Exceptions
 - 
  
    | RuntimeError | if the list is empty.  | 
  
   
Definition at line 59 of file actions.h.
   61       throw std::runtime_error(
"Empty actions list!");
 
   64     ActionPtr act = std::move(
data_.back());
 
 
 
 
◆ insert() [1/2]
  
  
      
        
          | void smash::Actions::insert  | 
          ( | 
          ActionList &&  | 
          new_acts | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Insert a list of actions into this object. 
They're inserted at the right places to keep the complete list a heap.
- Parameters
 - 
  
    | [in] | new_acts | The actions that will be inserted.  | 
  
   
Definition at line 76 of file actions.h.
   77     for (
auto& a : new_acts) {
 
 
 
 
◆ insert() [2/2]
  
  
      
        
          | void smash::Actions::insert  | 
          ( | 
          ActionPtr &&  | 
          action | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Insert an action into this container. 
The function makes sure that the action is inserted at the right place.
- Parameters
 - 
  
    | [in] | action | The action to insert.  | 
  
   
Definition at line 89 of file actions.h.
   90     data_.push_back(std::move(action));
 
 
 
 
◆ size()
  
  
      
        
          | ActionList::size_type smash::Actions::size  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
- Returns
 - Number of actions. 
 
Definition at line 95 of file actions.h.
   95 { 
return data_.size(); }
 
 
 
 
◆ clear()
  
  
      
        
          | void smash::Actions::clear  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Delete all actions. 
Definition at line 98 of file actions.h.
 
 
◆ begin()
  
  
      
        
          | std::vector<ActionPtr>::const_reverse_iterator smash::Actions::begin  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
- Returns
 - an iterator to the earliest action. 
 
Definition at line 101 of file actions.h.
  102     return data_.crbegin();
 
 
 
 
◆ end()
  
  
      
        
          | std::vector<ActionPtr>::const_reverse_iterator smash::Actions::end  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
- Returns
 - an iterator to the place following the last action. 
 
Definition at line 106 of file actions.h.
  107     return data_.crend();
 
 
 
 
◆ cmp()
  
  
      
        
          | static bool smash::Actions::cmp  | 
          ( | 
          const ActionPtr &  | 
          a,  | 
         
        
           | 
           | 
          const ActionPtr &  | 
          b  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestaticprivate   | 
  
 
Compare two action pointer such that the maximum is the most recent action. 
- Parameters
 - 
  
    | [in] | a | First action  | 
    | [in] | b | Second action  | 
  
   
- Returns
 - Whether the first action will be executed later than the second. 
 
Definition at line 119 of file actions.h.
  120     return a->time_of_execution() > b->time_of_execution();
 
 
 
 
◆ data_
  
  
      
        
          | std::vector<ActionPtr> smash::Actions::data_ | 
         
       
   | 
  
private   | 
  
 
Dynamic data. 
Vector is likely the best container type here. Because std::sort requires random access iterators. Any linked data structure (e.g. list) thus requires a less efficient sort algorithm. 
Definition at line 130 of file actions.h.
 
 
The documentation for this class was generated from the following file: