NuriKit v0.1.0b2
Loading...
Searching...
No Matches
nuri::PeriodicTable Class Referencefinal

The periodic table of elements. More...

#include <nuri/core/element.h>

Public Member Functions

 PeriodicTable (const PeriodicTable &)=delete
 PeriodicTable (PeriodicTable &&) noexcept=delete
PeriodicTableoperator= (const PeriodicTable &)=delete
PeriodicTableoperator= (PeriodicTable &&) noexcept=delete
 ~PeriodicTable () noexcept=default
constexpr const Elementoperator[] (int atomic_number) const noexcept
 Get element with the given atomic number.
constexpr const Elementfind_element (int atomic_number) const noexcept
 Find element with the given atomic number.
const Elementfind_element (std::string_view symbol) const noexcept
 Find element with the given atomic symbol.
const Elementfind_element_of_name (std::string_view name) const noexcept
 Find element with the given name.
bool has_element (std::string_view symbol) const noexcept
 Check if the periodic table has an element with the given atomic symbol.
bool has_element_of_name (std::string_view name) const noexcept
 Check if the periodic table has an element with the given atomic name.
const Elementbegin () const noexcept
const Elementend () const noexcept

Static Public Member Functions

static const PeriodicTableget () noexcept
 Get the singleton instance of the periodic table.
static constexpr bool has_element (int atomic_number) noexcept
 Check if the periodic table has an element with the given atomic symbol.

Static Public Attributes

static constexpr int kElementCount_ = 118 + 1

Detailed Description

The periodic table of elements.

Note
You'd never want to create an instance of this class. Instead, use the get() function to access the singleton instance.

Constructor & Destructor Documentation

◆ PeriodicTable() [1/2]

nuri::PeriodicTable::PeriodicTable ( const PeriodicTable & )
delete

◆ PeriodicTable() [2/2]

nuri::PeriodicTable::PeriodicTable ( PeriodicTable && )
deletenoexcept

◆ ~PeriodicTable()

nuri::PeriodicTable::~PeriodicTable ( )
defaultnoexcept

Member Function Documentation

◆ begin()

const Element * nuri::PeriodicTable::begin ( ) const
inlinenoexcept

◆ end()

const Element * nuri::PeriodicTable::end ( ) const
inlinenoexcept

◆ find_element() [1/2]

const Element * nuri::PeriodicTable::find_element ( int atomic_number) const
inlineconstexprnoexcept

Find element with the given atomic number.

Parameters
atomic_numberThe atomic number of the element.
Returns
A pointer to the element, or nullptr if no element with the given atomic number is known.

◆ find_element() [2/2]

const Element * nuri::PeriodicTable::find_element ( std::string_view symbol) const
noexcept

Find element with the given atomic symbol.

Parameters
symbolThe atomic symbol of the element.
Returns
A pointer to the element, or nullptr if no element with the given symbol is known.
Note
The symbol is case-sensitive, but supports three common cases: Titlecase, UPPERCASE, and lowercase.

◆ find_element_of_name()

const Element * nuri::PeriodicTable::find_element_of_name ( std::string_view name) const
noexcept

Find element with the given name.

Parameters
nameThe atomic name of the element.
Returns
A pointer to the element, or nullptr if no element with the given name is known.
Note
The name is case-sensitive, but supports three common cases: Titlecase, UPPERCASE, and lowercase.

◆ get()

const PeriodicTable & nuri::PeriodicTable::get ( )
staticnoexcept

Get the singleton instance of the periodic table.

Returns
const PeriodicTable & The singleton instance of the periodic table.

◆ has_element() [1/2]

constexpr bool nuri::PeriodicTable::has_element ( int atomic_number)
inlinestaticconstexprnoexcept

Check if the periodic table has an element with the given atomic symbol.

Parameters
atomic_numberThe atomic number of the element.
Returns
Whether the periodic table has an element with the given atomic number.

◆ has_element() [2/2]

bool nuri::PeriodicTable::has_element ( std::string_view symbol) const
noexcept

Check if the periodic table has an element with the given atomic symbol.

Parameters
symbolThe atomic symbol of the element.
Returns
Whether the periodic table has an element with the given symbol.
Note
The symbol is case-sensitive, but supports three common cases: Titlecase, UPPERCASE, and lowercase.

◆ has_element_of_name()

bool nuri::PeriodicTable::has_element_of_name ( std::string_view name) const
noexcept

Check if the periodic table has an element with the given atomic name.

Parameters
nameThe atomic name of the element.
Returns
Whether the periodic table has an element with the given name.
Note
The name is case-sensitive, but supports three common cases: Titlecase, UPPERCASE, and lowercase.

◆ operator=() [1/2]

PeriodicTable & nuri::PeriodicTable::operator= ( const PeriodicTable & )
delete

◆ operator=() [2/2]

PeriodicTable & nuri::PeriodicTable::operator= ( PeriodicTable && )
deletenoexcept

◆ operator[]()

const Element & nuri::PeriodicTable::operator[] ( int atomic_number) const
inlineconstexprnoexcept

Get element with the given atomic number.

Parameters
atomic_numberThe atomic number of the element.
Returns
A const reference to the element.
Note
The behavior is undefined if atomic_number is not in range [0, 118].

Member Data Documentation

◆ kElementCount_

int nuri::PeriodicTable::kElementCount_ = 118 + 1
staticconstexpr

The documentation for this class was generated from the following file: