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
base_units.cpp
Go to the documentation of this file.
1#include "./base_units.hpp"
2
3#include "./scalar_unit.hpp"
4#include "./dimension.hpp"
5#include "./prefix.hpp"
6#include "./constants.hpp"
7
8#include "boost/algorithm/string.hpp"
9
10#include <cassert>
11#include <cctype>
12#include <cmath>
13#include <iostream>
14#include <map>
15#include <string>
16#include <vector>
17
18using namespace std;
19
20namespace scifir
21{
23
28
37
39 {
40 if (x.has_dimensions(time_duration::real_dimensions))
41 {
42 value = std::move(x.get_value());
43 dimensions = std::move(x.get_dimensions());
44 }
45 }
46
49
52
55
58
61
64
67
70
73
76
79
82
84 {
85 if(!isdigit(init_time[0]))
86 {
87 return;
88 }
89 else
90 {
92 boost::split(init_values,init_time,boost::is_any_of(" "));
93 value = 0;
94 for (unsigned int i = 0; i < init_values.size(); i++)
95 {
96 int j = 0;
97 while(isdigit(init_values[i][j]) || init_values[i][j] == '.' || init_values[i][j] == ' ' || init_values[i][j] == '*' || init_values[i][j] == '^' || init_values[i][j] == 'e' || init_values[i][j] == 'E')
98 {
99 if (init_values[i][j] == ' ')
100 {
101 break;
102 }
103 j++;
104 }
105 string string_value = init_values[i].substr(0, j);
106 boost::algorithm::erase_all(string_value, " ");
107 size_t search_e = string_value.find("E");
108 if (search_e != string::npos)
109 {
110 string_value.replace(search_e,1,"e");
111 }
112 size_t search_10 = string_value.find("*10^");
113 if (search_10 != string::npos)
114 {
115 string_value.replace(search_10,4,"e");
116 }
118 float init_value_float;
120 string init_value_dimension = init_values[i].substr(j);
122 if (init_value_dimension == "d")
123 {
125 }
126 else if(init_value_dimension == "h")
127 {
129 }
130 else if(init_value_dimension == "min")
131 {
133 }
134 else if(init_value_dimension == "s")
135 {
137 }
139 }
141 }
142 }
143
144 const string time_duration::dimensions_match = "s";
146
147 time_duration::operator std::chrono::seconds() const
148 {
149 scifir::time_duration a = *this;
150 a.change_dimensions("s");
151 return std::chrono::seconds(int(a.get_value()));
152 }
153
155 {
157 if (*this >= one_year)
158 {
159 return int(trunc((*this / one_year).get_value()));
160 }
161 else
162 {
163 return 0;
164 }
165 }
166
168 {
170 if (*this >= one_month)
171 {
172 return int(trunc((*this / one_month).get_value()));
173 }
174 else
175 {
176 return 0;
177 }
178 }
179
181 {
183 if (*this >= one_week)
184 {
185 return int(trunc((*this / one_week).get_value()));
186 }
187 else
188 {
189 return 0;
190 }
191 }
192
194 {
196 if (*this >= one_day)
197 {
198 return int(trunc((*this / one_day).get_value()));
199 }
200 else
201 {
202 return 0;
203 }
204 }
205
207 {
209 if (*this >= one_hour)
210 {
211 return int(trunc((*this / one_hour).get_value()));
212 }
213 else
214 {
215 return 0;
216 }
217 }
218
220 {
222 if (*this >= one_minute)
223 {
224 return int(trunc((*this / one_minute).get_value()));
225 }
226 else
227 {
228 return 0;
229 }
230 }
231
233 {
235 if (*this >= one_second)
236 {
237 return int(trunc((*this / one_second).get_value()));
238 }
239 else
240 {
241 return 0;
242 }
243 }
244
245#ifdef IS_UNIX
246 string time_duration::get_finish_date() const
247 {
248 chrono::time_point<chrono::system_clock> start = chrono::system_clock::now();
249 start += chrono::seconds(*this);
250 std::time_t start_time = std::chrono::system_clock::to_time_t(start);
253 return output.str();
254 }
255#elif IS_WINDOWS
256 string time_duration::get_finish_date() const
257 {
258 chrono::time_point<chrono::system_clock> start = chrono::system_clock::now();
259 start += chrono::seconds(*this);
260 std::time_t start_time = std::chrono::system_clock::to_time_t(start);
261 stringstream output;
262 char str[26];
263 ctime_s(str,sizeof str,&start_time);
264 output << str;
265 return output.str();
266 }
267#endif
268
270 {
274 if (*this >= one_year)
275 {
276 int total_of_years = int(trunc((*this / one_year).get_value()));
277 output << total_of_years << "y ";
279 }
282 {
284 output << total_of_months << "m ";
286 }
288 if (remaining_time >= one_day)
289 {
291 output << total_of_days << "d ";
293 }
296 {
298 output << total_of_hours << "h ";
300 }
303 {
305 output << total_of_minutes << "min ";
307 }
310 {
311 remaining_time.change_dimensions("s");
312 float total_of_seconds = float(remaining_time.get_value());
313 output << total_of_seconds << "s";
314 }
315 return output.str();
316 }
317
319 {
321 out << get_years() << " y";
322 return out.str();
323 }
324
326 {
328 out << get_months() << " months";
329 return out.str();
330 }
331
333 {
335 out << get_weeks() << " weeks";
336 return out.str();
337 }
338
340 {
342 out << get_days() << " d";
343 return out.str();
344 }
345
347 {
349 out << get_hours() << " h";
350 return out.str();
351 }
352
354 {
356 out << get_minutes() << " min";
357 return out.str();
358 }
359
361 {
363 out << get_seconds() << " s";
364 return out.str();
365 }
366
368
369 mass::mass(const percentage& new_percentage,const mass& new_mass) : scalar_unit()
370 {
371 dimensions = new_mass.get_dimensions();
372 value = new_percentage * new_mass.get_value();
373 }
374
375 mass::mass(const string& init_percentage,const string& init_mass) : scalar_unit()
376 {
377 initialize_from_string(init_mass,mass::real_dimensions);
379 value = new_percentage * value;
380 }
381
384 SCALAR_UNIT_CPP(mole,"mol");
385
386 mole::mole(const percentage& new_percentage,const mole& new_mole) : scalar_unit()
387 {
388 dimensions = new_mole.get_dimensions();
389 value = new_percentage * new_mole.get_value();
390 }
391
392 mole::mole(const string& init_percentage,const string& init_mole) : scalar_unit()
393 {
394 initialize_from_string(init_mole,mole::real_dimensions);
396 value = new_percentage * value;
397 }
398
399 int mole::get_number_of_particles() const
400 {
401 return 1;
402 /*if (scalar_unit::actual_dimensions.count(particles))
403 {
404 return scalar_unit::value;
405 }
406 else
407 {
408 return scalar_unit::value * scifir::AVOGADRO_CONSTANT;
409 }*/
410 }
411
414}
415
416scifir::length operator"" _Qm(unsigned long long int x)
417{
419}
420
421scifir::length operator"" _Rm(unsigned long long int x)
422{
424}
425
426scifir::length operator"" _Ym(unsigned long long int x)
427{
429}
430
431scifir::length operator"" _Zm(unsigned long long int x)
432{
434}
435
436scifir::length operator"" _Em(unsigned long long int x)
437{
439}
440
441scifir::length operator"" _Pm(unsigned long long int x)
442{
444}
445
446scifir::length operator"" _Tm(unsigned long long int x)
447{
449}
450
451scifir::length operator"" _Gm(unsigned long long int x)
452{
454}
455
456scifir::length operator"" _Mm(unsigned long long int x)
457{
459}
460
461scifir::length operator"" _km(unsigned long long int x)
462{
464}
465
466scifir::length operator"" _hm(unsigned long long int x)
467{
469}
470
471scifir::length operator"" _dam(unsigned long long int x)
472{
474}
475
476scifir::length operator"" _m(unsigned long long int x)
477{
479}
480
481scifir::length operator"" _dm(unsigned long long int x)
482{
484}
485
486scifir::length operator"" _cm(unsigned long long int x)
487{
489}
490
491scifir::length operator"" _mm(unsigned long long int x)
492{
494}
495
496scifir::length operator"" _um(unsigned long long int x)
497{
499}
500
501scifir::length operator"" _nm(unsigned long long int x)
502{
504}
505
506scifir::length operator"" _pm(unsigned long long int x)
507{
509}
510
511scifir::length operator"" _fm(unsigned long long int x)
512{
514}
515
516scifir::length operator"" _am(unsigned long long int x)
517{
519}
520
521scifir::length operator"" _zm(unsigned long long int x)
522{
524}
525
526scifir::length operator"" _ym(unsigned long long int x)
527{
529}
530
531scifir::length operator"" _rm(unsigned long long int x)
532{
534}
535
536scifir::length operator"" _qm(unsigned long long int x)
537{
539}
540
545
550
555
556scifir::time_duration operator"" _ns(unsigned long long int x)
557{
559}
560
561scifir::time_duration operator"" _ps(unsigned long long int x)
562{
564}
565
570
571scifir::time_duration operator"" _as(unsigned long long int x)
572{
574}
575
580
585
590
595
596scifir::mass operator"" _Qg(unsigned long long int x)
597{
599}
600
601scifir::mass operator"" _Rg(unsigned long long int x)
602{
604}
605
606scifir::mass operator"" _Yg(unsigned long long int x)
607{
609}
610
611scifir::mass operator"" _Zg(unsigned long long int x)
612{
614}
615
616scifir::mass operator"" _Eg(unsigned long long int x)
617{
619}
620
621scifir::mass operator"" _Pg(unsigned long long int x)
622{
624}
625
626scifir::mass operator"" _Tg(unsigned long long int x)
627{
629}
630
631scifir::mass operator"" _Gg(unsigned long long int x)
632{
634}
635
636scifir::mass operator"" _Mg(unsigned long long int x)
637{
639}
640
641scifir::mass operator"" _kg(unsigned long long int x)
642{
644}
645
646scifir::mass operator"" _hg(unsigned long long int x)
647{
649}
650
651scifir::mass operator"" _dag(unsigned long long int x)
652{
654}
655
656scifir::mass operator"" _g(unsigned long long int x)
657{
659}
660
661scifir::mass operator"" _dg(unsigned long long int x)
662{
664}
665
666scifir::mass operator"" _cg(unsigned long long int x)
667{
669}
670
671scifir::mass operator"" _mg(unsigned long long int x)
672{
674}
675
676scifir::mass operator"" _ug(unsigned long long int x)
677{
679}
680
681scifir::mass operator"" _ng(unsigned long long int x)
682{
684}
685
686scifir::mass operator"" _pg(unsigned long long int x)
687{
689}
690
691scifir::mass operator"" _fg(unsigned long long int x)
692{
694}
695
696scifir::mass operator"" _ag(unsigned long long int x)
697{
699}
700
701scifir::mass operator"" _zg(unsigned long long int x)
702{
704}
705
706scifir::mass operator"" _yg(unsigned long long int x)
707{
709}
710
711scifir::mass operator"" _rg(unsigned long long int x)
712{
714}
715
716scifir::mass operator"" _qg(unsigned long long int x)
717{
719}
720
721scifir::charge operator"" _QC(unsigned long long int x)
722{
724}
725
726scifir::charge operator"" _RC(unsigned long long int x)
727{
729}
730
731scifir::charge operator"" _YC(unsigned long long int x)
732{
734}
735
736scifir::charge operator"" _ZC(unsigned long long int x)
737{
739}
740
741scifir::charge operator"" _EC(unsigned long long int x)
742{
744}
745
746scifir::charge operator"" _PC(unsigned long long int x)
747{
749}
750
751scifir::charge operator"" _TC(unsigned long long int x)
752{
754}
755
756scifir::charge operator"" _GC(unsigned long long int x)
757{
759}
760
761scifir::charge operator"" _MC(unsigned long long int x)
762{
764}
765
766scifir::charge operator"" _kC(unsigned long long int x)
767{
769}
770
771scifir::charge operator"" _hC(unsigned long long int x)
772{
774}
775
776scifir::charge operator"" _daC(unsigned long long int x)
777{
779}
780
781scifir::charge operator"" _C(unsigned long long int x)
782{
784}
785
786scifir::charge operator"" _dC(unsigned long long int x)
787{
789}
790
791scifir::charge operator"" _cC(unsigned long long int x)
792{
794}
795
796scifir::charge operator"" _mC(unsigned long long int x)
797{
799}
800
801scifir::charge operator"" _uC(unsigned long long int x)
802{
804}
805
806scifir::charge operator"" _nC(unsigned long long int x)
807{
809}
810
811scifir::charge operator"" _pC(unsigned long long int x)
812{
814}
815
816scifir::charge operator"" _fC(unsigned long long int x)
817{
819}
820
821scifir::charge operator"" _aC(unsigned long long int x)
822{
824}
825
826scifir::charge operator"" _zC(unsigned long long int x)
827{
829}
830
831scifir::charge operator"" _yC(unsigned long long int x)
832{
834}
835
836scifir::charge operator"" _rC(unsigned long long int x)
837{
839}
840
841scifir::charge operator"" _qC(unsigned long long int x)
842{
844}
845
846scifir::temperature operator"" _QK(unsigned long long int x)
847{
849}
850
851scifir::temperature operator"" _RK(unsigned long long int x)
852{
854}
855
856scifir::temperature operator"" _YK(unsigned long long int x)
857{
859}
860
861scifir::temperature operator"" _ZK(unsigned long long int x)
862{
864}
865
866scifir::temperature operator"" _EK(unsigned long long int x)
867{
869}
870
871scifir::temperature operator"" _PK(unsigned long long int x)
872{
874}
875
876scifir::temperature operator"" _TK(unsigned long long int x)
877{
879}
880
881scifir::temperature operator"" _GK(unsigned long long int x)
882{
884}
885
886scifir::temperature operator"" _MK(unsigned long long int x)
887{
889}
890
891scifir::temperature operator"" _kK(unsigned long long int x)
892{
894}
895
896scifir::temperature operator"" _hK(unsigned long long int x)
897{
899}
900
901scifir::temperature operator"" _daK(unsigned long long int x)
902{
904}
905
906scifir::temperature operator"" _K(unsigned long long int x)
907{
909}
910
911scifir::temperature operator"" _dK(unsigned long long int x)
912{
914}
915
916scifir::temperature operator"" _cK(unsigned long long int x)
917{
919}
920
921scifir::temperature operator"" _mK(unsigned long long int x)
922{
924}
925
926scifir::temperature operator"" _uK(unsigned long long int x)
927{
929}
930
931scifir::temperature operator"" _nK(unsigned long long int x)
932{
934}
935
936scifir::temperature operator"" _pK(unsigned long long int x)
937{
939}
940
941scifir::temperature operator"" _fK(unsigned long long int x)
942{
944}
945
946scifir::temperature operator"" _aK(unsigned long long int x)
947{
949}
950
951scifir::temperature operator"" _zK(unsigned long long int x)
952{
954}
955
956scifir::temperature operator"" _yK(unsigned long long int x)
957{
959}
960
961scifir::temperature operator"" _rK(unsigned long long int x)
962{
964}
965
966scifir::temperature operator"" _qK(unsigned long long int x)
967{
969}
970
971scifir::mole operator"" _Qmol(unsigned long long int x)
972{
974}
975
976scifir::mole operator"" _Rmol(unsigned long long int x)
977{
979}
980
981scifir::mole operator"" _Ymol(unsigned long long int x)
982{
984}
985
986scifir::mole operator"" _Zmol(unsigned long long int x)
987{
989}
990
991scifir::mole operator"" _Emol(unsigned long long int x)
992{
994}
995
996scifir::mole operator"" _Pmol(unsigned long long int x)
997{
999}
1000
1001scifir::mole operator"" _Tmol(unsigned long long int x)
1002{
1004}
1005
1006scifir::mole operator"" _Gmol(unsigned long long int x)
1007{
1009}
1010
1011scifir::mole operator"" _Mmol(unsigned long long int x)
1012{
1014}
1015
1016scifir::mole operator"" _kmol(unsigned long long int x)
1017{
1019}
1020
1021scifir::mole operator"" _hmol(unsigned long long int x)
1022{
1024}
1025
1026scifir::mole operator"" _damol(unsigned long long int x)
1027{
1029}
1030
1031scifir::mole operator"" _mol(unsigned long long int x)
1032{
1034}
1035
1036scifir::mole operator"" _dmol(unsigned long long int x)
1037{
1039}
1040
1041scifir::mole operator"" _cmol(unsigned long long int x)
1042{
1044}
1045
1046scifir::mole operator"" _mmol(unsigned long long int x)
1047{
1049}
1050
1051scifir::mole operator"" _umol(unsigned long long int x)
1052{
1054}
1055
1056scifir::mole operator"" _nmol(unsigned long long int x)
1057{
1059}
1060
1061scifir::mole operator"" _pmol(unsigned long long int x)
1062{
1064}
1065
1066scifir::mole operator"" _fmol(unsigned long long int x)
1067{
1069}
1070
1071scifir::mole operator"" _amol(unsigned long long int x)
1072{
1074}
1075
1076scifir::mole operator"" _zmol(unsigned long long int x)
1077{
1079}
1080
1081scifir::mole operator"" _ymol(unsigned long long int x)
1082{
1084}
1085
1086scifir::mole operator"" _rmol(unsigned long long int x)
1087{
1089}
1090
1091scifir::mole operator"" _qmol(unsigned long long int x)
1092{
1094}
1095
1100
1105
1110
1115
1116scifir::light_intensity operator"" _Ecd(unsigned long long int x)
1117{
1119}
1120
1121scifir::light_intensity operator"" _Pcd(unsigned long long int x)
1122{
1124}
1125
1126scifir::light_intensity operator"" _Tcd(unsigned long long int x)
1127{
1129}
1130
1131scifir::light_intensity operator"" _Gcd(unsigned long long int x)
1132{
1134}
1135
1136scifir::light_intensity operator"" _Mcd(unsigned long long int x)
1137{
1139}
1140
1141scifir::light_intensity operator"" _kcd(unsigned long long int x)
1142{
1144}
1145
1150
1151scifir::light_intensity operator"" _dacd(unsigned long long int x)
1152{
1154}
1155
1160
1161scifir::light_intensity operator"" _dcd(unsigned long long int x)
1162{
1164}
1165
1170
1175
1180
1181scifir::light_intensity operator"" _ncd(unsigned long long int x)
1182{
1184}
1185
1186scifir::light_intensity operator"" _pcd(unsigned long long int x)
1187{
1189}
1190
1195
1196scifir::light_intensity operator"" _acd(unsigned long long int x)
1197{
1199}
1200
1205
1210
1215
1220
1225
1230
1235
1240
1241scifir::information_size operator"" _EB(unsigned long long int x)
1242{
1244}
1245
1246scifir::information_size operator"" _PB(unsigned long long int x)
1247{
1249}
1250
1251scifir::information_size operator"" _TB(unsigned long long int x)
1252{
1254}
1255
1256scifir::information_size operator"" _GB(unsigned long long int x)
1257{
1259}
1260
1261scifir::information_size operator"" _MB(unsigned long long int x)
1262{
1264}
1265
1266scifir::information_size operator"" _kB(unsigned long long int x)
1267{
1269}
1270
1275
1276scifir::information_size operator"" _Qbit(unsigned long long int x)
1277{
1279}
1280
1281scifir::information_size operator"" _Rbit(unsigned long long int x)
1282{
1284}
1285
1286scifir::information_size operator"" _Ybit(unsigned long long int x)
1287{
1289}
1290
1291scifir::information_size operator"" _Zbit(unsigned long long int x)
1292{
1294}
1295
1296scifir::information_size operator"" _Ebit(unsigned long long int x)
1297{
1299}
1300
1301scifir::information_size operator"" _Pbit(unsigned long long int x)
1302{
1304}
1305
1306scifir::information_size operator"" _Tbit(unsigned long long int x)
1307{
1309}
1310
1311scifir::information_size operator"" _Gbit(unsigned long long int x)
1312{
1314}
1315
1316scifir::information_size operator"" _Mbit(unsigned long long int x)
1317{
1319}
1320
1321scifir::information_size operator"" _kbit(unsigned long long int x)
1322{
1324}
1325
1326scifir::information_size operator"" _bit(unsigned long long int x)
1327{
1329}
1330
1335
1340
1345
1350
1355
1360
1365
1370
1375
1380
1385
1390
1395
1400
1405
1410
1415
1420
1425
1430
1435
1440
1445
1450
1455
1460
1465
1470
1475
1480
1485
1490
1495
1500
1505
1510
1515
1520
1525
1530
1535
1540
1545
1550
1555
1560
1565
1570
1575
1580
1585
1590
1595
1600
1605
1610
1615
1620
1625
1630
1635
1640
1645
1650
1655
1660
1665
1670
1675
1680
1685
1690
1695
1700
1705
1710
1715
1720
1725
1730
1735
1740
1745
1750
1755
1760
1765
1770
1775
1780
1785
1790
1795
1800
1805
1810
1815
1820
1825
1830
1835
1840
1845
1850
1855
1860
1865
1870
1875
1880
1885
1890
1895
1900
1905
1910
1915
1920
1925
1930
1935
1940
1945
1950
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
2005
2010
2015
2020
2025
2030
2035
2040
2045
2050
2055
2060
2065
2070
2075
2080
2085
2090
2095
2100
2105
2110
2115
2120
2125
2130
2135
2140
2145
2150
2155
2160
2165
2170
2175
2180
2185
2190
2195
2200
2205
2210
2215
2220
2225
2230
2235
2240
Class that represents dimensions of the SI system of units. Each dimension sizes 6 bytes,...
Definition dimension.hpp:31
position
Represents the position of the dimension, which can be at the numerator or at the denominator....
Definition dimension.hpp:38
@ NUMERATOR
The dimension is at the numerator.
Definition dimension.hpp:38
type
Represents a dimension of the SI system of units. All the dimensions of the SI system of units are su...
Definition dimension.hpp:34
@ MOLE
Mole, plural moles. SI dimension of quantity. Symbol mol.
Definition dimension.hpp:35
@ COULOMB
Coulomb, plural coulombs. SI dimension of charge. Special name. Symbol C.
Definition dimension.hpp:35
@ GRAM
Gram, plural grams. SI dimension of mass. Symbol g.
Definition dimension.hpp:35
@ BIT
Bit, plural bits. Dimension of amount of information, of each binary digit. Symbol bit.
Definition dimension.hpp:35
@ SECOND
Second, plural seconds. SI dimension of time. Symbol s.
Definition dimension.hpp:35
@ CANDELA
Candela, plural candelas. SI dimension of luminous intensity. Symbol cd.
Definition dimension.hpp:35
@ BYTE
Byte, plural bytes. Dimension of amount of information. Symbol B.
Definition dimension.hpp:35
@ KELVIN
Kelvin, plural kelvins. SI dimension of temperature. Symbol K.
Definition dimension.hpp:35
@ METRE
Meter, plural meters. SI dimension of length. Symbol m.
Definition dimension.hpp:35
Class that allows to handle percentages and do calculations with it easy. It supports normal percenta...
type
Represents a prefix of the SI system of units. All the prefixes of the SI system of units are support...
Definition prefix.hpp:16
@ ATTO
Prefix of a factor of 10^-18.
Definition prefix.hpp:16
@ YOCTO
Prefix of a factor of 10^-24.
Definition prefix.hpp:16
@ RONNA
Prefix of a factor of 10^27.
Definition prefix.hpp:16
@ NANO
Prefix of a factor of 10^-9.
Definition prefix.hpp:16
@ MILLI
Prefix of a factor of 10^-3.
Definition prefix.hpp:16
@ NONE
There is no prefix. Then, the dimension is not increased or decreased by some factor.
Definition prefix.hpp:16
@ EXA
Prefix of a factor of 10^18.
Definition prefix.hpp:16
@ QUETTA
Prefix of a factor of 10^30.
Definition prefix.hpp:16
@ KILO
Prefix of a factor of 10^3.
Definition prefix.hpp:16
@ MEGA
Prefix of a factor of 10^6.
Definition prefix.hpp:16
@ HECTO
Prefix of a factor of 10^2.
Definition prefix.hpp:16
@ CENTI
Prefix of a factor of 10^-2.
Definition prefix.hpp:16
@ PETA
Prefix of a factor of 10^15.
Definition prefix.hpp:16
@ RONTO
Prefix of a factor of 10^-27.
Definition prefix.hpp:16
@ DECA
Prefix of a factor of 10^1.
Definition prefix.hpp:16
@ ZEPTO
Prefix of a factor of 10^-21.
Definition prefix.hpp:16
@ YOTTA
Prefix of a factor of 10^24.
Definition prefix.hpp:16
@ FEMTO
Prefix of a factor of 10^-15.
Definition prefix.hpp:16
@ DECI
Prefix of a factor of 10^-1.
Definition prefix.hpp:16
@ MICRO
Prefix of a factor of 10^-6.
Definition prefix.hpp:16
@ GIGA
Prefix of a factor of 10^9.
Definition prefix.hpp:16
@ QUECTO
Prefix of a factor of 10^-30.
Definition prefix.hpp:16
@ PICO
Prefix of a factor of 10^-12.
Definition prefix.hpp:16
@ ZETTA
Prefix of a factor of 10^21.
Definition prefix.hpp:16
@ TERA
Prefix of a factor of 10^12.
Definition prefix.hpp:16
Class that allows to create scalar units, which are composed of a value (as a float) and dimensions....
vector< dimension > dimensions
Dimensions of the scalar_unit. They can be simple dimensions, composite dimensions or special names.
const vector< dimension > & get_dimensions() const
Read-only getter of the dimensions.
bool has_dimensions(const string &init_dimensions) const
Checks if the basic dimensions are the same as the initialization string of dimensions.
float value
Value of the scalar_unit. It changes automatically when the dimensions change.
const float & get_value() const
Read-only getter of the value.
static const vector< dimension > real_dimensions
string display_hours() const
string get_finish_date() const
string display_minutes() const
string display_seconds() const
string display_weeks() const
string display_months() const
string display_days() const
static const string dimensions_match
string display_as_time() const
string display_years() const
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
Definition address.cpp:6
vector< dimension > create_base_dimensions(const string &init_dimensions)
Creates the base dimensions from an initialization string of dimensions.
mole(const percentage &new_percentage, const mole &new_mole)
mass(const percentage &new_percentage, const mass &new_mass)
vector< dimension > create_dimensions(string init_dimensions)
Creates the dimensions from an initialization string of dimensions.
#define SCALAR_UNIT_CPP(name, init_real_dimensions)