OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2015 Bucknell University |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Author: Li Li (ll024@bucknell.edu) |
| 19 */ |
| 20 |
| 21 #ifndef SCALING_COLLECTOR_H |
| 22 #define SCALING_COLLECTOR_H |
| 23 |
| 24 #include "ns3/object.h" |
| 25 #include "ns3/collector.h" |
| 26 #include "ns3/event-id.h" |
| 27 #include "ns3/type-id.h" |
| 28 #include "ns3/traced-value.h" |
| 29 |
| 30 namespace ns3 { |
| 31 /** |
| 32 * \ingroup collectors |
| 33 * \brief Collector class used to multiply a single trace source of |
| 34 * double-valued data by a scaling factor and output the scaled value |
| 35 * to downstream objects |
| 36 */ |
| 37 class ScalingCollector : public Collector |
| 38 { |
| 39 public: |
| 40 /** |
| 41 * \brief Get the type ID |
| 42 * \return the object TypeId |
| 43 */ |
| 44 static TypeId GetTypeId (void); |
| 45 |
| 46 ScalingCollector (); |
| 47 virtual ~ScalingCollector (); |
| 48 |
| 49 /** |
| 50 * \brief Collects the double values produced by the upstream probes |
| 51 * |
| 52 * \param oldValue previous value produced by a Probe |
| 53 * \param newValue new value produced by a Probe |
| 54 */ |
| 55 void TraceSinkDouble (double oldValue, double newValue); |
| 56 |
| 57 private: |
| 58 // the output data trace source |
| 59 TracedCallback<double, double> m_output; |
| 60 |
| 61 /** |
| 62 * \brief Reports data to downstream objects |
| 63 */ |
| 64 void ReportData (void); |
| 65 |
| 66 // a double value to keep track of the double value |
| 67 // received by the trace sink |
| 68 double m_doubleValue; |
| 69 |
| 70 double m_scalingFactor; |
| 71 }; |
| 72 |
| 73 |
| 74 } //namespace ns3 |
| 75 |
| 76 #endif //SCALING_COLLECTOR_H |
OLD | NEW |