CBMC
memory_units.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Memory units
4 
5 Author: Hannes Steffenhagen
6 
7 \*******************************************************************/
8 
9 #ifndef CPROVER_UTIL_MEMORY_UNITS_H
10 #define CPROVER_UTIL_MEMORY_UNITS_H
11 
12 #include <cstddef>
13 #include <string>
14 
16 {
17 public:
18  static memory_sizet from_bytes(std::size_t bytes);
19 
20  memory_sizet();
21  memory_sizet(const memory_sizet &);
23 
25  memory_sizet &operator=(memory_sizet &&) noexcept;
26 
28  memory_sizet operator+(const memory_sizet &) const;
29 
30  std::size_t get_bytes() const;
31  std::size_t get_kibibytes() const;
32  std::size_t get_mebibytes() const;
33  std::size_t get_gibibytes() const;
34  std::string to_string() const;
35 
36  static const char *si_byte_symbol;
37  static const char *si_kibibyte_symbol;
38  static const char *si_mebibyte_symbol;
39  static const char *si_gibibyte_symbol;
40 
41 private:
42  std::size_t bytes;
43  explicit memory_sizet(std::size_t bytes);
44 };
45 
46 #endif // CPROVER_UTIL_MEMORY_UNITS_H
std::size_t get_bytes() const
std::size_t get_kibibytes() const
memory_sizet & operator=(const memory_sizet &)
static const char * si_gibibyte_symbol
Definition: memory_units.h:39
memory_sizet operator+(const memory_sizet &) const
std::string to_string() const
static const char * si_kibibyte_symbol
Definition: memory_units.h:37
std::size_t bytes
Definition: memory_units.h:42
std::size_t get_gibibytes() const
static const char * si_mebibyte_symbol
Definition: memory_units.h:38
static memory_sizet from_bytes(std::size_t bytes)
std::size_t get_mebibytes() const
memory_sizet & operator+=(const memory_sizet &)
static const char * si_byte_symbol
Definition: memory_units.h:36