ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
input_item.h
Go to the documentation of this file.
1#ifndef INPUT_ITEM_H
2#define INPUT_ITEM_H
3#include <functional>
4#include <map>
5#include <sstream>
6#include <string>
7#include <vector>
8
10namespace ModuleIO
11{
13{
14 public:
16
17 Input_Item(const std::string& label_in)
18 {
19 label = label_in;
20 }
21
23 {
24 label = item.label;
26 final_value.str(item.final_value.str());
27 // Documentation fields
28 category = item.category;
29 type = item.type;
32 unit = item.unit;
39 }
40
41 std::string label;
42 std::vector<std::string> str_values;
43 std::stringstream final_value;
44
45 // Documentation fields for built-in help system
46 std::string category;
47 std::string type;
48 std::string description;
49 std::string default_value;
50 std::string unit;
51 std::string availability;
52
53 bool is_read() const
54 {
55 return !str_values.empty();
56 }
57
58 size_t get_size() const
59 {
60 return str_values.size();
61 }
62
63 std::string annotation;
64
65 // ====== !!! These functions are complete. ======
66 // ====== !!! Do not add any more functions here. ======
68 std::function<void(const Input_Item&, Parameter&)> read_value = [](const Input_Item& item, Parameter& param) {};
70 std::function<void(const Input_Item&, const Parameter&)> check_value = nullptr;
73 std::function<void(const Input_Item&, Parameter&)> reset_value = nullptr;
75 std::function<void(Input_Item&, const Parameter&)> get_final_value = nullptr;
76 // ====== !!! Do not add any more functions here. ======
77};
78
79} // namespace ModuleIO
80#endif // INPUT_ITEM_H
Definition input_item.h:13
std::function< void(const Input_Item &, Parameter &)> read_value
read value function
Definition input_item.h:68
std::string default_value
default value as string
Definition input_item.h:49
std::function< void(const Input_Item &, const Parameter &)> check_value
check value function
Definition input_item.h:70
Input_Item(const std::string &label_in)
Definition input_item.h:17
std::string description
full description (supports multi-line, lists, notes)
Definition input_item.h:48
std::vector< std::string > str_values
string values of the input item
Definition input_item.h:42
Input_Item()
Definition input_item.h:15
std::stringstream final_value
final value for writing to output INPUT file
Definition input_item.h:43
std::string unit
unit of measurement (empty if none)
Definition input_item.h:50
std::string category
category for grouping (e.g., "System variables")
Definition input_item.h:46
std::string type
data type ("Integer", "Real", "String", "Boolean")
Definition input_item.h:47
Input_Item(const Input_Item &item)
Definition input_item.h:22
std::string label
label of the input item
Definition input_item.h:41
std::string availability
availability conditions (empty if always)
Definition input_item.h:51
size_t get_size() const
< get size of the input item
Definition input_item.h:58
bool is_read() const
< check if the input item is read
Definition input_item.h:53
std::function< void(const Input_Item &, Parameter &)> reset_value
Definition input_item.h:73
std::function< void(Input_Item &, const Parameter &)> get_final_value
get final_value function for output INPUT file
Definition input_item.h:75
std::string annotation
brief annotation (kept for backward compatibility)
Definition input_item.h:63
Definition parameter.h:13
Parameter param
Definition io_system_variable_test.cpp:38
Definition input_help.cpp:10