RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
SystemMemoryInformation.h
Go to the documentation of this file.
1#pragma once
2#include "../Common.h"
3
4namespace RumPi
5{
13 {
14 protected:
22
34
35 public:
47
64 SystemMemoryInformation(const long systemMemoryTotalInKB, const long systemMemoryFreeInKB, const long systemMemoryAvailableInKB, const long systemSwapMemoryTotalInKB, const long systemSwapMemoryFreeInKB);
65
77 virtual ~SystemMemoryInformation() = default;
78
91 std::string ToString() const;
92
105 long GetSystemMemoryTotalInKB() const;
106
119 long GetSystemMemoryFreeInKB() const;
120
133 long GetSystemMemoryAvailableInKB() const;
134
147 float GetAvailableMemoryPercent() const;
148
161 long GetSystemSwapMemoryTotalInKB() const;
162
175 long GetSystemSwapMemoryFreeInKB() const;
176
189 float GetSwapMemoryUsedPercent() const;
190
203 void SetSystemMemoryTotalInKB(const long systemMemoryTotalInKB);
204
217 void SetSystemMemoryFreeInKB(const long systemMemoryFreeInKB);
218
231 void SetSystemMemoryAvailableInKB(const long systemMemoryAvailableInKB);
232
245 void SetSystemSwapMemoryTotalInKB(const long systemSwapMemoryTotalInKB);
246
259 void SetSystemSwapMemoryFreeInKB(const long systemSwapMemoryFreeInKB);
260 };
261} // namespace RumPi
Data class that contains information about the system's memory and swap space, in Kilobytes.
Definition: SystemMemoryInformation.h:13
long mySystemMemoryAvailableInKB
Available system memory, in KB.
Definition: SystemMemoryInformation.h:17
virtual ~SystemMemoryInformation()=default
Defaulted destructor.
void SetSystemMemoryAvailableInKB(const long systemMemoryAvailableInKB)
Sets the available system memory (in KB) and recomputes the derived percentages.
Definition: SystemMemoryInformation.cpp:248
long mySystemMemoryTotalInKB
Total system memory, in KB.
Definition: SystemMemoryInformation.h:15
long GetSystemMemoryAvailableInKB() const
Gets the available system memory, in KB.
Definition: SystemMemoryInformation.cpp:126
long mySystemMemoryFreeInKB
Free system memory, in KB.
Definition: SystemMemoryInformation.h:16
void SetSystemMemoryFreeInKB(const long systemMemoryFreeInKB)
Sets the free system memory, in KB.
Definition: SystemMemoryInformation.cpp:231
long GetSystemMemoryTotalInKB() const
Gets the total system memory, in KB.
Definition: SystemMemoryInformation.cpp:92
void CalculatePercentages()
Recomputes the available-memory percent and the used-swap percent from the current memory and swap fi...
Definition: SystemMemoryInformation.cpp:65
float GetAvailableMemoryPercent() const
Gets the percent of system memory available.
Definition: SystemMemoryInformation.cpp:143
float myAvailableMemoryPercent
Percent of system memory available (computed).
Definition: SystemMemoryInformation.h:18
SystemMemoryInformation()
Builds an empty SystemMemoryInformation with all fields zeroed.
Definition: SystemMemoryInformation.cpp:15
long mySystemSwapMemoryFreeInKB
Free swap memory, in KB.
Definition: SystemMemoryInformation.h:20
void SetSystemSwapMemoryFreeInKB(const long systemSwapMemoryFreeInKB)
Sets the free swap memory (in KB) and recomputes the derived percentages.
Definition: SystemMemoryInformation.cpp:287
long GetSystemSwapMemoryFreeInKB() const
Gets the free swap memory, in KB.
Definition: SystemMemoryInformation.cpp:177
long GetSystemMemoryFreeInKB() const
Gets the free system memory, in KB.
Definition: SystemMemoryInformation.cpp:109
void SetSystemMemoryTotalInKB(const long systemMemoryTotalInKB)
Sets the total system memory (in KB) and recomputes the derived percentages.
Definition: SystemMemoryInformation.cpp:211
float GetSwapMemoryUsedPercent() const
Gets the percent of swap memory used.
Definition: SystemMemoryInformation.cpp:194
long GetSystemSwapMemoryTotalInKB() const
Gets the total swap memory, in KB.
Definition: SystemMemoryInformation.cpp:160
long mySystemSwapMemoryTotalInKB
Total swap memory, in KB.
Definition: SystemMemoryInformation.h:19
std::string ToString() const
Serializes the memory and swap figures and their derived percentages to a string.
Definition: SystemMemoryInformation.cpp:307
float mySwapMemoryUsedPercent
Percent of swap memory used (computed).
Definition: SystemMemoryInformation.h:21
void SetSystemSwapMemoryTotalInKB(const long systemSwapMemoryTotalInKB)
Sets the total swap memory (in KB) and recomputes the derived percentages.
Definition: SystemMemoryInformation.cpp:268
RumPi is the library's top-level facade.
Definition: AlertManager.h:6