summaryrefslogtreecommitdiff
path: root/src/device.h
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2014-06-18 15:45:45 +0200
committerOlivier Gayot <duskcoder@gmail.com>2014-06-18 15:49:38 +0200
commit0e03940802cebefdf6b0597a154bd9395e1af4d2 (patch)
tree409a58499128227dd57943515d003074190551f5 /src/device.h
Add the vanilla version of the project
This version can still be found here: http://www.roland-riegel.de/nload/index.html
Diffstat (limited to 'src/device.h')
-rw-r--r--src/device.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/device.h b/src/device.h
new file mode 100644
index 0000000..25d8211
--- /dev/null
+++ b/src/device.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ device.h
+ -------------------
+ begin : Wed Aug 1 2001
+ copyright : (C) 2001 - 2012 by Roland Riegel
+ email : feedback@roland-riegel.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef DEVICE_H
+#define DEVICE_H
+
+#include "dataframe.h"
+#include "graph.h"
+#include "statistics.h"
+
+#include <string>
+
+class DevReader;
+class Window;
+
+class Device
+{
+ public:
+ explicit Device(DevReader& devReader);
+ ~Device();
+
+ void update();
+ void print(Window&);
+ void setDeviceNumber(int deviceNumber);
+ void setTotalNumberOfDevices(int totalNumberOfDevices);
+
+ private:
+ void fixOverflows(DataFrame& dataFrame, const DataFrame& dataFrameOld);
+ unsigned long long fixOverflow(unsigned long long value, unsigned long long valueOld);
+
+ void printTrafficValue(Window& window, int x, int y, const std::string& description, unsigned long long value);
+ void printDataValue(Window& window, int x, int y, const std::string& description, unsigned long long value);
+ void printStatisticsIn(Window& window, int x, int y);
+ void printStatisticsOut(Window& window, int x, int y);
+
+ int m_deviceNumber;
+ int m_totalNumberOfDevices;
+
+ Statistics m_deviceStatistics;
+ Graph m_deviceGraphIn;
+ Graph m_deviceGraphOut;
+
+ DataFrame m_dataFrameOld;
+ DevReader& m_devReader;
+};
+
+#endif
+