MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / readStream

Function readStream

lib/external/kryoflux.cc:26–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26std::unique_ptr<Fluxmap> readStream(
27 std::string dir, unsigned track, unsigned side)
28{
29 std::string suffix = fmt::format("{:02}.{}.raw", track, side);
30
31 DIR* dirp = opendir(dir.c_str());
32 if (!dirp)
33 error("cannot access path '{}'", dir);
34
35 std::string filename;
36 for (;;)
37 {
38 struct dirent* de = readdir(dirp);
39 if (!de)
40 break;
41
42 if (has_suffix(de->d_name, suffix))
43 {
44 if (!filename.empty())
45 error("data is ambiguous --- multiple files end in {}", suffix);
46 filename = fmt::format("{}/{}", dir, de->d_name);
47 }
48 }
49 closedir(dirp);
50
51 if (filename.empty())
52 error("failed to find track {} side {} in {}", track, side, dir);
53
54 return readStream(filename);
55}
56
57std::unique_ptr<Fluxmap> readStream(const std::string& filename)
58{

Callers 2

readSingleFluxMethod · 0.85
test_convertFunction · 0.85

Calls 12

errorFunction · 0.85
has_suffixFunction · 0.85
read_8Method · 0.80
read_le16Method · 0.80
read_le32Method · 0.80
read_be16Method · 0.80
emptyMethod · 0.45
seekMethod · 0.45
eofMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by 1

test_convertFunction · 0.68