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 |
|
---|
8 | /*
|
---|
9 | * ElementDbAction.cpp
|
---|
10 | *
|
---|
11 | * Created on: May 9, 2010
|
---|
12 | * Author: heber
|
---|
13 | */
|
---|
14 |
|
---|
15 | // include config.h
|
---|
16 | #ifdef HAVE_CONFIG_H
|
---|
17 | #include <config.h>
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | #include "Helpers/MemDebug.hpp"
|
---|
21 |
|
---|
22 | #include "config.hpp"
|
---|
23 | #include "Helpers/Log.hpp"
|
---|
24 | #include "periodentafel.hpp"
|
---|
25 | #include "Helpers/Verbose.hpp"
|
---|
26 | #include "World.hpp"
|
---|
27 |
|
---|
28 | #include <iostream>
|
---|
29 | #include <string>
|
---|
30 |
|
---|
31 | using namespace std;
|
---|
32 |
|
---|
33 | #include "Actions/CommandAction/ElementDbAction.hpp"
|
---|
34 |
|
---|
35 | // and construct the stuff
|
---|
36 | #include "ElementDbAction.def"
|
---|
37 | #include "Action_impl_pre.hpp"
|
---|
38 | /** =========== define the function ====================== */
|
---|
39 | Action::state_ptr CommandElementDbAction::performCall() {
|
---|
40 | ostringstream usage;
|
---|
41 |
|
---|
42 | // obtain information
|
---|
43 | getParametersfromValueStorage();
|
---|
44 |
|
---|
45 | // get the path
|
---|
46 | // TODO: Make databasepath a std::string
|
---|
47 | config *configuration = World::getInstance().getConfig();
|
---|
48 | strcpy(configuration->databasepath, params.databasepath.c_str());
|
---|
49 |
|
---|
50 | // load table
|
---|
51 | periodentafel *periode = World::getInstance().getPeriode();
|
---|
52 | if (periode->LoadPeriodentafel(configuration->databasepath)) {
|
---|
53 | DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
|
---|
54 | //periode->Output();
|
---|
55 | return Action::success;
|
---|
56 | } else {
|
---|
57 | DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
|
---|
58 | return Action::failure;
|
---|
59 | }
|
---|
60 |
|
---|
61 | }
|
---|
62 |
|
---|
63 | Action::state_ptr CommandElementDbAction::performUndo(Action::state_ptr _state) {
|
---|
64 | // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
|
---|
65 |
|
---|
66 | return Action::failure;
|
---|
67 | // string newName = state->mol->getName();
|
---|
68 | // state->mol->setName(state->lastName);
|
---|
69 | //
|
---|
70 | // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
|
---|
71 | }
|
---|
72 |
|
---|
73 | Action::state_ptr CommandElementDbAction::performRedo(Action::state_ptr _state){
|
---|
74 | return Action::failure;
|
---|
75 | }
|
---|
76 |
|
---|
77 | bool CommandElementDbAction::canUndo() {
|
---|
78 | return false;
|
---|
79 | }
|
---|
80 |
|
---|
81 | bool CommandElementDbAction::shouldUndo() {
|
---|
82 | return false;
|
---|
83 | }
|
---|
84 |
|
---|
85 | const string CommandElementDbAction::getName() {
|
---|
86 | return NAME;
|
---|
87 | }
|
---|
88 | /** =========== end of function ====================== */
|
---|