ifw-daq
2.1.0-pre1
IFW Data Acquisition modules
|
Go to the documentation of this file.
12 #include <fmt/format.h>
13 #include <fmt/ostream.h>
18 os <<
"source name: \"" << source.
source_name <<
"\", origin: \"" << source.
origin <<
'"';
26 std::filesystem::path
const& path) {
27 m_mapping[source] = path.native();
31 -> std::filesystem::path {
32 auto it = m_mapping.find(source);
33 if (it == m_mapping.end()) {
35 fmt::format(
"Could not resolve local filename for source: '{}' and origin: '{}'",
39 return std::filesystem::path(it->second);
47 m_mapping.swap(mapping);
54 j = nlohmann::json::array();
55 for (
auto const& s : p) {
57 {
"sourceName", s.first.source_name},
58 {
"origin", s.first.origin},
59 {
"localPath", s.second}});
65 for (
auto const& s : j) {
Declares daq::dpm::SourceResolver.
void from_json(nlohmann::json const &j, SourceResolver::Mapping &p)
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().
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/
SourceResolver()=default
Initialize resolver with no content.
std::ostream & operator<<(std::ostream &os, DaqController const &daq)
void SetMapping(Mapping mapping) noexcept