| 61 | } |
| 62 | |
| 63 | virtual void writeToFile(const std::string& file) { |
| 64 | if (!dirExists(getPath(file))) { |
| 65 | createDir(getPath(file)); |
| 66 | } |
| 67 | std::ofstream out(file); CHECK(out.good()); |
| 68 | V v; |
| 69 | for (auto& e : data_) { |
| 70 | e.second.put(&v, &state_); |
| 71 | if (v != 0) out << e.first << "\t" << v << std::endl; |
| 72 | } |
| 73 | } |
| 74 | // TODO fault tolerance |
| 75 | void setReplica(const MessagePtr& msg) { } |
| 76 | void getReplica(const MessagePtr& msg) { } |