| 1 | /* | 
|---|
| 2 | * Project: MoleCuilder | 
|---|
| 3 | * Description: creates and alters molecular systems | 
|---|
| 4 | * Copyright (C)  2010-2012 University of Bonn. All rights reserved. | 
|---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | /* | 
|---|
| 9 | * SetTremoloAtomdataAction.cpp | 
|---|
| 10 | * | 
|---|
| 11 | *  Created on: Aug 9, 2011 | 
|---|
| 12 | *      Author: heber | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | // include config.h | 
|---|
| 16 | #ifdef HAVE_CONFIG_H | 
|---|
| 17 | #include <config.h> | 
|---|
| 18 | #endif | 
|---|
| 19 |  | 
|---|
| 20 | #include "CodePatterns/MemDebug.hpp" | 
|---|
| 21 |  | 
|---|
| 22 | #include "Parser/TremoloParser.hpp" | 
|---|
| 23 | #include "Parser/FormatParserStorage.hpp" | 
|---|
| 24 | #include "CodePatterns/Log.hpp" | 
|---|
| 25 | #include "CodePatterns/Verbose.hpp" | 
|---|
| 26 |  | 
|---|
| 27 | #include <iostream> | 
|---|
| 28 | #include <string> | 
|---|
| 29 |  | 
|---|
| 30 | #include <boost/filesystem/fstream.hpp> | 
|---|
| 31 |  | 
|---|
| 32 | #include "SetTremoloAtomdataAction.hpp" | 
|---|
| 33 |  | 
|---|
| 34 | using namespace MoleCuilder; | 
|---|
| 35 |  | 
|---|
| 36 | // and construct the stuff | 
|---|
| 37 | #include "SetTremoloAtomdataAction.def" | 
|---|
| 38 | #include "Action_impl_pre.hpp" | 
|---|
| 39 | /** =========== define the function ====================== */ | 
|---|
| 40 | Action::state_ptr ParserSetTremoloAtomdataAction::performCall() { | 
|---|
| 41 | FormatParser<tremolo> &parser = FormatParserStorage::getInstance().getParser<tremolo>(); | 
|---|
| 42 |  | 
|---|
| 43 | LOG(1, "Setting Tremolo's ATOMDATA to: '" << params.atomdata_string << "'"); | 
|---|
| 44 |  | 
|---|
| 45 | parser.setAtomData(params.atomdata_string); | 
|---|
| 46 |  | 
|---|
| 47 | return Action::success; | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 | Action::state_ptr ParserSetTremoloAtomdataAction::performUndo(Action::state_ptr _state) { | 
|---|
| 51 | //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get()); | 
|---|
| 52 |  | 
|---|
| 53 | return Action::failure; | 
|---|
| 54 | //  string newName = state->mol->getName(); | 
|---|
| 55 | //  state->mol->setName(state->lastName); | 
|---|
| 56 | // | 
|---|
| 57 | //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | Action::state_ptr ParserSetTremoloAtomdataAction::performRedo(Action::state_ptr _state){ | 
|---|
| 61 | return Action::failure; | 
|---|
| 62 | } | 
|---|
| 63 |  | 
|---|
| 64 | bool ParserSetTremoloAtomdataAction::canUndo() { | 
|---|
| 65 | return false; | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | bool ParserSetTremoloAtomdataAction::shouldUndo() { | 
|---|
| 69 | return false; | 
|---|
| 70 | } | 
|---|
| 71 | /** =========== end of function ====================== */ | 
|---|