ManaPlus
packetcounters.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef NET_PACKETCOUNTERS_H
25 #define NET_PACKETCOUNTERS_H
26 
27 #include "localconsts.h"
28 
30 {
31  public:
33  { }
34 
36 
37  static void incInBytes(const int cnt);
38 
39  static void incInPackets();
40 
41  static int getInBytes() A_WARN_UNUSED;
42 
43  static int getInPackets() A_WARN_UNUSED;
44 
45  static void incOutBytes(const int cnt);
46 
47  static void incOutPackets();
48 
49  static int getOutBytes() A_WARN_UNUSED;
50 
51  static int getOutPackets() A_WARN_UNUSED;
52 
53  static void update();
54 
55  static int mInCurrentSec;
56  static int mInBytes;
57  static int mInBytesCalc;
58  static int mInPackets;
59  static int mInPacketsCalc;
60  static int mOutCurrentSec;
61  static int mOutBytes;
62  static int mOutBytesCalc;
63  static int mOutPackets;
64  static int mOutPacketsCalc;
65 
66  private:
67  static void updateCounter(int &restrict currentSec,
68  int &restrict calc,
69  int &restrict counter);
70 };
71 
72 #endif // NET_PACKETCOUNTERS_H
static int mOutBytesCalc
static int getOutBytes()
static void incInBytes(const int cnt)
static void update()
static int mOutPacketsCalc
static int mInBytesCalc
static int mOutPackets
static void updateCounter(int &currentSec, int &calc, int &counter)
static int getInPackets()
static void incInPackets()
static int mOutBytes
static int mInPackets
static int getInBytes()
static int getOutPackets()
static void incOutBytes(const int cnt)
static int mInPacketsCalc
static int mOutCurrentSec
static int mInBytes
static int mInCurrentSec
static void incOutPackets()
#define restrict
Definition: localconsts.h:165
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53