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