Elements  6.2
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 <cstdint> // for int64_t
30 #include <map> // for map
31 #include <string> // for string
32 
33 #include "ElementsKernel/Export.h"
34 
35 namespace Elements {
36 inline namespace Kernel {
37 namespace Units {
38 
39 enum class StorageType {
40  Byte,
41  KiloByte,
42  MegaByte,
43  GigaByte,
44  TeraByte,
45  PetaByte,
51 };
52 
55 
56 template <typename T>
57 ELEMENTS_API T roundToDigits(const T& value, const std::size_t& max_digits);
58 // explicit instantiation:
59 extern template ELEMENTS_API double roundToDigits<double>(const double& value, const std::size_t& max_digits);
60 extern template ELEMENTS_API float roundToDigits<float>(const float& value, const std::size_t& max_digits);
61 
62 template <std::size_t max_digits, typename T>
63 ELEMENTS_API T storageConvert(const T& size, StorageType source_unit, StorageType target_unit);
64 
65 template <typename T>
66 ELEMENTS_API T storageConvert(const T& size, StorageType source_unit, StorageType target_unit);
67 // explicit instantiation:
68 extern template ELEMENTS_API double storageConvert<double>(const double& size, StorageType source_unit,
69  StorageType target_unit);
70 extern template ELEMENTS_API float storageConvert<float>(const float& size, StorageType source_unit,
71  StorageType target_unit);
72 extern template ELEMENTS_API std::int64_t
73 storageConvert<std::int64_t>(const std::int64_t& size, StorageType source_unit, StorageType target_unit);
74 
75 } // namespace Units
76 } // namespace Kernel
77 } // namespace Elements
78 
79 #define ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_IMPL_
81 #undef ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_IMPL_
82 
83 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_STORAGE_H_
84 
Elements::Kernel::Units::StorageType::KiloByte
@ KiloByte
Elements::Kernel::Units::roundToDigits< double >
template ELEMENTS_API double roundToDigits< double >(const double &value, const std::size_t &max_digits)
Export.h
defines the macros to be used for explicit export of the symbols
Elements::Kernel::Units::StorageFactor
ELEMENTS_API std::map< StorageType, std::int64_t > StorageFactor
Definition: Storage.cpp:50
Elements::Kernel::Units::StorageType::MetricGigaByte
@ MetricGigaByte
Elements::Kernel::Units::StorageType::MetricKiloByte
@ MetricKiloByte
Elements::Kernel::Units::StorageType::MegaByte
@ MegaByte
Elements::Kernel::Units::roundToDigits
ELEMENTS_API T roundToDigits(const T &value, const std::size_t &max_digits)
Elements::Kernel::Units::StorageType
StorageType
Definition: Storage.h:39
Elements::Kernel::Units::StorageType::PetaByte
@ PetaByte
Elements::Kernel::Units::storageConvert< double >
template ELEMENTS_API double storageConvert< double >(const double &size, StorageType source_unit, StorageType target_unit)
Elements::Kernel::Units::StorageType::MetricTeraByte
@ MetricTeraByte
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
Elements::Kernel::Units::StorageType::GigaByte
@ GigaByte
Elements::Kernel::Units::StorageType::MetricMegaByte
@ MetricMegaByte
std::int64_t
std::map
STL class.
Elements::Kernel::Units::roundToDigits< float >
template ELEMENTS_API float roundToDigits< float >(const float &value, const std::size_t &max_digits)
Elements::Kernel::Units::StorageType::MetricPetaByte
@ MetricPetaByte
Elements::Kernel::Units::storageConvert< float >
template ELEMENTS_API float storageConvert< float >(const float &size, StorageType source_unit, StorageType target_unit)
Elements::Kernel::Units::StorageShortName
ELEMENTS_API std::map< StorageType, std::string > StorageShortName
Definition: Storage.cpp:38
Elements::Kernel::Units::storageConvert
ELEMENTS_API T storageConvert(const T &size, StorageType source_unit, StorageType target_unit)
Storage.tpp
std::size_t
Elements::Kernel::Units::StorageType::TeraByte
@ TeraByte
Elements::Kernel::Units::StorageType::Byte
@ Byte
Elements
Definition: callBackExample.h:35