ifw-daq
2.1.0-pre1
IFW Data Acquisition modules
|
Go to the documentation of this file.
10 #ifndef DAQ_DPM_SOURCERESOLVER_HPP
11 #define DAQ_DPM_SOURCERESOLVER_HPP
16 #include <nlohmann/json.hpp>
21 using std::invalid_argument::invalid_argument;
40 return lhs.source_name == rhs.source_name && lhs.origin == rhs.origin;
43 return lhs.source_name < rhs.source_name ||
44 (lhs.source_name == rhs.source_name && lhs.origin < rhs.origin);
48 using Mapping = std::map<SourceFile, std::string>;
63 std::filesystem::path
const& path);
74 -> std::filesystem::path;
92 #endif // DAQ_DPM_SOURCERESOLVER_HPP
void from_json(nlohmann::json const &j, SourceResolver::Mapping &p)
friend bool operator==(SourceFile const &lhs, SourceFile const &rhs) noexcept
auto GetMapping() const noexcept -> Mapping const &
Get native representation of source mapping for serialization.
std::map< SourceFile, std::string > Mapping
std::string source_name
Named by user.
void to_json(nlohmann::json &j, SourceResolver::Mapping const &p)
auto Resolve(SourceFile const &source) const -> std::filesystem::path
Resolves local file that was previously added with Add().
friend bool operator<(SourceFile const &lhs, SourceFile const &rhs) noexcept
void Add(SourceFile const &source, std::filesystem::path const &path)
Adds path so it is resolved using source_name and @origin .
std::string origin
[user@]host:/path/
Provides location of fits source file.
friend std::ostream & operator<<(std::ostream &os, SourceFile const &source)
SourceResolver()=default
Initialize resolver with no content.
void SetMapping(Mapping mapping) noexcept