Esempio n. 1
0
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
                            long *Epoch) {
  long E = Epoch ? *Epoch : 0;
  for (auto &X : ListFilesInDir(Path, Epoch)) {
    auto FilePath = DirPlusFile(Path, X);
    if (Epoch && GetEpoch(FilePath) < E) continue;
    V->push_back(FileToVector(FilePath));
  }
}
Esempio n. 2
0
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
                            long *Epoch) {
  long E = Epoch ? *Epoch : 0;
  auto Files = ListFilesInDir(Path, Epoch);
  for (size_t i = 0; i < Files.size(); i++) {
    auto &X = Files[i];
    auto FilePath = DirPlusFile(Path, X);
    if (Epoch && GetEpoch(FilePath) < E) continue;
    if ((i % 1000) == 0 && i)
      Printf("Loaded %zd/%zd files from %s\n", i, Files.size(), Path);
    V->push_back(FileToVector(FilePath));
  }
}
Esempio n. 3
0
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
                            long *Epoch, size_t MaxSize) {
  long E = Epoch ? *Epoch : 0;
  auto Files = ListFilesInDir(Path, Epoch);
  size_t NumLoaded = 0;
  for (size_t i = 0; i < Files.size(); i++) {
    auto &X = Files[i];
    auto FilePath = DirPlusFile(Path, X);
    if (Epoch && GetEpoch(FilePath) < E) continue;
    NumLoaded++;
    if ((NumLoaded & (NumLoaded - 1)) == 0 && NumLoaded >= 1024)
      Printf("Loaded %zd/%zd files from %s\n", NumLoaded, Files.size(), Path);
    V->push_back(FileToVector(FilePath, MaxSize));
  }
}
Esempio n. 4
0
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V) {
  for (auto &X : ListFilesInDir(Path))
    V->push_back(FileToVector(DirPlusFile(Path, X)));
}