summaryrefslogtreecommitdiff
path: root/plugins/HistoryStats/src/inout.h
blob: 2718a1cc492e10ee69229d4293558c02f2dba429 (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
#if !defined(HISTORYSTATS_GUARD_INOUT_H)
#define HISTORYSTATS_GUARD_INOUT_H

class InOut
{
public:
	int in;
	int out;

public:
	InOut()
		: in(0), out(0)
	{
	}

	InOut(int initIn, int initOut)
		: in(initIn), out(initOut)
	{
	}

	InOut& operator +=(const InOut& other)
	{
		in += other.in;
		out += other.out;

		return *this;
	}

	int total() const
	{
		return in + out;
	}

	int operator <(const InOut& other) const
	{
		return total() < other.total();
	}

	int operator >(const InOut& other) const
	{
		return total() > other.total();
	}

	int operator !=(const InOut& other) const
	{
		return total() != other.total();
	}
};

#endif // HISTORYSTATS_GUARD_INOUT_H