Ignore:
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
    18/*
    29 * FastParsingAction.cpp
     
    512 *      Author: heber
    613 */
     14
     15// include config.h
     16#ifdef HAVE_CONFIG_H
     17#include <config.h>
     18#endif
    719
    820#include "Helpers/MemDebug.hpp"
     
    2840class CommandLineFastParsingState : public ActionState {
    2941public:
    30   CommandLineFastParsingState(bool _bool) :
    31     boolean(_bool)
     42  CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) :
     43    oldvalue(_oldvalue),
     44    newvalue(_newvalue)
    3245  {}
    33   bool boolean;
     46  bool oldvalue;
     47  bool newvalue;
    3448};
    3549
     
    5872
    5973Action::state_ptr CommandLineFastParsingAction::performCall() {
    60 
    6174  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;
    6379  if (configuration->FastParsing)
    6480    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    6581  else
    6682    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    67   return Action::success;
     83  return Action::state_ptr(new CommandLineFastParsingState(oldvalue, newvalue));
    6884}
    6985
     
    7288
    7389  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);
    7595
    76   return Action::state_ptr(new CommandLineFastParsingState(!state->boolean));
     96  return Action::state_ptr(_state);
    7797}
    7898
    7999Action::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);
    81110}
    82111
Note: See TracChangeset for help on using the changeset viewer.