-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileLoader.h
More file actions
25 lines (23 loc) · 1.01 KB
/
Copy pathFileLoader.h
File metadata and controls
25 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include "Graph.h"
#include <string>
// -----------------------------------------------------------------------------
// FileLoader - reads / writes the .txt network description format
//
// map.txt grammar
// ---------------
// Lines starting with '#' are comments and are ignored.
//
// BASES <n> - declares n bases; next n non-comment lines are names
// DIRECTED <0|1> - 0 = undirected (default), 1 = directed
// EDGES - following non-comment lines are edges:
// <from_id> <to_id> <weight> [<risk 0-10>]
// (risk is optional; omitted edges default to risk 0)
// -----------------------------------------------------------------------------
class FileLoader {
public:
// Returns true on success; g is populated in-place.
static bool load(const std::string& filename, Graph& g);
// Serialise g back to the same format (useful for saving user edits).
static bool save(const std::string& filename, const Graph& g);
};