scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
Loading...
Searching...
No Matches
aid.hpp
Go to the documentation of this file.
1#ifndef SCIFIR_UNITS_SPECIAL_UNITS_AID_HPP_INCLUDED
2#define SCIFIR_UNITS_SPECIAL_UNITS_AID_HPP_INCLUDED
3
4#include <cstdint>
5#include <string>
6
7using namespace std;
8
9namespace scifir
10{
12
13 class aid
14 {
15 public:
17
18 aid();
19 aid(const aid& x);
20 aid(aid&& x);
21 explicit aid(const scifir::astronomical_body& predefined_astronomical_body);
22 explicit aid(const aid::type& new_astronomical_type,const string& new_astro1,const string& new_astro2 = "",const string& new_astro3 = "",const string& new_astro4 = "");
23 explicit aid(const string& init_aid);
24
25 aid& operator =(const aid& x);
26 aid& operator =(aid&& x);
27 aid& operator =(const string& init_aid);
28
29 bool has_no_universe() const;
30 bool has_unknown_universe() const;
31 bool has_no_galaxy() const;
32 bool has_unknown_galaxy() const;
33 bool has_no_solar_system() const;
34 bool has_unknown_solar_system() const;
35 bool has_unknown_planet() const;
36 bool has_unknown_moon() const;
37 bool has_unknown_star() const;
38 bool has_unknown_asteroid() const;
39
40 string display() const;
41
42 string universe;
43 string galaxy;
47
48 private:
49 void initialize_from_string(const string& init_aid);
50 };
51
52 string to_string(const aid& x);
53 string to_string(const aid::type& x);
54 aid::type create_astronomical_type(const string& astronomical_type_abbreviation);
55}
56
57bool operator ==(const scifir::aid& x, const scifir::aid& y);
58bool operator !=(const scifir::aid& x, const scifir::aid& y);
59
60bool operator ==(const scifir::aid& x, const string& init_aid);
61bool operator !=(const scifir::aid& x, const string& init_aid);
62
63bool operator ==(const string& init_aid, const scifir::aid& x);
64bool operator !=(const string& init_aid, const scifir::aid& x);
65
66void operator +=(string& x, const scifir::aid& y);
67string operator +(const string& x, const scifir::aid& y);
68string operator +(const scifir::aid& y, const string& x);
69
70ostream& operator <<(ostream& os, const scifir::aid& x);
71istream& operator >>(istream& is, scifir::aid& x);
72
73#endif // SCIFIR_UNITS_SPECIAL_UNITS_AID_HPP_INCLUDED
bool operator==(const scifir::aid &x, const scifir::aid &y)
Returns true if the type and all data are the same between x and y.
Definition aid.cpp:654
istream & operator>>(istream &is, scifir::aid &x)
Allows that an istream initializes by string an aid x.
Definition aid.cpp:721
void operator+=(string &x, const scifir::aid &y)
Concatenates the string representation of aid y to the string x.
Definition aid.cpp:693
bool operator!=(const scifir::aid &x, const scifir::aid &y)
Returns true if the type or any data is different between x and y.
Definition aid.cpp:666
ostream & operator<<(ostream &os, const scifir::aid &x)
Adds the string representation of the aid x to an output stream os.
Definition aid.cpp:716
string operator+(const string &x, const scifir::aid &y)
Concatenates x with the string representation of aid y.
Definition aid.cpp:700
Class that stores astronomical ids, not as an integer but with an string as identifier....
Definition aid.hpp:14
bool has_unknown_asteroid() const
Returns true if the asteroid has the special value "unknown-asteroid".
Definition aid.cpp:439
string universe
The universe of the astronomical body. The predefined value no-universe means that there's no univers...
Definition aid.hpp:42
void initialize_from_string(const string &init_aid)
Internal function. Initializes the member-variables with an initialization string of aid.
Definition aid.cpp:444
bool has_unknown_solar_system() const
Returns true if the solar system has the special value "unknown-solar-system".
Definition aid.cpp:414
bool has_unknown_star() const
Returns true if the star has the special value "unknown-star".
Definition aid.cpp:434
string galaxy
The galaxy of the astronomical body. The predefined value no-galaxy means that the astronomical objec...
Definition aid.hpp:43
aid::type astronomical_type
The type of the astronomical body, which can be any value of the enum aid::type.
Definition aid.hpp:46
bool has_no_solar_system() const
Definition aid.cpp:419
string solar_system
The solar system of the astronomical body. The predefined value no-solar-system means that the astron...
Definition aid.hpp:44
bool has_unknown_planet() const
Returns true if the planet has the special value "unknown-planet".
Definition aid.cpp:424
bool has_unknown_galaxy() const
Returns true if the galaxy has the special value "unknown-galaxy".
Definition aid.cpp:409
string display() const
Returns a string representation of aid.
Definition aid.cpp:540
aid & operator=(const aid &x)
Copy assignment. The member-variables are copied from the aid x.
Definition aid.cpp:368
bool has_unknown_universe() const
Returns true if the universe has the special value "unknown-universe".
Definition aid.cpp:399
aid()
Default constructor. The astronomical type is NONE, the other member-variables are empty strings.
Definition aid.cpp:13
bool has_unknown_moon() const
Returns true if the moon has the special value "unknown-moon".
Definition aid.cpp:429
bool has_no_galaxy() const
Definition aid.cpp:404
type
Type of astronomical body.
Definition aid.hpp:16
@ NONE
No astronomical body.
Definition aid.hpp:16
@ MOON
A moon. A moon is a natural satellite of a planet. His string representation is MN.
Definition aid.hpp:16
@ ASTEROID
An asteroid. An asteroid is an astronomical object that orbits another astronomical object....
Definition aid.hpp:16
@ METEOR
A meteor. His string representation is MT.
Definition aid.hpp:16
@ GALAXY
A galaxy. His string representation is G.
Definition aid.hpp:16
@ SOLAR_SYSTEM
A solar system. A solar system is composed of planets orbiting a star. His string representation is S...
Definition aid.hpp:16
@ UNIVERSE
A universe. His string representation is U.
Definition aid.hpp:16
@ STAR
A star. His string representation is ST.
Definition aid.hpp:16
@ PLANET
A planet. A planet is an astronomical object with atmosphere. His string representation is P.
Definition aid.hpp:16
bool has_no_universe() const
Definition aid.cpp:394
string astronomical_body
The name of the astronomical body. The predefined value unknown-planet means that it's not known the ...
Definition aid.hpp:45
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
Definition address.cpp:6
astronomical_body
Contains predefined astronomical bodies to be set automatically in the aid class. All of them are imp...
Definition aid.hpp:11
@ IAPETUS
The moon of Saturn Iapetus.
@ DYSNOMIA
The moon of Eris Dysnomia.
@ ENCELADUS
The moon of Saturn Enceladus.
@ MILKY_WAY
The Milky Way galaxy.
@ MIMAS
The moon of Saturn Mimas.
@ CERES
The dwarf planet Ceres.
@ OBERON
The moon of Uranus Oberon.
@ RHEA
The moon of Saturn Rhea.
@ ANDROMEDA
The Andromeda galaxy, 2.5 million light years from Earth.
@ GANYMEDE
The moon of Jupiter Ganymede.
@ EUROPA
The moon of Jupiter Europa.
@ TITANIA
The moon of Uranus Titania.
@ SATURN
The planet Saturn.
@ MARS
The planet Mars.
@ HAUMEA
The dwarf planet Haumea.
@ MIRANDA
The moon of Uranus Miranda.
@ UMBRIEL
The moon of Uranus Umbriel.
@ QUAOAR
The dwarf planet Quaoar.
@ URANUS
The planet Uranus.
@ TITAN
The moon of Saturn Titan.
@ ERIS
The dwarf planet Eris.
@ GONGGONG
The possible dwarf planet Gonggong.
@ SUN
The Sun, the sun of the solar system of the Earth.
@ TRITON
The moon of Neptune Triton.
@ VENUS
The planet Venus.
@ ARIEL
The moon of Uranus Ariel.
@ JUPITER
The planet Jupiter.
@ NEPTUNE
The planet Neptune.
@ SEDNA
The minor body Sedna.
@ CALLISTO
The moon of Jupiter Callisto.
@ MERCURY
The planet Mercury.
@ TETHYS
The moon of Saturn Tethys.
@ NONE
No predefined astronomical body selected.
@ EARTH
The planet Earth.
@ DIONE
The moon of Saturn Dione.
@ CHARON
The moon of Pluto Charon.
@ PLUTO
The dwarf planet Pluto.
@ MAKEMAKE
The dwarf planet Makemake.
@ MOON
The Moon of the Earth.
@ IO
The moon of Jupiter Io.
@ ORCUS
The possible dwarf planet Orcus.
@ SOLAR_SYSTEM
The Solar System of the Earth.
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
Definition aid.cpp:582
aid::type create_astronomical_type(const string &astronomical_type_abbreviation)
Creates an instance of an aid::type with the given string, which is the reverse as the to_string() fu...
Definition aid.cpp:613