00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2008 Drexel University 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Joe Kopena (tjkopena@cs.drexel.edu) 00019 */ 00020 00021 #ifndef __TIME_DATA_CALCULATORS_H__ 00022 #define __TIME_DATA_CALCULATORS_H__ 00023 00024 #include "ns3/nstime.h" 00025 00026 #include "data-calculator.h" 00027 #include "data-output-interface.h" 00028 00029 namespace ns3 { 00030 00031 //------------------------------------------------------------ 00032 //-------------------------------------------- 00033 /** 00034 * Unfortunately, templating the base MinMaxAvgTotalCalculator to 00035 * operate over Time values isn't straightforward. The main issues 00036 * are setting the maximum value, which can be worked around easily 00037 * as it done here, and dividing to get the average, which is not as 00038 * easily worked around. 00039 */ 00040 class TimeMinMaxAvgTotalCalculator : public DataCalculator { 00041 public: 00042 TimeMinMaxAvgTotalCalculator(); 00043 virtual ~TimeMinMaxAvgTotalCalculator(); 00044 00045 void Update(const Time i); 00046 00047 virtual void Output(DataOutputCallback &callback) const; 00048 00049 protected: 00050 virtual void DoDispose(void); 00051 00052 uint32_t m_count; 00053 Time m_total, m_min, m_max; 00054 00055 // end class TimeMinMaxAvgTotalCalculator 00056 }; 00057 00058 // end namespace ns3 00059 }; 00060 00061 00062 #endif // __TIME_DATA_CALCULATORS_H__