diff options
| author | 2020-02-06 11:25:42 +0000 | |
|---|---|---|
| committer | 2020-02-06 11:25:42 +0000 | |
| commit | 98e4ddfb21d285c8b675788c155bb204822fbd4a (patch) | |
| tree | 030eb18c989bf3c9e4768a538796e3221ca7934e /include/socketengine.h | |
| parent | In C++11 [io]fstream has std::string constructors; use them. (diff) | |
Use C++11 inline initialisation for class members.
Diffstat (limited to 'include/socketengine.h')
| -rw-r--r-- | include/socketengine.h | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/include/socketengine.h b/include/socketengine.h index e54dfca97..0d0108038 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -232,20 +232,15 @@ class CoreExport SocketEngine */ class Statistics { - mutable size_t indata; - mutable size_t outdata; - mutable time_t lastempty; + mutable size_t indata = 0; + mutable size_t outdata = 0; + mutable time_t lastempty = 0; /** Reset the byte counters and lastempty if there wasn't a reset in this second. */ void CheckFlush() const; public: - /** Constructor, initializes member vars except indata and outdata because those are set to 0 - * in CheckFlush() the first time Update() or GetBandwidth() is called. - */ - Statistics() : lastempty(0), TotalEvents(0), ReadEvents(0), WriteEvents(0), ErrorEvents(0) { } - /** Update counters for network data received. * This should be called after every read-type syscall. * @param len_in Number of bytes received, or -1 for error, as typically @@ -267,10 +262,10 @@ class CoreExport SocketEngine */ void CoreExport GetBandwidth(float& kbitpersec_in, float& kbitpersec_out, float& kbitpersec_total) const; - unsigned long TotalEvents; - unsigned long ReadEvents; - unsigned long WriteEvents; - unsigned long ErrorEvents; + unsigned long TotalEvents = 0; + unsigned long ReadEvents = 0; + unsigned long WriteEvents = 0; + unsigned long ErrorEvents = 0; }; private: |
