Program Listing for File options.hpp¶
↰ Return to documentation for file (SeQuant/core/options.hpp)
//
// Created by Eduard Valeyev on 8/25/25.
//
#ifndef SEQUANT_CORE_OPTIONS_HPP
#define SEQUANT_CORE_OPTIONS_HPP
#include <SeQuant/core/index.hpp>
#include <SeQuant/core/utility/aggregate.hpp>
#include <optional>
#include <string>
#include <vector>
namespace sequant {
enum class CanonicalizationMethod {
Topological = 0b01,
Lexicographic = 0b10,
Complete = Topological | Lexicographic,
Rapid = Lexicographic
};
CanonicalizationMethod operator&(CanonicalizationMethod m1,
CanonicalizationMethod m2);
CanonicalizationMethod operator|(CanonicalizationMethod m1,
CanonicalizationMethod m2);
std::wstring to_wstring(CanonicalizationMethod m);
struct CanonicalizeOptions {
SEQUANT_DESIGNATED_INIT_ONLY;
enum class IgnoreNamedIndexLabel : bool { Yes = true, No = false };
CanonicalizationMethod method = CanonicalizationMethod::Complete;
std::optional<container::set<Index>> named_indices = std::nullopt;
IgnoreNamedIndexLabel ignore_named_index_labels = IgnoreNamedIndexLabel::Yes;
static CanonicalizeOptions default_options();
CanonicalizeOptions copy_and_set(CanonicalizationMethod) const;
CanonicalizeOptions copy_and_set(std::optional<container::set<Index>>) const;
CanonicalizeOptions copy_and_set(IgnoreNamedIndexLabel) const;
friend bool operator==(const CanonicalizeOptions& a,
const CanonicalizeOptions& b) {
// the bindings name every member (guard is the SEQUANT_DESIGNATED_INIT_ONLY
// tag), so that a member added to CanonicalizeOptions fails to compile here
// until it is compared
const auto& [guard_a, method_a, named_indices_a, ignore_labels_a] = a;
const auto& [guard_b, method_b, named_indices_b, ignore_labels_b] = b;
(void)guard_a;
(void)guard_b;
return method_a == method_b && named_indices_a == named_indices_b &&
ignore_labels_a == ignore_labels_b;
}
};
} // namespace sequant
#endif // SEQUANT_CORE_OPTIONS_HPP