- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/CmdAction/FastParsingAction.cpp
rbf3817 rbcf653 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /* 2 9 * FastParsingAction.cpp … … 33 40 class CommandLineFastParsingState : public ActionState { 34 41 public: 35 CommandLineFastParsingState(bool _bool) : 36 boolean(_bool) 42 CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) : 43 oldvalue(_oldvalue), 44 newvalue(_newvalue) 37 45 {} 38 bool boolean; 46 bool oldvalue; 47 bool newvalue; 39 48 }; 40 49 … … 63 72 64 73 Action::state_ptr CommandLineFastParsingAction::performCall() { 65 66 74 config *configuration = World::getInstance().getConfig(); 67 ValueStorage::getInstance().queryCurrentValue(NAME, configuration->FastParsing); 75 bool oldvalue = configuration->FastParsing; 76 bool newvalue; 77 ValueStorage::getInstance().queryCurrentValue(NAME, newvalue); 78 configuration->FastParsing = newvalue; 68 79 if (configuration->FastParsing) 69 80 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl); 70 81 else 71 82 DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl); 72 return Action::s uccess;83 return Action::state_ptr(new CommandLineFastParsingState(oldvalue, newvalue)); 73 84 } 74 85 … … 77 88 78 89 config *configuration = World::getInstance().getConfig(); 79 configuration->FastParsing = state->boolean; 90 configuration->FastParsing = state->oldvalue; 91 if (configuration->FastParsing) 92 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl); 93 else 94 DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl); 80 95 81 return Action::state_ptr( new CommandLineFastParsingState(!state->boolean));96 return Action::state_ptr(_state); 82 97 } 83 98 84 99 Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _state){ 85 return performUndo(_state); 100 CommandLineFastParsingState *state = assert_cast<CommandLineFastParsingState*>(_state.get()); 101 102 config *configuration = World::getInstance().getConfig(); 103 configuration->FastParsing = state->newvalue; 104 if (configuration->FastParsing) 105 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl); 106 else 107 DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl); 108 109 return Action::state_ptr(_state); 86 110 } 87 111
Note:
See TracChangeset
for help on using the changeset viewer.