Elements  5.12
A C++ base framework for the Euclid Software.
Storage.h
Go to the documentation of this file.
1 
26 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_H_
27 #define ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_H_
28 
29 #include <string> // for string
30 #include <map> // for map
31 #include <cstdint> // for int64_t
32 
33 #include "ElementsKernel/Export.h"
34 
35 namespace Elements {
36 namespace Units {
37 
38 enum class StorageType {
39  Byte,
40  KiloByte,
41  MegaByte,
42  GigaByte,
43  TeraByte,
44  PetaByte,
45  MetricKiloByte,
46  MetricMegaByte,
47  MetricGigaByte,
48  MetricTeraByte,
50 };
51 
54 
55 template<typename T>
56 ELEMENTS_API T roundToDigits(const T& value, const std::size_t& max_digits);
57 // explicit instantiation:
58 extern template
59 ELEMENTS_API double roundToDigits<double>(const double& value, const std::size_t& max_digits);
60 extern template
61 ELEMENTS_API float roundToDigits<float>(const float& value, const std::size_t& max_digits);
62 
63 template<std::size_t max_digits, typename T>
64 ELEMENTS_API T storageConvert(const T& size, StorageType source_unit, StorageType target_unit);
65 
66 template<typename T>
68 storageConvert(const T& size, StorageType source_unit, StorageType target_unit);
69 // explicit instantiation:
70 extern template
72 storageConvert<double>(const double& size, StorageType source_unit, StorageType target_unit);
73 extern template
75 storageConvert<float>(const float& size, StorageType source_unit, StorageType target_unit);
76 extern template
78 storageConvert<std::int64_t>(const std::int64_t& size, StorageType source_unit, StorageType target_unit);
79 
80 
81 } // namespace Units
82 } // namespace Elements
83 
84 #define ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_IMPL_
86 #undef ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_IMPL_
87 
88 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_H_
89 
Elements::Units::StorageType::Byte
@ Byte
Export.h
defines the macros to be used for explicit export of the symbols
Storage.icpp
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
std::int64_t
std::map
STL class.
Elements::Units::roundToDigits< double >
template ELEMENTS_API double roundToDigits< double >(const double &value, const std::size_t &max_digits)
Elements::Units::roundToDigits< float >
template ELEMENTS_API float roundToDigits< float >(const float &value, const std::size_t &max_digits)
Elements::Units::roundToDigits
ELEMENTS_API T roundToDigits(const T &value, const std::size_t &max_digits)
Elements::Units::storageConvert< double >
template ELEMENTS_API double storageConvert< double >(const double &size, StorageType source_unit, StorageType target_unit)
Elements::Units::StorageShortName
ELEMENTS_API std::map< StorageType, std::string > StorageShortName
Definition: Storage.cpp:37
std::size_t
Elements::Units::StorageFactor
ELEMENTS_API std::map< StorageType, std::int64_t > StorageFactor
Definition: Storage.cpp:49
Elements::Units::StorageType
StorageType
Definition: Storage.h:38
Elements::Units::storageConvert
ELEMENTS_API T storageConvert(const T &size, StorageType source_unit, StorageType target_unit)
Elements::Units::storageConvert< float >
template ELEMENTS_API float storageConvert< float >(const float &size, StorageType source_unit, StorageType target_unit)
Elements
Definition: Auxiliary.h:43