Program Listing for File YieldCommons.hpp

↰ Return to documentation for file (src/yields/YieldCommons.hpp)

#ifndef YIELDCOMMONS_HPP
#define YIELDCOMMONS_HPP

#include <array>
#include <cstddef>
#include <filesystem>
#include <optional>
#include <string>
#include <string_view>

namespace yields
{
    enum class Channel
    {
        // NOLINTBEGIN(readability-identifier-naming) -- trailing underscore on each enumerator matches this project's own member-variable convention, used here (rather than plain camelBack, this project's actual style for enum constants -- see elem::Symbols's own identical, deliberate deviation) at the user's own explicit request
        ccsn_,
        massiveStarWinds_,
        agb_,
        nChannel_
        // NOLINTEND(readability-identifier-naming)
    };

    constexpr std::array<std::string_view,
        static_cast<std::size_t>(Channel::nChannel_)> channelStr{
        "ccsn",
        "massive_star_winds",
        "agb"
    };

    constexpr double defaultMinIsotopeLifetime = 1.0e4;
    inline static const std::string defaultRegistry = // NOLINT(bugprone-throwing-static-initialization,cert-err58-cpp) -- built from fixed string literals, so the (theoretically throwing) path conversion can never actually throw here
        (std::filesystem::path("data") / std::filesystem::path("yields")
        / std::filesystem::path("yields.toml"));
    struct YieldChannelDescriptor
    {
        // NOLINTBEGIN(readability-identifier-naming) -- trailing underscore matches this project's own member-variable convention (see utils::Bracket's identical public-struct-fields-with-trailing-underscore precedent), even though these particular names otherwise match YieldChannel::YieldChannel()'s own parameter names exactly
        Channel channel_;
        std::string modelName_;
        std::optional<double> mMin_;
        std::optional<double> mMax_;
        // NOLINTEND(readability-identifier-naming)
    };

} // namespace yields

#endif // YIELDCOMMONS_HPP