/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * SetOutputFormatsAction.cpp * * Created on: May 8, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "Helpers/MemDebug.hpp" #include "Parser/ChangeTracker.hpp" #include "Parser/FormatParserStorage.hpp" #include "Helpers/Log.hpp" #include "Helpers/Verbose.hpp" #include "World.hpp" #include #include using namespace std; #include "Actions/WorldAction/SetOutputFormatsAction.hpp" // and construct the stuff #include "SetOutputFormatsAction.def" #include "Action_impl_pre.hpp" /** =========== define the function ====================== */ Action::state_ptr WorldSetOutputFormatsAction::performCall() { // obtain information getParametersfromValueStorage(); for (vector::iterator iter = params.FormatList.begin(); iter != params.FormatList.end(); ++iter) { if (*iter == "mpqc") { FormatParserStorage::getInstance().addMpqc(); DoLog(0) && (Log() << Verbose(0) << "Adding mpqc type to output." << endl); } else if (*iter == "pcp") { FormatParserStorage::getInstance().addPcp(); DoLog(0) && (Log() << Verbose(0) << "Adding pcp type to output." << endl); } else if (*iter == "tremolo") { FormatParserStorage::getInstance().addTremolo(); DoLog(0) && (Log() << Verbose(0) << "Adding tremolo type to output." << endl); } else if (*iter == "xyz") { FormatParserStorage::getInstance().addXyz(); DoLog(0) && (Log() << Verbose(0) << "Adding xyz type to output." << endl); } else { DoeLog(1) && (eLog() << Verbose(1) << "Unknown format:" << *iter << endl); } } ChangeTracker::getInstance().saveStatus(); return Action::success; } Action::state_ptr WorldSetOutputFormatsAction::performUndo(Action::state_ptr _state) { // ParserLoadXyzState *state = assert_cast(_state.get()); return Action::failure; // string newName = state->mol->getName(); // state->mol->setName(state->lastName); // // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); } Action::state_ptr WorldSetOutputFormatsAction::performRedo(Action::state_ptr _state){ return Action::failure; } bool WorldSetOutputFormatsAction::canUndo() { return false; } bool WorldSetOutputFormatsAction::shouldUndo() { return false; } const string WorldSetOutputFormatsAction::getName() { return NAME; } /** =========== end of function ====================== */