Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/CmdAction/FastParsingAction.cpp

    rbcf653 rc89fb4  
    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 
    81/*
    92 * FastParsingAction.cpp
     
    125 *      Author: heber
    136 */
    14 
    15 // include config.h
    16 #ifdef HAVE_CONFIG_H
    17 #include <config.h>
    18 #endif
    197
    208#include "Helpers/MemDebug.hpp"
     
    4028class CommandLineFastParsingState : public ActionState {
    4129public:
    42   CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) :
    43     oldvalue(_oldvalue),
    44     newvalue(_newvalue)
     30  CommandLineFastParsingState(bool _bool) :
     31    boolean(_bool)
    4532  {}
    46   bool oldvalue;
    47   bool newvalue;
     33  bool boolean;
    4834};
    4935
     
    7258
    7359Action::state_ptr CommandLineFastParsingAction::performCall() {
     60
    7461  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);
    7963  if (configuration->FastParsing)
    8064    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    8165  else
    8266    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    83   return Action::state_ptr(new CommandLineFastParsingState(oldvalue, newvalue));
     67  return Action::success;
    8468}
    8569
     
    8872
    8973  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;
    9575
    96   return Action::state_ptr(_state);
     76  return Action::state_ptr(new CommandLineFastParsingState(!state->boolean));
    9777}
    9878
    9979Action::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);
    11081}
    11182
Note: See TracChangeset for help on using the changeset viewer.