ABACUS
develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
source
source_io
module_parameter
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
9
#include "
source_io/module_parameter/parameter.h
"
10
namespace
ModuleIO
11
{
12
class
Input_Item
13
{
14
public
:
15
Input_Item
(){};
16
17
Input_Item
(
const
std::string& label_in)
18
{
19
label
= label_in;
20
}
21
22
Input_Item
(
const
Input_Item
& item)
23
{
24
label
= item.
label
;
25
str_values
= item.
str_values
;
26
final_value
.str(item.
final_value
.str());
27
// Documentation fields
28
category
= item.
category
;
29
type
= item.
type
;
30
description
= item.
description
;
31
default_value
= item.
default_value
;
32
unit
= item.
unit
;
33
availability
= item.
availability
;
34
annotation
= item.
annotation
;
35
read_value
= item.
read_value
;
36
check_value
= item.
check_value
;
37
reset_value
= item.
reset_value
;
38
get_final_value
= item.
get_final_value
;
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
ModuleIO::Input_Item
Definition
input_item.h:13
ModuleIO::Input_Item::read_value
std::function< void(const Input_Item &, Parameter &)> read_value
read value function
Definition
input_item.h:68
ModuleIO::Input_Item::default_value
std::string default_value
default value as string
Definition
input_item.h:49
ModuleIO::Input_Item::check_value
std::function< void(const Input_Item &, const Parameter &)> check_value
check value function
Definition
input_item.h:70
ModuleIO::Input_Item::Input_Item
Input_Item(const std::string &label_in)
Definition
input_item.h:17
ModuleIO::Input_Item::description
std::string description
full description (supports multi-line, lists, notes)
Definition
input_item.h:48
ModuleIO::Input_Item::str_values
std::vector< std::string > str_values
string values of the input item
Definition
input_item.h:42
ModuleIO::Input_Item::Input_Item
Input_Item()
Definition
input_item.h:15
ModuleIO::Input_Item::final_value
std::stringstream final_value
final value for writing to output INPUT file
Definition
input_item.h:43
ModuleIO::Input_Item::unit
std::string unit
unit of measurement (empty if none)
Definition
input_item.h:50
ModuleIO::Input_Item::category
std::string category
category for grouping (e.g., "System variables")
Definition
input_item.h:46
ModuleIO::Input_Item::type
std::string type
data type ("Integer", "Real", "String", "Boolean")
Definition
input_item.h:47
ModuleIO::Input_Item::Input_Item
Input_Item(const Input_Item &item)
Definition
input_item.h:22
ModuleIO::Input_Item::label
std::string label
label of the input item
Definition
input_item.h:41
ModuleIO::Input_Item::availability
std::string availability
availability conditions (empty if always)
Definition
input_item.h:51
ModuleIO::Input_Item::get_size
size_t get_size() const
< get size of the input item
Definition
input_item.h:58
ModuleIO::Input_Item::is_read
bool is_read() const
< check if the input item is read
Definition
input_item.h:53
ModuleIO::Input_Item::reset_value
std::function< void(const Input_Item &, Parameter &)> reset_value
Definition
input_item.h:73
ModuleIO::Input_Item::get_final_value
std::function< void(Input_Item &, const Parameter &)> get_final_value
get final_value function for output INPUT file
Definition
input_item.h:75
ModuleIO::Input_Item::annotation
std::string annotation
brief annotation (kept for backward compatibility)
Definition
input_item.h:63
Parameter
Definition
parameter.h:13
param
Parameter param
Definition
io_system_variable_test.cpp:38
ModuleIO
Definition
input_help.cpp:10
parameter.h
Generated by
1.9.8