MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / read_metadata

Method read_metadata

libCacheSim/dataStructure/sparsepp/spp.h:2370–2388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2368 // Reading destroys the old table contents! Returns true if read ok.
2369 template <typename INPUT>
2370 bool read_metadata(INPUT *fp)
2371 {
2372 size_type magic_read = 0;
2373 if (!read_32_or_64(fp, &magic_read)) return false;
2374 if (magic_read != MAGIC_NUMBER)
2375 {
2376 clear(); // just to be consistent
2377 return false;
2378 }
2379
2380 if (!read_32_or_64(fp, &_table_size)) return false;
2381 if (!read_32_or_64(fp, &_num_buckets)) return false;
2382
2383 resize(_table_size); // so the vector's sized ok
2384 for (group_type *group = _first_group; group != _last_group; ++group)
2385 if (group->read_metadata(_alloc, fp) == false)
2386 return false;
2387 return true;
2388 }
2389
2390 // This code is identical to that for SparseGroup
2391 // If your keys and values are simple enough, we can write them

Callers

nothing calls this directly

Calls 1

read_metadataMethod · 0.45

Tested by

no test coverage detected