JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
FileNameRepo Class Reference

#include <FileNameRepo.h>

Collaboration diagram for FileNameRepo:
[legend]

Public Types

enum  ConstFileNames { TMPObjectName = 0 , ProjectionFileName = 1 , ValidFileNameStart = 2 }
 

Public Member Functions

FILEID addFile (const std::string &file)
 
std::string getFile (FILEID id)
 
std::vector< std::string > getFiles (const std::unordered_set< FILEID > &ids)
 

Static Public Member Functions

static constexpr bool validFile (FILEID id)
 

Protected Member Functions

FILEID getNextID ()
 

Protected Attributes

std::mutex mut
 
std::unordered_map< FILEID, std::string > id_file
 
std::unordered_map< std::string, FILEIDfile_id
 
FILEID currID = 1
 

Detailed Description

The FileNameRepo class is used as a central mapping between string filenames and unique numerical ids for efficient filename storage.

Member Enumeration Documentation

◆ ConstFileNames

The ConstFileNames are reserved file ids for internal usage.

Enumerator
TMPObjectName 
ProjectionFileName 
ValidFileNameStart 

Member Function Documentation

◆ addFile()

FILEID FileNameRepo::addFile ( const std::string &  file)

Adds a (new) file to he file->ID mappings. If the file was already mapped, the same id is returned as previously.

Parameters
fileThe path to the file
Returns
the mapped file ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFile()

std::string FileNameRepo::getFile ( FILEID  id)

Retrieves a file path previously mapped to an ID.

If a reserved id is given, a string representation of this reserved keyword is returned. If the id does not exist an emtpy string is returned.

Parameters
idThe id to translate into a file path
Returns
the translated file path
Here is the caller graph for this function:

◆ getFiles()

std::vector< std::string > FileNameRepo::getFiles ( const std::unordered_set< FILEID > &  ids)

Retrieves multiple file paths previously mapped to IDs.

If a reserved id is given, a string representation of this reserved keyword is returned. If the id does not exist an emtpy string is returned.

Parameters
idsThe ids to translate into a file path
Returns
the translated file paths

◆ getNextID()

FILEID FileNameRepo::getNextID ( )
protected
Here is the caller graph for this function:

◆ validFile()

static constexpr bool FileNameRepo::validFile ( FILEID  id)
inlinestaticconstexpr

Checks if the given id is in a valid range.

Parameters
idThe id to check
Returns
True if the id should point to a file.
Here is the caller graph for this function:

Field Documentation

◆ currID

FILEID FileNameRepo::currID = 1
protected

◆ file_id

std::unordered_map<std::string, FILEID> FileNameRepo::file_id
protected

◆ id_file

std::unordered_map<FILEID, std::string> FileNameRepo::id_file
protected

◆ mut

std::mutex FileNameRepo::mut
protected

The documentation for this class was generated from the following files: