votca 2024-dev
Loading...
Searching...
No Matches
xtpapplication.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20#pragma once
21
22#ifndef VOTCA_XTP_XTPAPPLICATION_H
23#define VOTCA_XTP_XTPAPPLICATION_H
24
25// Third party includes
26#include <algorithm>
30
31namespace votca {
32namespace xtp {
33
35 public:
37 ~XtpApplication() override;
38
39 void Initialize() final;
40 bool EvaluateOptions() final;
41 void Run() final;
42 void ShowHelpText(std::ostream &out) final;
43
44 protected:
45 virtual void execute() = 0;
46 virtual std::string CalculatorType() const = 0;
47
48 virtual void EvaluateSpecificOptions() = 0;
49
50 virtual std::vector<std::string> CalculatorNames() const = 0;
51
52 virtual void CreateCalculator(const std::string &name) = 0;
53
54 virtual void AddCommandLineOptions() = 0;
55
57
58 private:
59 void PrintShortHelp(std::ostream &out,
60 const std::string &calculator_name) const;
61
62 void PrintLongHelp(std::ostream &out, const std::string &calculator_name,
63 tools::PropertyIOManipulator::Type format) const;
64
65 bool CalcExists(const std::string &name) const {
66 std::vector<std::string> names = CalculatorNames();
67 return (std::find(names.begin(), names.end(), name) != names.end());
68 }
69};
70
71} // namespace xtp
72} // namespace votca
73
74#endif // VOTCA_XTP_XTPAPPLICATION_H
Manipulates the format state of the output stream.
class to manage program options with xml serialization functionality
Definition property.h:55
virtual void CreateCalculator(const std::string &name)=0
virtual std::vector< std::string > CalculatorNames() const =0
virtual void execute()=0
void PrintLongHelp(std::ostream &out, const std::string &calculator_name, tools::PropertyIOManipulator::Type format) const
void Initialize() final
Adds program options to the executable.
bool CalcExists(const std::string &name) const
virtual std::string CalculatorType() const =0
votca::tools::Property options_
void ShowHelpText(std::ostream &out) final
void Run() final
Main body of application.
virtual void EvaluateSpecificOptions()=0
virtual void AddCommandLineOptions()=0
void PrintShortHelp(std::ostream &out, const std::string &calculator_name) const
bool EvaluateOptions() final
Process command line options.
STL namespace.
base class for all analysis tools
Definition basebead.h:33