source: molecuilder/src/Actions/ManipulateAtomsProcess.cpp@ 5dba7a

Last change on this file since 5dba7a was 4c60ef, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Added generic singleton Pattern that can be inherited to any class making that class a singleton.

  • Property mode set to 100644
File size: 957 bytes
RevLine 
[cbc27f]1/*
2 * ManipulateAtomsProcess.cpp
3 *
4 * Created on: Feb 18, 2010
5 * Author: crueger
6 */
7
8#include "ManipulateAtomsProcess.hpp"
9
10#include <iostream>
11
12using namespace std;
13
14ManipulateAtomsProcess::ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor _descr,
15 std::string _name,bool _doRegister) :
[98a2987]16 Process(0,_name,_doRegister),
[cbc27f]17 descr(_descr),
[98a2987]18 operation(_operation)
[cbc27f]19{}
20
21ManipulateAtomsProcess::~ManipulateAtomsProcess()
22{}
23
24void ManipulateAtomsProcess::call(){
[4c60ef]25 World::getInstance().doManipulate(this);
[cbc27f]26}
27
28void ManipulateAtomsProcess::undo(){
29
30}
31
32bool ManipulateAtomsProcess::canUndo(){
33 return false;
34}
[9ef76a]35
36void ManipulateAtomsProcess::doManipulate(World *world){
37 setMaxSteps(world->numAtoms());
38 start();
39 World::AtomIterator iter;
40 for(iter=world->getAtomIter(descr);iter!=world->atomEnd();++iter){
41 setCurrStep(iter.getCount());
42 operation(*iter);
43 }
44 stop();
45}
Note: See TracBrowser for help on using the repository browser.