| 364 | } |
| 365 | |
| 366 | GraphFile::GraphHeader read_graph_header(std::istream& in) { |
| 367 | GraphFile::GraphHeader header; |
| 368 | header.magic = read_u32(in); |
| 369 | header.version = read_u32(in); |
| 370 | header.node_count = read_u32(in); |
| 371 | header.flags = read_u32(in); |
| 372 | |
| 373 | if (header.magic != CACTUS_GRAPH_MAGIC) { |
| 374 | throw std::runtime_error("Invalid graph file: bad magic"); |
| 375 | } |
| 376 | if (header.version != 1) { |
| 377 | throw std::runtime_error("Unsupported graph file version: " + |
| 378 | std::to_string(header.version)); |
| 379 | } |
| 380 | |
| 381 | return header; |
| 382 | } |
| 383 | |
| 384 | GraphFile::NodeEntry read_node_entry(std::istream& in) { |
| 385 | GraphFile::NodeEntry node; |
no test coverage detected