Changes in src/Actions/ActionQueue.hpp [601ef8:11d433]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionQueue.hpp
r601ef8 r11d433 16 16 #include "CodePatterns/Singleton.hpp" 17 17 18 #include "CodePatterns/Observer/Channels.hpp"19 #include "CodePatterns/Observer/Observable.hpp"20 18 21 19 #ifdef HAVE_ACTION_THREAD … … 40 38 class ActionRegistry; 41 39 class ActionTrait; 42 43 namespace Queuedetail {44 template <class T> const T* lastChanged()45 {46 ASSERT(0, "Queuedetail::lastChanged() - only specializations may be used.");47 return NULL;48 }49 }50 40 51 41 /** This class combines the whole handling of Actions into a single class. … … 54 44 * automatically queued and placed into a History after execution. 55 45 */ 56 class ActionQueue : public Singleton<ActionQueue> , public Observable46 class ActionQueue : public Singleton<ActionQueue> 57 47 { 58 48 friend class Singleton<ActionQueue>; … … 61 51 typedef std::vector< Action * > ActionQueue_t; 62 52 63 //!> channels for this observable64 enum NotificationType {65 ActionQueued, // new action was queued66 NotificationType_MAX // denotes the maximum of available notification types67 };68 69 //>! access to last changed element (atom or molecule)70 template <class T> const T* lastChanged() const71 { return Queuedetail::lastChanged<T>(); }72 73 53 /** Queues the Action with \a name to be called. 74 54 * … … 144 124 */ 145 125 void redoLast(); 146 147 /** Checks whether there is one completed Action stored in ActionHistory in the past.148 *149 * @return true - at least one Action to undo present, false - else150 */151 bool canUndo() const;152 153 /** Checks whether there is one completed Action stored in ActionHistory in the future.154 *155 * @return true - at least one Action to redo present, false - else156 */157 bool canRedo() const;158 126 159 127 /** Return status of last executed action. … … 202 170 void clear(); 203 171 204 /** Clears all actions present in the actionqueues from \a _fromAction. 205 * 206 * @param _fromAction 0 if all Actions to clear or else 207 */ 208 void clearQueue(const size_t _fromAction = 0); 209 210 #ifdef HAVE_ACTION_THREAD 211 212 /** Clears the temporary queue. 213 * 214 */ 215 void clearTempQueue(); 216 217 /** Sets the run_thread_isIdle flag. 218 * 219 * @param _flag state to set to 220 */ 221 void setRunThreadIdle(const bool _flag); 222 172 /** Clears all actions currently present in the actionqueues. 173 * 174 */ 175 void clearQueue(); 176 177 #ifdef HAVE_ACTION_THREAD 223 178 /** Runs the ActionQueue. 224 179 * … … 239 194 */ 240 195 void wait(); 241 242 /** Moves all action from tempqueue into real queue.243 *244 */245 void insertTempQueue();246 247 196 #endif 248 197 … … 255 204 void insertAction(Action *_action, enum Action::QueryOptions state); 256 205 206 /** Moves all action from tempqueue into real queue. 207 * 208 */ 209 void insertTempQueue(); 210 257 211 private: 258 212 /** Private cstor for ActionQueue. … … 268 222 ~ActionQueue(); 269 223 270 private:271 friend const Action *Queuedetail::lastChanged<Action>();272 static const Action *_lastchangedaction;273 274 224 //!> ActionRegistry to spawn new actions 275 225 ActionRegistry *AR; … … 281 231 ActionQueue_t actionqueue; 282 232 233 //!> point to current action in actionqueue 234 size_t CurrentAction; 235 236 //!> internal temporary actionqueue of actions used by insertAction() 237 ActionQueue_t tempqueue; 238 283 239 //!> indicates that the last action has failed 284 240 bool lastActionOk; 285 241 286 242 #ifdef HAVE_ACTION_THREAD 287 //!> point to current action in actionqueue288 size_t CurrentAction;289 290 //!> internal temporary actionqueue of actions used by insertAction()291 ActionQueue_t tempqueue;292 293 243 //!> internal thread to call Actions 294 244 boost::thread run_thread; … … 310 260 ActionStatusList StatusList; 311 261 }; 312 namespace Queuedetail {313 template <> inline const Action* lastChanged<Action>() { return ActionQueue::_lastchangedaction; }314 }315 262 316 263 };
Note:
See TracChangeset
for help on using the changeset viewer.