Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/ActionQueue.hpp

    r8859b5 r11d433  
    1616#include "CodePatterns/Singleton.hpp"
    1717
    18 #include "CodePatterns/Observer/Channels.hpp"
    19 #include "CodePatterns/Observer/Observable.hpp"
    2018
    2119#ifdef HAVE_ACTION_THREAD
     
    3331#endif
    3432
     33class CommandLineParser;
     34
    3535namespace MoleCuilder {
    3636
     
    3838class ActionRegistry;
    3939class ActionTrait;
    40 
    41 namespace Queuedetail {
    42   template <class T> const T* lastChanged()
    43   {
    44     ASSERT(0, "Queuedetail::lastChanged() - only specializations may be used.");
    45     return NULL;
    46   }
    47 }
    4840
    4941/** This class combines the whole handling of Actions into a single class.
     
    5244 * automatically queued and placed into a History after execution.
    5345 */
    54 class ActionQueue : public Singleton<ActionQueue>, public Observable
     46class ActionQueue : public Singleton<ActionQueue>
    5547{
    5648  friend class Singleton<ActionQueue>;
     
    5951  typedef std::vector< Action * > ActionQueue_t;
    6052
    61   //!> channels for this observable
    62   enum NotificationType {
    63     ActionQueued,  // new action was queued
    64     NotificationType_MAX  // denotes the maximum of available notification types
    65   };
    66 
    67   //>! access to last changed element (atom or molecule)
    68   template <class T> const T* lastChanged() const
    69   { return Queuedetail::lastChanged<T>(); }
    70 
    7153  /** Queues the Action with \a name to be called.
    7254   *
     
    8163   * \param state whether Actions needs to be filled via a Dialog or not
    8264   */
    83   void queueAction(Action *_action, enum Action::QueryOptions state = Action::Interactive);
     65  void queueAction(const Action * const _action, enum Action::QueryOptions state = Action::Interactive);
    8466
    8567  /** Returns the spawned action by token \a name.
     
    167149  //!> grant Action access to internal history functions.
    168150  friend class Action;
     151  //!> grant CommandLineParser access to stop and clearQueue()
     152  friend class ::CommandLineParser;
    169153
    170154  /** Wrapper function to add state to ActionHistory.
     
    185169   */
    186170  void clear();
     171
     172  /** Clears all actions currently present in the actionqueues.
     173   *
     174   */
     175  void clearQueue();
    187176
    188177#ifdef HAVE_ACTION_THREAD
     
    233222  ~ActionQueue();
    234223
    235 private:
    236   friend const Action *Queuedetail::lastChanged<Action>();
    237   static const Action *_lastchangedaction;
    238 
    239224  //!> ActionRegistry to spawn new actions
    240225  ActionRegistry *AR;
     
    275260  ActionStatusList StatusList;
    276261};
    277 namespace Queuedetail {
    278   template <>       inline  const Action* lastChanged<Action>() { return ActionQueue::_lastchangedaction; }
    279 }
    280262
    281263};
Note: See TracChangeset for help on using the changeset viewer.