bool EagleeyeIO::read(DynamicArray<T>& arr,std::string& id,std::string file_path,EagleeyeIOMode iomode) { switch(iomode) { case READ_BINARY_MODE: { std::ifstream binary_file(file_path.c_str(),std::ios::binary); if (!binary_file) { return false; } else { //write id int str_len; binary_file.read((char*)(&str_len),sizeof(int)); char* id_data=new char[str_len]; binary_file.read(id_data,sizeof(char)*str_len); id=std::string(id_data); delete[] id_data; //write array data int arr_size=arr.size(); binary_file.read((char*)(&arr_size),sizeof(int)); arr=DynamicArray(arr_size); binary_file.read((char*)(arr.dataptr()),sizeof(T)*arr_size); binary_file.close(); return true; } } case READ_ASCII_MODE: { std::locale::global( std::locale( "",std::locale::all^std::locale::numeric ) ); std::ifstream ascii_file(file_path.c_str()); file_path>>id; file_path>>arr; ascii_file.close(); return false; } default: { return false; } } return false; }
DynamicArray Object::__EnumParams() { return DynamicArray(); }