indigoX
PeriodicTable Class Reference

Singleton class for storing and access elemental information. More...

#include <indigox/classes/periodictable.hpp>

Public Member Functions

Element GetElement (const int32_t z) const
 Get the element with the given atomic number. More...
 
Element GetElement (const std::string name) const
 Get the element with the given name or symbol. More...
 
Element GetUndefined () const
 Get the element for use when an element is not defined. More...
 
size_t NumElements () const
 Number of elements in the PeriodicTable. More...
 
Element operator[] (const int32_t z) const
 Get the element with the given atomic number. More...
 
Element operator[] (const std::string name) const
 Get the element with the given name or symbol. More...
 

Friends

const PeriodicTableGetPeriodicTable ()
 Friendship allows for access to a single PeriodicTable instance. More...
 
struct indigox::test::TestPeriodicTable
 Friendship allws for testing implementation. More...
 

Detailed Description

Singleton class for storing and access elemental information.

The IXPeriodicTable class provides the only means to access the IXElement class. Access to the instance should only be obtained using the GetInstance() method. Like most other classes in the indigoX library, usage is primarily intended through the use of smart pointers.

Member Function Documentation

◆ GetElement() [1/2]

Element GetElement ( const int32_t  z) const

Get the element with the given atomic number.

Parameters
zthe atomic number of the element to get.
Returns
the requested element.
Exceptions
std::invalid_argumentIf the requested atomic number does not exist within the PeriodicTable.

Referenced by PeriodicTable::operator[]().

◆ GetElement() [2/2]

Element GetElement ( const std::string  name) const

Get the element with the given name or symbol.

Name based matches are made ignoring case. Symbol matches are made checking case as well.

Parameters
namethe name or symbol of the element to get.
Returns
the requested element.
Exceptions
std::invalid_argumentIf the requested name or symbol does not exist within the PeriodicTable.

◆ GetUndefined()

Element GetUndefined ( ) const
inline

Get the element for use when an element is not defined.

As there is not much point in an undefined element, this method is intended for internal use.

Returns
the undefined Element.

◆ NumElements()

size_t NumElements ( ) const
inline

Number of elements in the PeriodicTable.

Returns
the number of elements in the PeriodicTable.

◆ operator[]() [1/2]

Element operator[] ( const int32_t  z) const
inline

Get the element with the given atomic number.

Parameters
zthe atomic number of the element to get.
Returns
the requested element.
See also
IXPeriodicTable::GetElement(const uint8_t) const

◆ operator[]() [2/2]

Element operator[] ( const std::string  name) const
inline

Get the element with the given name or symbol.

Parameters
namethe name or symbol of the element to get.
Returns
the requested element.
See also
IXPeriodicTable::GetElement(const std::string) const

Friends And Related Function Documentation

◆ GetPeriodicTable

const PeriodicTable& GetPeriodicTable ( )
friend

Friendship allows for access to a single PeriodicTable instance.

◆ indigox::test::TestPeriodicTable

friend struct indigox::test::TestPeriodicTable
friend

Friendship allws for testing implementation.


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