Elements  5.12.0
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,
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 
defines the macros to be used for explicit export of the symbols
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
ELEMENTS_API T roundToDigits(const T &value, const std::size_t &max_digits)
ELEMENTS_API std::map< StorageType, std::int64_t > StorageFactor
Definition: Storage.cpp:49
template ELEMENTS_API double storageConvert< double >(const double &size, StorageType source_unit, StorageType target_unit)
ELEMENTS_API T storageConvert(const T &size, StorageType source_unit, StorageType target_unit)
template ELEMENTS_API double roundToDigits< double >(const double &value, const std::size_t &max_digits)
template ELEMENTS_API float roundToDigits< float >(const float &value, const std::size_t &max_digits)
ELEMENTS_API std::map< StorageType, std::string > StorageShortName
Definition: Storage.cpp:37
template ELEMENTS_API float storageConvert< float >(const float &size, StorageType source_unit, StorageType target_unit)