Changes in src/Actions/ActionQueue.hpp [11d433:601ef8]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionQueue.hpp
r11d433 r601ef8 16 16 #include "CodePatterns/Singleton.hpp" 17 17 18 #include "CodePatterns/Observer/Channels.hpp" 19 #include "CodePatterns/Observer/Observable.hpp" 18 20 19 21 #ifdef HAVE_ACTION_THREAD … … 38 40 class ActionRegistry; 39 41 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 } 40 50 41 51 /** This class combines the whole handling of Actions into a single class. … … 44 54 * automatically queued and placed into a History after execution. 45 55 */ 46 class ActionQueue : public Singleton<ActionQueue> 56 class ActionQueue : public Singleton<ActionQueue>, public Observable 47 57 { 48 58 friend class Singleton<ActionQueue>; … … 51 61 typedef std::vector< Action * > ActionQueue_t; 52 62 63 //!> channels for this observable 64 enum NotificationType { 65 ActionQueued, // new action was queued 66 NotificationType_MAX // denotes the maximum of available notification types 67 }; 68 69 //>! access to last changed element (atom or molecule) 70 template <class T> const T* lastChanged() const 71 { return Queuedetail::lastChanged<T>(); } 72 53 73 /** Queues the Action with \a name to be called. 54 74 * … … 124 144 */ 125 145 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 - else 150 */ 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 - else 156 */ 157 bool canRedo() const; 126 158 127 159 /** Return status of last executed action. … … 170 202 void clear(); 171 203 172 /** Clears all actions currently present in the actionqueues. 173 * 174 */ 175 void clearQueue(); 176 177 #ifdef HAVE_ACTION_THREAD 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 178 223 /** Runs the ActionQueue. 179 224 * … … 194 239 */ 195 240 void wait(); 241 242 /** Moves all action from tempqueue into real queue. 243 * 244 */ 245 void insertTempQueue(); 246 196 247 #endif 197 248 … … 204 255 void insertAction(Action *_action, enum Action::QueryOptions state); 205 256 206 /** Moves all action from tempqueue into real queue.207 *208 */209 void insertTempQueue();210 211 257 private: 212 258 /** Private cstor for ActionQueue. … … 222 268 ~ActionQueue(); 223 269 270 private: 271 friend const Action *Queuedetail::lastChanged<Action>(); 272 static const Action *_lastchangedaction; 273 224 274 //!> ActionRegistry to spawn new actions 225 275 ActionRegistry *AR; … … 231 281 ActionQueue_t actionqueue; 232 282 283 //!> indicates that the last action has failed 284 bool lastActionOk; 285 286 #ifdef HAVE_ACTION_THREAD 233 287 //!> point to current action in actionqueue 234 288 size_t CurrentAction; … … 237 291 ActionQueue_t tempqueue; 238 292 239 //!> indicates that the last action has failed240 bool lastActionOk;241 242 #ifdef HAVE_ACTION_THREAD243 293 //!> internal thread to call Actions 244 294 boost::thread run_thread; … … 260 310 ActionStatusList StatusList; 261 311 }; 312 namespace Queuedetail { 313 template <> inline const Action* lastChanged<Action>() { return ActionQueue::_lastchangedaction; } 314 } 262 315 263 316 };
Note:
See TracChangeset
for help on using the changeset viewer.