Index: src/stats/model/event-driven-collector.h |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/src/stats/model/event-driven-collector.h |
@@ -0,0 +1,77 @@ |
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
+/* |
+ * Copyright (c) 2015 Bucknell University |
+ * |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 2 as |
+ * published by the Free Software Foundation; |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ * Author: Li Li (ll024@bucknell.edu) |
+ */ |
+ |
+ |
+#ifndef EVENT_DRIVEN_COLLECTOR_H |
+#define EVENT_DRIVEN_COLLECTOR_H |
+ |
+#include "ns3/object.h" |
+#include "ns3/collector.h" |
+#include "ns3/event-id.h" |
+#include "ns3/type-id.h" |
+#include "ns3/traced-value.h" |
+ |
+namespace ns3 { |
+ |
+/** |
+ * \ingroup collectors |
+ * \brief Collector class used to collect a single trace source of |
+ * double-valued data and output the data to downstream objects. |
+ */ |
+class EventDrivenCollector : public Collector |
+{ |
+public: |
+ /** |
+ * \brief Get the type ID |
+ * \return the object TypeId |
+ */ |
+ static TypeId GetTypeId (void); |
+ |
+ /** |
+ * \brief Constructs a EventDrivenCollector object |
+ */ |
+ EventDrivenCollector (); |
+ virtual ~EventDrivenCollector (); |
+ |
+ /** |
+ * \brief Collects the double values produced by the upstream probes |
+ * |
+ * \param oldValue previous value produced by a Probe |
+ * \param newValue new value produced by a Probe |
+ */ |
+ void TraceSinkDouble (double oldValue, double newValue); |
+ |
+private: |
+ // the output data trace source |
+ TracedCallback<double, double> m_output; |
+ |
+ /** |
+ * \brief Reports data to downstream objects |
+ */ |
+ void ReportData (void); |
+ |
+ // a double value to keep track of the double value |
+ // received by the trace sink |
+ double m_doubleValue; |
+}; |
+ |
+} //namespace ns3 |
+ |
+#endif // EVENT_DRIVEN_COLLECTOR_H |