From 023bc660915ac8da1a6586da7ad91373924a54e3 Mon Sep 17 00:00:00 2001 From: linpz Date: Thu, 6 Jan 2022 11:07:54 +0800 Subject: [PATCH] 1. add src_io/read_txt_input_item.cpp --- source/Makefile.Objects | 1 + source/src_io/CMakeLists.txt | 1 + source/src_io/read_txt_input_item-template.h | 40 ---------------- source/src_io/read_txt_input_item.cpp | 49 ++++++++++++++++++++ 4 files changed, 51 insertions(+), 40 deletions(-) create mode 100644 source/src_io/read_txt_input_item.cpp diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 262e632a4c..44de612206 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -248,6 +248,7 @@ read_dm.o\ read_txt_tools.o\ read_txt_stru.o\ read_txt_input_value.o\ +read_txt_input_item.o\ read_txt_input_list.o\ read_txt_input_process.o\ read_txt_input_process_global.o\ diff --git a/source/src_io/CMakeLists.txt b/source/src_io/CMakeLists.txt index a63da49ddf..afbcb4eb85 100644 --- a/source/src_io/CMakeLists.txt +++ b/source/src_io/CMakeLists.txt @@ -25,6 +25,7 @@ add_library( read_rho.cpp read_txt_tools.cpp read_txt_input_value.cpp + read_txt_input_item.cpp read_txt_input_list.cpp read_txt_input_process.cpp read_txt_input_process_global.cpp diff --git a/source/src_io/read_txt_input_item-template.h b/source/src_io/read_txt_input_item-template.h index fd22f6dc30..3a6b5226e4 100644 --- a/source/src_io/read_txt_input_item-template.h +++ b/source/src_io/read_txt_input_item-template.h @@ -26,46 +26,6 @@ namespace Read_Txt_Input ++this->values_size_lower_limit; ++this->values_size_upper_limit; } - - template<> - void Input_Item::set_value(const bool &b) - { - this->values.push_back({}); - this->values.back().setb(b); - this->values_type.push_back("b"); - } - - template<> - void Input_Item::set_value(const int &i) - { - this->values.push_back({}); - this->values.back().seti(i); - this->values_type.push_back("i"); - } - - template<> - void Input_Item::set_value(const double &d) - { - this->values.push_back({}); - this->values.back().setd(d); - this->values_type.push_back("d"); - } - - template<> - void Input_Item::set_value(const std::string &s) - { - this->values.push_back({}); - this->values.back().sets(s); - this->values_type.push_back("s"); - } - - template<> - void Input_Item::set_value(const char*const &s) - { - this->values.push_back({}); - this->values.back().sets(std::string(s)); - this->values_type.push_back("s"); - } } #endif \ No newline at end of file diff --git a/source/src_io/read_txt_input_item.cpp b/source/src_io/read_txt_input_item.cpp new file mode 100644 index 0000000000..ebdd0b79c9 --- /dev/null +++ b/source/src_io/read_txt_input_item.cpp @@ -0,0 +1,49 @@ +//======================= +// AUTHOR : Peize Lin +// DATE : 2021-12-13 +//======================= + +#include "read_txt_input_item.h" + +namespace Read_Txt_Input +{ + template<> + void Input_Item::set_value(const bool &b) + { + this->values.push_back({}); + this->values.back().setb(b); + this->values_type.push_back("b"); + } + + template<> + void Input_Item::set_value(const int &i) + { + this->values.push_back({}); + this->values.back().seti(i); + this->values_type.push_back("i"); + } + + template<> + void Input_Item::set_value(const double &d) + { + this->values.push_back({}); + this->values.back().setd(d); + this->values_type.push_back("d"); + } + + template<> + void Input_Item::set_value(const std::string &s) + { + this->values.push_back({}); + this->values.back().sets(s); + this->values_type.push_back("s"); + } + + template<> + void Input_Item::set_value(const char*const &s) + { + this->values.push_back({}); + this->values.back().sets(std::string(s)); + this->values_type.push_back("s"); + } +} \ No newline at end of file