-std::map<std::string, sg_size_t>* StorageImpl::parseContent(std::string filename)
-{
- usedSize_ = 0;
- if (filename.empty())
- return nullptr;
-
- std::map<std::string, sg_size_t>* parse_content = new std::map<std::string, sg_size_t>();
-
- std::ifstream* fs = surf_ifsopen(filename.c_str());
-
- std::string line;
- std::vector<std::string> tokens;
- do {
- std::getline(*fs, line);
- boost::trim(line);
- if (line.length() > 0) {
- boost::split(tokens, line, boost::is_any_of(" \t"), boost::token_compress_on);
- xbt_assert(tokens.size() == 2, "Parse error in %s: %s", filename.c_str(), line.c_str());
- sg_size_t size = std::stoull(tokens.at(1));
-
- usedSize_ += size;
- parse_content->insert({tokens.front(), size});
- }
- } while (not fs->eof());
- delete fs;
- return parse_content;
-}