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

Go to the source code of this file.

Classes

class  scifir::prefix
 Class that represents prefixes of the SI system of units. Each prefix sizes 1 byte. The prefix micro is added to a dimension with the symbol ยต. More...
 

Namespaces

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

Functions

prefix::type scifir::prefix_string (const string &x)
 Returns the value of the enum prefix::type associated with the string x given.
 
prefix scifir::closest_prefix (const prefix &actual_prefix, int actual_scale)
 Returns the closes prefix related to the scale of the current value. It is used when displaying a scalar_unit to the most close prefix available.
 
prefix scifir::create_prefix_by_factor (int factor)
 Creates the prefix of the factor given, which is always between a range.
 
bool operator== (const scifir::prefix &x, const scifir::prefix &y)
 Comparison operator. Compares if two prefixes are the same, that's, if they have the same prefix::type.
 
bool operator!= (const scifir::prefix &x, const scifir::prefix &y)
 Comparison operator. Compares if two prefixes are different, that's, if they don't have the same prefix::type.
 
bool operator<= (const scifir::prefix &x, const scifir::prefix &y)
 Checks if prefix x is of a lower or equal factor than prefix y.
 
bool operator> (const scifir::prefix &x, const scifir::prefix &y)
 Checks if prefix x is of a greather factor than prefix y.
 
bool operator>= (const scifir::prefix &x, const scifir::prefix &y)
 Checks if prefix x is of an equal or greather factor than prefix y.
 
ostream & operator<< (ostream &os, const scifir::prefix &x)
 Adds the string representation of the prefix x to an output stream.
 

Function Documentation

◆ operator!=()

bool operator!= ( const scifir::prefix x,
const scifir::prefix y 
)

Comparison operator. Compares if two prefixes are different, that's, if they don't have the same prefix::type.

Definition at line 441 of file prefix.cpp.

442{
443 return !(x == y);
444}

◆ operator<<()

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

Adds the string representation of the prefix x to an output stream.

Definition at line 461 of file prefix.cpp.

462{
463 return os << x.get_symbol();
464}
string get_symbol() const
Symbol of the prefix given the prefix_type. The symbol of micro is supported in his Unicode version.
Definition prefix.cpp:152

◆ operator<=()

bool operator<= ( const scifir::prefix x,
const scifir::prefix y 
)

Checks if prefix x is of a lower or equal factor than prefix y.

Definition at line 446 of file prefix.cpp.

447{
449}
int get_conversion_factor() const
Returns the conversion factor of the prefix given the prefix_type. It uses the SI system of units for...
Definition prefix.cpp:36

◆ operator==()

bool operator== ( const scifir::prefix x,
const scifir::prefix y 
)

Comparison operator. Compares if two prefixes are the same, that's, if they have the same prefix::type.

Definition at line 436 of file prefix.cpp.

437{
439}

◆ operator>()

bool operator> ( const scifir::prefix x,
const scifir::prefix y 
)

Checks if prefix x is of a greather factor than prefix y.

Definition at line 451 of file prefix.cpp.

452{
454}

◆ operator>=()

bool operator>= ( const scifir::prefix x,
const scifir::prefix y 
)

Checks if prefix x is of an equal or greather factor than prefix y.

Definition at line 456 of file prefix.cpp.

457{
459}