Ignore:
File:
1 edited

Legend:

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

    r7e37a3 rbf3817  
    55 *      Author: heber
    66 */
     7
     8// include config.h
     9#ifdef HAVE_CONFIG_H
     10#include <config.h>
     11#endif
    712
    813#include "Helpers/MemDebug.hpp"
     
    2833class CommandLineFastParsingState : public ActionState {
    2934public:
    30   CommandLineFastParsingState(const bool _oldvalue, const bool _newvalue) :
    31     oldvalue(_oldvalue),
    32     newvalue(_newvalue)
     35  CommandLineFastParsingState(bool _bool) :
     36    boolean(_bool)
    3337  {}
    34   bool oldvalue;
    35   bool newvalue;
     38  bool boolean;
    3639};
    3740
     
    6063
    6164Action::state_ptr CommandLineFastParsingAction::performCall() {
     65
    6266  config *configuration = World::getInstance().getConfig();
    63   bool oldvalue = configuration->FastParsing;
    64   bool newvalue;
    65   ValueStorage::getInstance().queryCurrentValue(NAME, newvalue);
    66   configuration->FastParsing = newvalue;
     67  ValueStorage::getInstance().queryCurrentValue(NAME, configuration->FastParsing);
    6768  if (configuration->FastParsing)
    6869    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    6970  else
    7071    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    71   return Action::state_ptr(new CommandLineFastParsingState(oldvalue, newvalue));
     72  return Action::success;
    7273}
    7374
     
    7677
    7778  config *configuration = World::getInstance().getConfig();
    78   configuration->FastParsing = state->oldvalue;
    79   if (configuration->FastParsing)
    80     DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    81   else
    82     DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
     79  configuration->FastParsing = state->boolean;
    8380
    84   return Action::state_ptr(_state);
     81  return Action::state_ptr(new CommandLineFastParsingState(!state->boolean));
    8582}
    8683
    8784Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _state){
    88   CommandLineFastParsingState *state = assert_cast<CommandLineFastParsingState*>(_state.get());
    89 
    90   config *configuration = World::getInstance().getConfig();
    91   configuration->FastParsing = state->newvalue;
    92   if (configuration->FastParsing)
    93     DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
    94   else
    95     DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
    96 
    97   return Action::state_ptr(_state);
     85  return performUndo(_state);
    9886}
    9987
Note: See TracChangeset for help on using the changeset viewer.