void merge_from(local_disk &other) { BOOST_ASSERT(num_partitions_ == other.num_partitions_); for (unsigned partition=0; partition<num_partitions_; ++partition) { intermediates_t::iterator ito = other.intermediate_files_.find(partition); BOOST_ASSERT(ito != other.intermediate_files_.end()); intermediates_t::iterator it = intermediate_files_.find(partition); if (it == intermediate_files_.end()) { intermediate_files_.insert( make_pair( partition, std::make_pair( ito->second.first, boost::shared_ptr<std::ofstream>(new std::ofstream)))); } else { std::list<std::string> filenames; filenames.push_back(it->second.first); filenames.push_back(ito->second.first); it->second.first = merge_and_sort(filenames); it->second.second->close(); } other.intermediate_files_.erase(partition); } }
void recorder_t::output () { merge_and_sort(); dump_byte(); if (text_mode) dump_text(); }