Ignore:
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
    18/*
    29 * FastParsingAction.cpp
     
    3340class CommandLineFastParsingState : public ActionState {
    3441public:
    35   CommandLineFastParsingState(bool _bool) :
    36     boolean(_bool)
     42  CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) :
     43    oldvalue(_oldvalue),
     44    newvalue(_newvalue)
    3745  {}
    38   bool boolean;
     46  bool oldvalue;
     47  bool newvalue;
    3948};
    4049
     
    6372
    6473Action::state_ptr CommandLineFastParsingAction::performCall() {
    65 
    6674  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;
    6879  if (configuration->FastParsing)
    6980    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    7081  else
    7182    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    72   return Action::success;
     83  return Action::state_ptr(new CommandLineFastParsingState(oldvalue, newvalue));
    7384}
    7485
     
    7788
    7889  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);
    8095
    81   return Action::state_ptr(new CommandLineFastParsingState(!state->boolean));
     96  return Action::state_ptr(_state);
    8297}
    8398
    8499Action::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);
    86110}
    87111
Note: See TracChangeset for help on using the changeset viewer.