Flow123d  last_with_con_2.0.0-663-gd0e2296
main.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file main.h
15  * @brief
16  */
17 
18 #include <string>
20 #include "input/accessors.hh"
21 #include "input/type_output.hh"
23 #include "system/exceptions.hh"
24 
25 using namespace std;
26 
27 #ifndef MAIN_H
28 #define MAIN_H
29 
30 
31 
32 class Application : public ApplicationBase {
33 public:
34  TYPEDEF_ERR_INFO( EI_InputVersionStr, string);
35  DECLARE_EXCEPTION( ExcVersionFormat,
36  << "Wrong format of the version specification: "
37  << EI_InputVersionStr::qval);
38 
39 
40  /// Root of the Input::Type tree. Description of whole input structure.
41  static Input::Type::Record & get_input_type();
42 
43  /// Application constructor.
44  Application(int argc, char ** argv);
45 
46  /**
47  * Displays program version and build info.
48  * Pass version information to Profiler.
49  *
50  * TODO: Split these two functionalities.
51  */
52  void display_version();
53 
54  /**
55  * Read main input file
56  *
57  * Returns accessor to the root Record.
58  */
59  Input::Record read_input();
60 
61  /// Destructor
62  virtual ~Application();
63 
64 protected:
65 
66  /**
67  * Run application.
68  *
69  * Read input and solve problem.
70  */
71  virtual void run();
72 
73  /**
74  * Check pause_after_run flag defined in input file.
75  */
76  virtual void after_run();
77 
78 
79  /**
80  * Parse command line parameters.
81  * @param[in] argc command line argument count
82  * @param[in] argv command line arguments
83  */
84  virtual void parse_cmd_line(const int argc, char ** argv);
85 
86 private:
87 
88  /// Get version of program and other base data from rev_num.h and store them to map
89  Input::Type::RevNumData get_rev_num_data();
90 
91  /// filename of main input file
93 
94  //int passed_argc_;
95  //char ** passed_argv_;
96 
97  /// Description of possible command line arguments.
99 
100  /// If true, we do output of profiling information.
102 
103  /// If true, preserves output of balance in YAML format.
105 
106  /// root input record
108 };
109 
110 
111 
112 
113 #endif
114 
115 //-----------------------------------------------------------------------------
116 // vim: set cindent:
117 
string main_input_filename_
filename of main input file
Definition: main.h:92
#define DECLARE_EXCEPTION(ExcName, Format)
Macro for simple definition of exceptions.
Definition: exceptions.hh:150
bool use_profiler
If true, we do output of profiling information.
Definition: main.h:101
Stores version of program and other base data of application.
Definition: type_output.hh:37
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
bool yaml_balance_output_
If true, preserves output of balance in YAML format.
Definition: main.h:104
#define TYPEDEF_ERR_INFO(EI_Type, Type)
Macro to simplify declaration of error_info types.
Definition: exceptions.hh:186
string program_arguments_desc_
Description of possible command line arguments.
Definition: main.h:98
Record type proxy class.
Definition: type_record.hh:171
Input::Record root_record
root input record
Definition: main.h:107