| 1 | /* | 
|---|
| 2 | * ManipulateAtomsProcess.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Feb 18, 2010 | 
|---|
| 5 | *      Author: crueger | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef MANIPULATEATOMSPROCESS_HPP_ | 
|---|
| 9 | #define MANIPULATEATOMSPROCESS_HPP_ | 
|---|
| 10 |  | 
|---|
| 11 | // include config.h | 
|---|
| 12 | #ifdef HAVE_CONFIG_H | 
|---|
| 13 | #include <config.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | #include "Actions/Process.hpp" | 
|---|
| 18 |  | 
|---|
| 19 | #include<boost/function.hpp> | 
|---|
| 20 |  | 
|---|
| 21 | #include "Descriptors/AtomDescriptor.hpp" | 
|---|
| 22 |  | 
|---|
| 23 | class manipulateAtomsTest; | 
|---|
| 24 | class World; | 
|---|
| 25 |  | 
|---|
| 26 | namespace MoleCuilder { | 
|---|
| 27 |  | 
|---|
| 28 | class ActionRegistry; | 
|---|
| 29 |  | 
|---|
| 30 | class ManipulateAtomsProcess : public Process | 
|---|
| 31 | { | 
|---|
| 32 | friend class ::manipulateAtomsTest; | 
|---|
| 33 | public: | 
|---|
| 34 | ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor descr,const ActionTrait &_trait); | 
|---|
| 35 | virtual ~ManipulateAtomsProcess(); | 
|---|
| 36 |  | 
|---|
| 37 | virtual bool canUndo(); | 
|---|
| 38 | virtual bool shouldUndo(); | 
|---|
| 39 |  | 
|---|
| 40 | Action* clone(enum QueryOptions flag = Interactive) const; | 
|---|
| 41 |  | 
|---|
| 42 | void outputAsCLI(std::ostream &ost) const; | 
|---|
| 43 | void outputAsPython(std::ostream &ost, const std::string &prefix) const; | 
|---|
| 44 |  | 
|---|
| 45 | void setOptionValue(const std::string &_token, const std::string &_value); | 
|---|
| 46 |  | 
|---|
| 47 | virtual void doManipulate(World *); | 
|---|
| 48 |  | 
|---|
| 49 | private: | 
|---|
| 50 | /** Wrap function Action::call() to allow manipulateAtomsTest access. | 
|---|
| 51 | * | 
|---|
| 52 | */ | 
|---|
| 53 | void call() | 
|---|
| 54 | { Process::call(); } | 
|---|
| 55 |  | 
|---|
| 56 | protected: | 
|---|
| 57 | virtual Dialog * fillDialog(Dialog*); | 
|---|
| 58 | private: | 
|---|
| 59 | virtual ActionState::ptr performCall(); | 
|---|
| 60 | virtual ActionState::ptr performUndo(ActionState::ptr); | 
|---|
| 61 | virtual ActionState::ptr performRedo(ActionState::ptr); | 
|---|
| 62 |  | 
|---|
| 63 | AtomDescriptor descr; | 
|---|
| 64 | boost::function<void(atom*)> operation; | 
|---|
| 65 | }; | 
|---|
| 66 |  | 
|---|
| 67 | } | 
|---|
| 68 |  | 
|---|
| 69 | #endif /* MANIPULATEATOMSPROCESS_HPP_ */ | 
|---|