Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
The FileSystemProvider handles files in a directory tree. More...
#include <FileSystemProvider.h>
Public Member Functions | |
FileSystemProvider (const std::string &root_path, std::unique_ptr< FileParser > parser) | |
constructor The FileSystemProvider handles files in a directory tree. | |
std::unique_ptr< XYDataset > | getDataset (const QualifiedName &qualified_name) override |
Get a dataset corresponding to an unique qualified name. | |
std::vector< QualifiedName > | listContents (const std::string &group) override |
List all files which belong to a group. | |
std::string | getParameter (const QualifiedName &qualified_name, const std::string &key_word) override |
~FileSystemProvider ()=default | |
![]() | |
virtual | ~XYDatasetProvider ()=default |
Private Attributes | |
std::string | m_root_path |
std::unique_ptr< FileParser > | m_parser |
std::map< QualifiedName, std::string > | m_name_file_map |
std::vector< QualifiedName > | m_order_names |
The FileSystemProvider handles files in a directory tree.
It handles files in a directory tree of the file system. The directory path of the files and the name of the dataset are used for constructing the qualified name to match with the identifier. To support different file formats the work is delegated to the FileParser interface about file related operations (it gets dataset name and data).
Definition at line 57 of file FileSystemProvider.h.
Euclid::XYDataset::FileSystemProvider::FileSystemProvider | ( | const std::string & | root_path, |
std::unique_ptr< FileParser > | parser | ||
) |
constructor The FileSystemProvider handles files in a directory tree.
It fills up a map containing the qualified name and the path of the corresponding file.
root_path | Absolute path to the dataset |
parser | FileParser object |
Elements::Exception | Path to the files not found |
Elements::Exception | Root path not found |
Elements::Exception | Root path is not a directory |
Elements::Exception | Qualified name can not be inserted |
Definition at line 112 of file FileSystemProvider.cpp.
References Euclid::XYDataset::checkEndSlashes(), std::string::empty(), Euclid::XYDataset::getRecursiveDirectoryContents(), std::string::insert(), std::string::length(), m_name_file_map, m_order_names, m_parser, m_root_path, std::string::string(), and std::string::substr().
|
default |
|
overridevirtual |
Get a dataset corresponding to an unique qualified name.
qualified_name | Dataset qualified name |
Implements Euclid::XYDataset::XYDatasetProvider.
Definition at line 199 of file FileSystemProvider.cpp.
References m_name_file_map, and m_parser.
|
overridevirtual |
Implements Euclid::XYDataset::XYDatasetProvider.
Definition at line 205 of file FileSystemProvider.cpp.
References std::string::find(), m_name_file_map, and m_parser.
|
overridevirtual |
List all files which belong to a group.
Fill up a vector with qualified name from the map created at the constructor level. In the vector, only qualified name where path contains the group name at the first position is inserted. let's take the following example. if you have a group sets to "A/B/C" and under the "C" repository there is the following structure : C/file1 C/file2 C/D/file3 etc... then the vector of strings returned will contain the following elements: vector[0] = "A/B/C/file1" vector[1] = "A/B/C/file2" vector[3] = "A/B/C/D/file3" etc... Note: The empty string for the group means the root group
group | It is a string which represents a group: e.g. "filter/MER" for getting all MER filters. |
Implements Euclid::XYDataset::XYDatasetProvider.
Definition at line 165 of file FileSystemProvider.cpp.
References std::string::back(), std::string::empty(), std::string::find_first_not_of(), m_order_names, std::string::pop_back(), std::vector< T >::push_back(), std::string::push_back(), and std::string::substr().
|
private |
Definition at line 125 of file FileSystemProvider.h.
Referenced by FileSystemProvider(), getDataset(), and getParameter().
|
private |
Definition at line 126 of file FileSystemProvider.h.
Referenced by FileSystemProvider(), and listContents().
|
private |
Definition at line 124 of file FileSystemProvider.h.
Referenced by FileSystemProvider(), getDataset(), and getParameter().
|
private |
Definition at line 123 of file FileSystemProvider.h.
Referenced by FileSystemProvider().