summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/HistoryStats/inout.h
blob: e7405f46afa153c4848386a3b8c5798092a84a6e (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;
	}

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

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

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

#endif // HISTORYSTATS_GUARD_INOUT_H