00001 /*************************************************************************** 00002 ** 00003 ** This file is part of waranrouted. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created : 2009-08-21 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef FLOWMEASUREMENT_H 00028 #define FLOWMEASUREMENT_H 00029 00030 class FlowMeasurement 00031 { 00032 public: 00033 FlowMeasurement(); 00034 00035 void setSendByteCount(int byteCount) {_sendByteCount=byteCount;} 00036 int sendByteCount() const {return _sendByteCount;} 00037 00038 void setReceiveByteCount(int byteCount) {_receiveByteCount=byteCount;} 00039 int receiveByteCount() const {return _receiveByteCount;} 00040 00041 void resetPacketCount() {_packetCount=0;} 00042 void addPacket() {_packetCount++;} 00043 int packetCount() const {return _packetCount;} 00044 00045 void setReceiveRate(double kbpersec) {_receiveRate=kbpersec;} 00046 double receiveRate() const {return _receiveRate;} 00047 00048 void setSendRate(double kbpersec) {_sendRate=kbpersec;} 00049 double sendRate() const {return _sendRate;} 00050 00051 void setGlobalTime(double t) {_globalTime=t;} 00052 double globalTime() const {return _globalTime;} 00053 00054 enum Status {Reset, InitFailed, Receiving, Successful}; 00055 void setStatus(Status s) {_status=s;} 00056 Status status() const {return _status;} 00057 00058 void toLog() const; 00059 private: 00060 Status _status; 00061 int _sendByteCount, _receiveByteCount; 00062 int _packetCount; 00063 double _receiveRate, _sendRate; 00064 double _globalTime; 00065 }; 00066 00067 #endif // FLOWMEASUREMENT_H