Program Listing for File ElemData.hpp

↰ Return to documentation for file (src/elem/ElemData.hpp)

#ifndef ELEMDATA_HPP
#define ELEMDATA_HPP

#include <array>

namespace elem
{
    class ElemData
    {
    public:

        constexpr ElemData(std::array<char, 2> symbol, unsigned int z) noexcept
        : symbol_(symbol), Z_(z) {}

        ElemData(const ElemData&) = default;
        auto operator=(const ElemData&) -> ElemData& = default;
        ElemData(ElemData&&) = default;
        auto operator=(ElemData&&) -> ElemData& = default;
        ~ElemData() = default;

        [[nodiscard]] constexpr auto symbol() const noexcept
            -> const std::array<char, 2>& { return symbol_; }

        [[nodiscard]] constexpr auto Z() const noexcept // NOLINT(readability-identifier-naming)
            -> unsigned int { return Z_; }

        constexpr auto operator==(const ElemData& o) const noexcept -> bool { return Z_ == o.Z_; }
        constexpr auto operator!=(const ElemData& o) const noexcept -> bool { return Z_ != o.Z_; }
        constexpr auto operator< (const ElemData& o) const noexcept -> bool { return Z_ <  o.Z_; }
        constexpr auto operator> (const ElemData& o) const noexcept -> bool { return Z_ >  o.Z_; }
        constexpr auto operator<=(const ElemData& o) const noexcept -> bool { return Z_ <= o.Z_; }
        constexpr auto operator>=(const ElemData& o) const noexcept -> bool { return Z_ >= o.Z_; }

    protected:
        std::array<char, 2> symbol_;
        unsigned int Z_; // NOLINT(readability-identifier-naming) -- physics naming convention
    };

} // namespace elem

#endif // ELEMDATA_HPP