1+ // =======================
2+ // AUTHOR : Peize Lin
3+ // DATE : 2021-12-13
4+ // =======================
5+
6+ #ifndef READ_TXT_INPUT_ITEM_H
7+ #define READ_TXT_INPUT_ITEM_H
8+
9+ #include " read_txt_input_value.h"
10+
11+ #include < vector>
12+ #include < map>
13+ #include < string>
14+ #include < functional>
15+
16+ #ifdef USE_CEREAL_SERIALIZATION
17+ #include < cereal/access.hpp>
18+ #endif
19+
20+ namespace Read_Txt_Input
21+ {
22+ class Input_Item
23+ {
24+ public:
25+ // call these functions
26+ Input_Item (const std::string &label_in) :label(label_in) {}
27+ template <typename T>
28+ void default_1 (const T &value);
29+ template <typename T_head, typename ... T_tail>
30+ void default_1 ( const T_head &value_head, const T_tail... values_tail);
31+
32+ // set these variables and functions
33+ std::string annotation;
34+ std::function<void (Input_Item&)> check_transform
35+ = [](Input_Item&self){};
36+ std::function<void (const std::map<std::string, Input_Item>&)> default2
37+ = [](const std::map<std::string, Input_Item>&list){};
38+ std::function<void (const Input_Item&)> convert
39+ = [](const Input_Item&item){};
40+
41+ std::vector<Input_Value> values;
42+
43+ private:
44+ std::string label;
45+ // int value_read_size = -1;
46+
47+ friend class Input_List ;
48+ friend class Input_Process ;
49+
50+ template <typename T>
51+ void set_value (const T &value);
52+
53+ #ifdef USE_CEREAL_SERIALIZATION
54+ public:
55+ Input_Item () = default;
56+ private:
57+ friend class cereal ::access;
58+ template <class Archive > void serialize ( Archive & ar );
59+ #endif
60+ };
61+ }
62+
63+ #include " read_txt_input_item-template.h"
64+
65+ #endif
0 commit comments