- in.open(store_file_name.c_str());
- if (in.eof() == false) {
- getline(in, line);
- ret_val = W1Util::parse_data_line(line);
+ o_data = NULL;
+ n_data = NULL;
+ if (store_data != NULL) {
+ row_count = store_data->get_data_row_count();
+ if (row_count > 0) {
+ o_data = store_data->get_data(0);
+ n_data = store_data->get_data(row_count - 1);
+ }
+ }
+ else {
+ if (range_data != NULL) {
+ row_count = range_data->get_data_row_count();
+ if (row_count > 0) {
+ o_data = range_data->get_data(0);
+ n_data = range_data->get_data(row_count - 1);
+ }
+ }
+ else {
+ in.open(store_file_name.c_str());
+ while (in.eof() == false) {
+ getline(in, line);
+ if (line.empty() == false) {
+ if (o_data == NULL) {
+ o_data = W1Util::parse_data_line(line);
+ }
+ prev_line = line;
+ }
+ }
+ if (prev_line.empty() == false) {
+ n_data = W1Util::parse_data_line(prev_line);
+ }
+ }
+ }
+ if ((o_data != NULL) &&
+ (n_data != NULL)) {
+ ret_val = new DataRange(*o_data);
+ ret_val->add_data(*n_data);
+ if (range_data != NULL) {
+ range_data = new DataRange(*o_data);
+ range_data->add_data(*n_data);
+ }
+ }
+ if (o_data != NULL) {
+ delete(o_data);
+ }
+ if (n_data != NULL) {
+ delete(n_data);