8 #include <fmt/format.h>
15 std::unique_ptr<KeywordRuleProcessor> keyword_rules)
16 : m_initial(initial), m_processor(std::move(keyword_rules)) {
23 : m_path(std::move(path)), m_fits(nullptr, fits::
DefaultClose) {
24 auto entry = std::filesystem::directory_entry(m_path);
25 if (!entry.exists()) {
29 throw std::invalid_argument(
30 fmt::format(
"source path must be a regular file: '{}'", m_path.c_str()));
35 : m_path(std::move(path)), m_fits(std::move(file)) {
41 : std::invalid_argument(fmt::format(
"source path not found: '{}' ", path).c_str()) {
45 std::filesystem::path path,
46 std::optional<KeywordRuleProcessor::DefaultRule>
const& initial,
47 std::unique_ptr<KeywordRuleProcessor> keyword_rules)
48 : base::
Source(std::move(name))
49 , base::FitsFile(std::move(path), fits::
OpenMode::ReadWrite)
50 , base::
KeywordRules(initial, std::move(keyword_rules)) {
54 std::filesystem::path path,
55 std::optional<KeywordRuleProcessor::DefaultRule>
const& initial,
56 std::unique_ptr<KeywordRuleProcessor> keyword_rules,
58 : base::
Source(std::move(name))
59 , base::FitsFile(std::move(path), std::move(file))
60 , base::
KeywordRules(initial, std::move(keyword_rules)) {
64 std::filesystem::path path,
66 std::optional<KeywordRuleProcessor::DefaultRule>
const& initial,
67 std::unique_ptr<KeywordRuleProcessor> keyword_rules)
68 : base::
Source(std::move(name))
69 , base::FitsFile(std::move(path), fits::
OpenMode::ReadOnly)
71 , m_location(std::move(location)) {
77 std::optional<KeywordRuleProcessor::DefaultRule>
const& initial,
78 std::unique_ptr<KeywordRuleProcessor> keyword_rules) noexcept
81 , m_keywords(std::move(keywords)) {
FitsFileSource(std::string name, std::filesystem::path path, std::string location, std::optional< KeywordRuleProcessor::DefaultRule > const &initial_keywords, std::unique_ptr< KeywordRuleProcessor > keyword_rules)
FitsKeywordsSource(std::string name, fits::KeywordVector keywords, std::optional< KeywordRuleProcessor::DefaultRule > const &initial_keywords, std::unique_ptr< KeywordRuleProcessor > keyword_rules) noexcept
TargetSource(std::string name, std::filesystem::path path, std::optional< KeywordRuleProcessor::DefaultRule > const &initial_keywords, std::unique_ptr< KeywordRuleProcessor > keyword_rules)
FitsFile(std::filesystem::path path, fits::OpenMode mode)
Open existing fits file.
KeywordRules(std::optional< KeywordRuleProcessor::DefaultRule > const &initial, std::unique_ptr< KeywordRuleProcessor > keyword_rules)
Source(std::string name) noexcept
UniqueFitsFile Open(char const *filename, OpenMode mode)
Open file.
std::unique_ptr< fitsfile, void(*)(fitsfile *) noexcept > UniqueFitsFile
Defines unique ownership type to cfitsio fitsfile.
void DefaultClose(fitsfile *ptr) noexcept
Default close function that is used by UniqueFitsFile as a deleter.
std::vector< KeywordVariant > KeywordVector
Vector of keywords.
std::vector< KeywordRuleTypes > KeywordRules
Simple class that holds the source and associated state.
SourceNotFoundError(char const *path)