summaryrefslogtreecommitdiff
path: root/src/device.h
blob: 25d82119e96b67592eefb3679dc528df31db758a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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