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
Classes | Namespaces | Enumerations | Functions
aid.hpp File Reference
#include <cstdint>
#include <string>
Include dependency graph for aid.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  scifir::aid
 Class that stores astronomical ids, not as an integer but with an string as identifier. Initialization string example: "(P) universe:milky-way:solar-system:earth". More...
 

Namespaces

namespace  scifir
 The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
 

Enumerations

enum class  scifir::astronomical_body : int8_t {
  scifir::NONE , scifir::MILKY_WAY , scifir::ANDROMEDA , scifir::SOLAR_SYSTEM ,
  scifir::SUN , scifir::MOON , scifir::MERCURY , scifir::VENUS ,
  scifir::EARTH , scifir::MARS , scifir::JUPITER , scifir::SATURN ,
  scifir::URANUS , scifir::NEPTUNE , scifir::CERES , scifir::ORCUS ,
  scifir::PLUTO , scifir::HAUMEA , scifir::QUAOAR , scifir::MAKEMAKE ,
  scifir::GONGGONG , scifir::ERIS , scifir::SEDNA , scifir::IO ,
  scifir::EUROPA , scifir::GANYMEDE , scifir::CALLISTO , scifir::MIMAS ,
  scifir::ENCELADUS , scifir::TETHYS , scifir::DIONE , scifir::RHEA ,
  scifir::TITAN , scifir::IAPETUS , scifir::MIRANDA , scifir::ARIEL ,
  scifir::UMBRIEL , scifir::TITANIA , scifir::OBERON , scifir::TRITON ,
  scifir::CHARON , scifir::DYSNOMIA
}
 Contains predefined astronomical bodies to be set automatically in the aid class. All of them are important astronomical bodies, unimportant astronomical bodies aren't included. More...
 

Functions

string scifir::to_string (const aid &x)
 Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
 
string scifir::to_string (const aid::type &x)
 Converts a value of the enum aid::type to its string representation, which can be a single or a pair of letters. The value UNIVERSE returns U. The value GALAXY returns G. The value SOLAR_SYSTEM returns SS. The value PLANET returns P. The value STAR returns ST. The value ASTEROID returns A. The value MOON returns MN. The value METEOR returns MT. The value NONE returns an empty string.
 
aid::type scifir::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() function of aid::type.
 
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.
 
bool operator!= (const scifir::aid &x, const scifir::aid &y)
 Returns true if the type or any data is different between x and y.
 
bool operator== (const scifir::aid &x, const string &init_aid)
 Returns true if x and the aid constructed with init_aid are equal.
 
bool operator!= (const scifir::aid &x, const string &init_aid)
 Returns true if x and the aid constructed with init_aid are different.
 
bool operator== (const string &init_aid, const scifir::aid &x)
 Returns true if x and the aid constructed with init_aid are equal.
 
bool operator!= (const string &init_aid, const scifir::aid &x)
 Returns true if x and the aid constructed with init_aid are different.
 
void operator+= (string &x, const scifir::aid &y)
 Concatenates the string representation of aid y to the string x.
 
string operator+ (const string &x, const scifir::aid &y)
 Concatenates x with the string representation of aid y.
 
string operator+ (const scifir::aid &y, const string &x)
 Concatenates x with the string representation of aid y.
 
ostream & operator<< (ostream &os, const scifir::aid &x)
 Adds the string representation of the aid x to an output stream os.
 
istream & operator>> (istream &is, scifir::aid &x)
 Allows that an istream initializes by string an aid x.
 

Function Documentation

◆ operator!=() [1/3]

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 at line 666 of file aid.cpp.

667{
668 return !(x == y);
669}

◆ operator!=() [2/3]

bool operator!= ( const scifir::aid x,
const string &  init_aid 
)

Returns true if x and the aid constructed with init_aid are different.

Definition at line 677 of file aid.cpp.

678{
679 return !(x == init_aid);
680}

◆ operator!=() [3/3]

bool operator!= ( const string &  init_aid,
const scifir::aid x 
)

Returns true if x and the aid constructed with init_aid are different.

Definition at line 688 of file aid.cpp.

689{
690 return !(init_aid == x);
691}

◆ operator+() [1/2]

string operator+ ( const scifir::aid y,
const string &  x 
)

Concatenates x with the string representation of aid y.

Definition at line 708 of file aid.cpp.

709{
710 ostringstream output;
711 output << y;
712 output << x;
713 return output.str();
714}

◆ operator+() [2/2]

string operator+ ( const string &  x,
const scifir::aid y 
)

Concatenates x with the string representation of aid y.

Definition at line 700 of file aid.cpp.

701{
702 ostringstream output;
703 output << x;
704 output << y;
705 return output.str();
706}

◆ operator+=()

void operator+= ( string &  x,
const scifir::aid y 
)

Concatenates the string representation of aid y to the string x.

Definition at line 693 of file aid.cpp.

694{
695 ostringstream output;
696 output << y;
697 x += output.str();
698}

◆ operator<<()

ostream & operator<< ( ostream &  os,
const scifir::aid x 
)

Adds the string representation of the aid x to an output stream os.

Definition at line 716 of file aid.cpp.

717{
718 return os << to_string(x);
719}
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

◆ operator==() [1/3]

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 at line 654 of file aid.cpp.

655{
657 {
658 return true;
659 }
660 else
661 {
662 return false;
663 }
664}
string universe
The universe of the astronomical body. The predefined value no-universe means that there's no univers...
Definition aid.hpp:42
string galaxy
The galaxy of the astronomical body. The predefined value no-galaxy means that the astronomical objec...
Definition aid.hpp:43
string solar_system
The solar system of the astronomical body. The predefined value no-solar-system means that the astron...
Definition aid.hpp:44
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

◆ operator==() [2/3]

bool operator== ( const scifir::aid x,
const string &  init_aid 
)

Returns true if x and the aid constructed with init_aid are equal.

Definition at line 671 of file aid.cpp.

672{
673 scifir::aid y = scifir::aid(init_aid);
674 return (x == y);
675}
Class that stores astronomical ids, not as an integer but with an string as identifier....
Definition aid.hpp:14

◆ operator==() [3/3]

bool operator== ( const string &  init_aid,
const scifir::aid x 
)

Returns true if x and the aid constructed with init_aid are equal.

Definition at line 682 of file aid.cpp.

683{
684 scifir::aid y = scifir::aid(init_aid);
685 return (x == y);
686}

◆ operator>>()

istream & operator>> ( istream &  is,
scifir::aid x 
)

Allows that an istream initializes by string an aid x.

Definition at line 721 of file aid.cpp.

722{
723 char a[256];
724 is.getline(a, 256);
725 string b(a);
726 boost::trim(b);
727 x = scifir::aid(b);
728 return is;
729}