Face Engine SDK
5.23.1
A face detection, recognition and tracking engine.
|
00001 #pragma once 00002 00003 #include <cstddef> 00004 #include <utility> 00005 00006 namespace fsdk { 00009 struct Sizer { 00010 00013 Sizer() noexcept { 00014 reset(); 00015 } 00016 00020 Sizer(const Sizer& other) noexcept { 00021 *this = other; 00022 } 00023 00027 void append(size_t bytes) noexcept { 00028 m_bytes += bytes; 00029 } 00030 00034 void append(const Sizer& other) noexcept { 00035 append(other.m_bytes); 00036 } 00037 00039 void reset() noexcept { 00040 m_bytes = 0u; 00041 } 00042 00046 size_t getBytes() const noexcept { 00047 return m_bytes; 00048 } 00049 00053 size_t getKBytes() const noexcept { 00054 return getBytes() >> 10; 00055 } 00056 00060 size_t getMBytes() const noexcept { 00061 return getKBytes() >> 10; 00062 } 00063 00067 size_t getGBytes() const noexcept { 00068 return getMBytes() >> 10; 00069 } 00070 00072 operator size_t() const noexcept { 00073 return m_bytes; 00074 } 00075 00079 bool isEmpty() const noexcept { 00080 return m_bytes == 0u; 00081 } 00082 00086 operator bool() const noexcept { 00087 return !isEmpty(); 00088 } 00089 00094 Sizer& operator<<(size_t bytes) noexcept { 00095 append(bytes); 00096 return *this; 00097 } 00098 00103 Sizer& operator<<(const Sizer& other) noexcept { 00104 append(other); 00105 return *this; 00106 } 00107 00112 Sizer& operator=(const Sizer& other) noexcept { 00113 m_bytes = other.m_bytes; 00114 return *this; 00115 } 00116 00121 bool operator==(const Sizer& other) const noexcept { 00122 return m_bytes == other.m_bytes; 00123 } 00124 00129 bool operator!=(const Sizer& other) const noexcept { 00130 return !(*this == other); 00131 } 00132 00136 void swap(Sizer& other) noexcept { 00137 std::swap(m_bytes, other.m_bytes); 00138 } 00139 00140 protected: 00141 size_t m_bytes; 00142 }; 00143 } // namespace fsdk