- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/CmdAction/FastParsingAction.cpp
rbcf653 rc89fb4 1 /*2 * Project: MoleCuilder3 * Description: creates and alters molecular systems4 * 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 8 1 /* 9 2 * FastParsingAction.cpp … … 12 5 * Author: heber 13 6 */ 14 15 // include config.h16 #ifdef HAVE_CONFIG_H17 #include <config.h>18 #endif19 7 20 8 #include "Helpers/MemDebug.hpp" … … 40 28 class CommandLineFastParsingState : public ActionState { 41 29 public: 42 CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) : 43 oldvalue(_oldvalue), 44 newvalue(_newvalue) 30 CommandLineFastParsingState(bool _bool) : 31 boolean(_bool) 45 32 {} 46 bool oldvalue; 47 bool newvalue; 33 bool boolean; 48 34 }; 49 35 … … 72 58 73 59 Action::state_ptr CommandLineFastParsingAction::performCall() { 60 74 61 config *configuration = World::getInstance().getConfig(); 75 bool oldvalue = configuration->FastParsing; 76 bool newvalue; 77 ValueStorage::getInstance().queryCurrentValue(NAME, newvalue); 78 configuration->FastParsing = newvalue; 62 ValueStorage::getInstance().queryCurrentValue(NAME, configuration->FastParsing); 79 63 if (configuration->FastParsing) 80 64 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl); 81 65 else 82 66 DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl); 83 return Action::s tate_ptr(new CommandLineFastParsingState(oldvalue, newvalue));67 return Action::success; 84 68 } 85 69 … … 88 72 89 73 config *configuration = World::getInstance().getConfig(); 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); 74 configuration->FastParsing = state->boolean; 95 75 96 return Action::state_ptr( _state);76 return Action::state_ptr(new CommandLineFastParsingState(!state->boolean)); 97 77 } 98 78 99 79 Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _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); 80 return performUndo(_state); 110 81 } 111 82
Note:
See TracChangeset
for help on using the changeset viewer.