Elements  5.8
A C++ base framework for the Euclid Software.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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>
67 ELEMENTS_API T storageConvert(const T& size, StorageType source_unit, StorageType target_unit);
68 // explicit instantiation:
69 extern template
70 ELEMENTS_API double storageConvert<double>(const double& size, StorageType source_unit, StorageType target_unit);
71 extern template
72 ELEMENTS_API float storageConvert<float>(const float& size, StorageType source_unit, StorageType target_unit);
73 extern template
74 ELEMENTS_API std::int64_t storageConvert<std::int64_t>(const std::int64_t& size, StorageType source_unit, StorageType target_unit);
75 
76 
77 } // namespace Units
78 } // namespace Elements
79 
81 
82 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_H_
83 
template ELEMENTS_API float storageConvert< float >(const float &size, StorageType source_unit, StorageType target_unit)
STL class.
ELEMENTS_API std::map< StorageType, std::string > StorageShortName
Definition: Storage.cpp:37
defines the macros to be used for explicit export of the symbols
template ELEMENTS_API double roundToDigits< double >(const double &value, const std::size_t &max_digits)
ELEMENTS_API T roundToDigits(const T &value, const size_t &max_digits)
Definition: Storage.icpp:35
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
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)
Definition: Storage.icpp:41
template ELEMENTS_API float roundToDigits< float >(const float &value, const std::size_t &max_digits)
ELEMENTS_API std::map< StorageType, std::int64_t > StorageFactor
Definition: Storage.cpp:49