JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
FileNameRepo.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 29/12/17.
3 //
4 
5 #ifndef JODA_FILENAMEREPO_H
6 #define JODA_FILENAMEREPO_H
7 #include <mutex>
8 #include <string>
9 #include <unordered_map>
10 #include <unordered_set>
11 #include <vector>
12 typedef unsigned long FILEID;
17 class FileNameRepo {
18  public:
26  };
27 
34  FILEID addFile(const std::string& file);
35 
45  std::string getFile(FILEID id);
46 
56  std::vector<std::string> getFiles(const std::unordered_set<FILEID>& ids);
57 
64  static constexpr bool validFile(FILEID id) {
65  return id >= ValidFileNameStart;
66  }
67 
68  protected:
69  std::mutex mut;
70  FILEID getNextID();
71  std::unordered_map<FILEID, std::string> id_file;
72  std::unordered_map<std::string, FILEID> file_id;
74 };
75 
77 
78 #endif // JODA_FILENAMEREPO_H
FileNameRepo g_FileNameRepoInstance
Definition: FileNameRepo.cpp:8
unsigned long FILEID
Definition: FileNameRepo.h:12
Definition: FileNameRepo.h:17
std::unordered_map< std::string, FILEID > file_id
Definition: FileNameRepo.h:72
FILEID currID
Definition: FileNameRepo.h:73
std::mutex mut
Definition: FileNameRepo.h:69
std::string getFile(FILEID id)
Definition: FileNameRepo.cpp:22
ConstFileNames
Definition: FileNameRepo.h:22
@ ValidFileNameStart
Definition: FileNameRepo.h:25
@ ProjectionFileName
Definition: FileNameRepo.h:24
@ TMPObjectName
Definition: FileNameRepo.h:23
FILEID getNextID()
Definition: FileNameRepo.cpp:10
std::unordered_map< FILEID, std::string > id_file
Definition: FileNameRepo.h:71
std::vector< std::string > getFiles(const std::unordered_set< FILEID > &ids)
Definition: FileNameRepo.cpp:38
FILEID addFile(const std::string &file)
Definition: FileNameRepo.cpp:11
static constexpr bool validFile(FILEID id)
Definition: FileNameRepo.h:64