src/contrib/stats/data-calculator.cc
changeset 3570 44b0bc6817c6
child 3576 f6abfdf47163
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/contrib/stats/data-calculator.cc	Fri Aug 29 13:22:09 2008 -0400
@@ -0,0 +1,110 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 Drexel 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: Joe Kopena (tjkopena@cs.drexel.edu)
+ */
+
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+
+#include "data-calculator.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE("DataCalculator");
+
+
+//--------------------------------------------------------------
+//----------------------------------------------
+DataCalculator::DataCalculator() :
+  m_enabled(true)
+{
+  NS_LOG_FUNCTION_NOARGS();
+}
+
+DataCalculator::~DataCalculator()
+{
+  NS_LOG_FUNCTION_NOARGS();
+}
+
+void
+DataCalculator::DoDispose(void)
+{
+  NS_LOG_FUNCTION_NOARGS();
+
+  Simulator::Cancel(m_startEvent);
+  Simulator::Cancel(m_stopEvent);
+
+  Object::DoDispose();
+  // DataCalculator::DoDispose
+}
+
+//----------------------------------------------
+void
+DataCalculator::SetKey(const std::string key)
+{
+  m_key = key;
+  // end DataCalculator::SetKey
+}
+
+const std::string
+DataCalculator::GetKey() const
+{
+  return m_key;
+  // end DataCalculator::GetKey
+}
+
+//----------------------------------------------
+void
+DataCalculator::Enable()
+{
+  m_enabled = true;
+  // end DataCalculator::Enable
+}
+
+void
+DataCalculator::Disable()
+{
+  m_enabled = false;
+  // end DataCalculator::Disable
+}
+
+bool
+DataCalculator::GetEnabled() const
+{
+  return m_enabled;
+  // end DataCalculator::GetEnabled
+}
+
+//----------------------------------------------
+void
+DataCalculator::Start(const Time& startTime)
+{
+
+  m_startEvent = Simulator::Schedule(startTime,
+                                     &DataCalculator::Enable, this);
+
+  // end DataCalculator::Start
+}
+
+void
+DataCalculator::Stop(const Time& stopTime)
+{
+  m_stopEvent = Simulator::Schedule(stopTime,
+                                    &DataCalculator::Disable, this);
+  // end DataCalculator::Stop
+}