Changeset 91b18cd for molecuilder/src/Actions
- Timestamp:
- Apr 8, 2010, 2:28:21 PM (15 years ago)
- Children:
- 298621
- Parents:
- abd4a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Actions/Action.hpp
rabd4a1 r91b18cd 181 181 * removeLastAction() method. If the construction of the sequence is done, you can use the 182 182 * callAll() method. Each action called this way will register itself with the History to allow 183 * sep erate undo of all actions in the sequence.183 * separate undo of all actions in the sequence. 184 184 * 185 185 * <H4> Building larger Actions from simple ones </H4> … … 200 200 * might brake important assumptions for the undo/redo mechanism 201 201 * </ul> 202 * 203 * <H3> Special kinds of Actions </H3> 204 * 205 * To make the usage of Actions more versatile there are two special kinds of actions defined, 206 * that contain special mechanisms. These are defined inside the class Process, for actions that 207 * take some time and indicate their own progress, and in the class Calculations for actions that 208 * have a retrievable result. 209 * 210 * <H4> Processes </H4> 211 * 212 * Processes are Actions that might take some time and therefore contain special mechanisms 213 * to indicate their progress to the user. If you want to implement a process you can follow the 214 * guidelines for implementing actions. In addition to the normal Action constructor parameters, 215 * you also need to define the number of steps the process takes to finish (use 0 if that number is 216 * not known upon construction). At the beginning of your process you then simply call start() to 217 * indicate that the process is taking up its work. You might also want to set the number of steps it 218 * needs to finish, if it has changed since the last invocation/construction. You can use the 219 * setMaxSteps() method for this. Then after each finished step of calulation simply call step(), 220 * to let the indicators know that it should update itself. If the number of steps is not known 221 * at the time of calculation, you should make sure the maxSteps field is set to 0, either through 222 * the constructor or by using setMaxSteps(0). Indicators are required to handle both processes that 223 * know the number of steps needed as well as processes that cannot predict when they will be finished. 224 * Once your calculation is done call stop() to let every indicator know that the process is done with 225 * the work and to let the user know. 226 * 227 * Indicators that want to know about processes need to implement the Observer class with all the 228 * methods defined there. They can then globally sign on to all processes using the static 229 * Process::AddObserver() method and remove themselves using the Process::RemoveObserver() 230 * methods. When a process starts it will take care that the notification for this process 231 * is invoked at the right time. Indicators should not try to observe a single process, but rather 232 * be ready to observe the status of any kind of process using the methods described here. 233 * 234 * <H4> Calculations </H4> 235 * 236 * Calculations are special Actions that also return a result when called. Calculations are 237 * always derived from Process, so that the progress of a calculation can be shown. Also 238 * Calculations should not contain side-effects and not consider the undo mechanism. 239 * When a Calculation is called using the Action mechanism this will cause it to calculate 240 * the result and make it available using the getResult() method. Another way to have a Calculation 241 * produce a result is by using the function-call operator. When this operator is used, the Calculation 242 * will try to return a previously calculated and cached result and only do any actuall calculations 243 * when no such result is available. You can delete the cached result using the reset() method. 202 244 */ 203 245
Note:
See TracChangeset
for help on using the changeset viewer.