@@ -79,29 +79,37 @@ namespace Read_Txt_Input
7979 void Input_Process::out (const std::string &file_name) const
8080 {
8181 std::ofstream ofs (file_name);
82- for (const std::string &label : input.add_order )
82+ for (const std::string &label : input.output_labels )
8383 {
84- ofs<<label<<" \t " ;
85- const Read_Txt_Input::Input_Item &item = input.list .at (label);
86- for (size_t i=0 ; i<item.values .size (); ++i)
84+ const auto ptr = input.list .find (label);
85+ if (ptr==input.list .end ())
86+ {
87+ ofs<<std::endl<<" # " <<label<<std::endl;
88+ }
89+ else
8790 {
88- if (item.values_type [i]==" s" )
89- ofs<<item.values [i].gets ()<<" " ;
90- else if (item.values_type [i]==" d" )
91- ofs<<std::to_string (item.values [i].getd ())<<" " ;
92- else if (item.values_type [i]==" i" )
93- ofs<<std::to_string (item.values [i].geti ())<<" " ;
94- else if (item.values_type [i]==" b" )
91+ ofs<<label<<" \t " ;
92+ const Read_Txt_Input::Input_Item &item = ptr->second ;
93+ for (size_t i=0 ; i<item.values .size (); ++i)
9594 {
96- if (item.values [i].getb ())
97- ofs<<" true" <<" " ;
95+ if (item.values_type [i]==" s" )
96+ ofs<<item.values [i].gets ()<<" " ;
97+ else if (item.values_type [i]==" d" )
98+ ofs<<std::to_string (item.values [i].getd ())<<" " ;
99+ else if (item.values_type [i]==" i" )
100+ ofs<<std::to_string (item.values [i].geti ())<<" " ;
101+ else if (item.values_type [i]==" b" )
102+ {
103+ if (item.values [i].getb ())
104+ ofs<<" true" <<" " ;
105+ else
106+ ofs<<" false" <<" " ;
107+ }
98108 else
99- ofs<< " false " << " " ;
109+ throw invalid_argument ( " Input_Process::out() value_type[ " + std::to_string (i)+ " ]= " +item. values_type [i]) ;
100110 }
101- else
102- throw invalid_argument (" Input_Process::out() value_type[" +std::to_string (i)+" ]=" +item.values_type [i]);
111+ ofs<<" \t # " <<item.annotation <<std::endl;
103112 }
104- ofs<<" \t # " <<item.annotation <<std::endl;
105113 }
106114 }
107115
0 commit comments