File: status.h

package info (click to toggle)
nload 0.4.0-1.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 360 kB
  • ctags: 104
  • sloc: sh: 2,643; cpp: 975; makefile: 60; ansic: 4
file content (64 lines) | stat: -rw-r--r-- 1,760 bytes parent folder | download
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
63
64
/***************************************************************************
                          status.h  -  description
                             -------------------
    begin                : Sat Sep 29 2001
    copyright            : (C) 2001 by Roland Riegel
    email                : support@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 STATUS_H
#define STATUS_H

#include <iostream.h>
#include <curses.h>
#include <limits.h>
#include <math.h>

class Status
{

public:
	Status();
	~Status();
	
	enum status_format
	{
		human_readable = -1,
		bit = 0,
		kilobit = 1,
		megabit = 2,
		gigabit = 3
	};
	
	void update( int, unsigned int );
	void print( int, int, status_format, status_format );
	void resetTrafficData();
	
	void setAverageSmoothness( int );
	void setWindow( WINDOW * );
	
private:
	void minMax( int );
	void average( int );
	
	const char* getUnitString( status_format, long long, bool );
	int getUnitFactor( status_format, long long );
	
	int m_min, m_max, m_average, m_cur;
	long long m_total;
	int m_averagesmoothness;
	
	WINDOW *m_window;

};

#endif