use CopyObject and not Create to copy RttMeanDeviation. Implement the copy constructor correctly.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 18 Apr 2008 14:35:38 -0700
changeset 2925 7149e19cada4
parent 2924 70a02c24d5eb
child 2973 e8d8a0650927
child 2988 8774a8c9526f
use CopyObject and not Create to copy RttMeanDeviation. Implement the copy constructor correctly.
src/internet-node/rtt-estimator.cc
src/internet-node/rtt-estimator.h
--- a/src/internet-node/rtt-estimator.cc	Fri Apr 18 14:35:10 2008 -0700
+++ b/src/internet-node/rtt-estimator.cc	Fri Apr 18 14:35:38 2008 -0700
@@ -74,12 +74,9 @@
   //note next=1 everywhere since first segment will have sequence 1
 }
 
-RttEstimator::RttEstimator (Time e) : next (1), history (), est (e),
-    nSamples (0), multiplier (1.0) 
-{ }
-
 RttEstimator::RttEstimator(const RttEstimator& c)
-  : next(c.next), history(c.history), est(c.est), nSamples(c.nSamples),
+  : Object (c), next(c.next), history(c.history), 
+    m_maxMultiplier (c.m_maxMultiplier), est(c.est), nSamples(c.nSamples),
     multiplier(c.multiplier)
 {}
 
@@ -144,6 +141,10 @@
 
 void RttEstimator::IncreaseMultiplier ()
 {
+  double a;
+  a = multiplier * 2.0;
+  double b;
+  b = m_maxMultiplier * 2.0;
   multiplier = std::min (multiplier * 2.0, m_maxMultiplier);
 }
 
@@ -223,7 +224,7 @@
 
 Ptr<RttEstimator> RttMeanDeviation::Copy () const
 {
-  return Create<RttMeanDeviation> (*this);
+  return CopyObject<RttMeanDeviation> (this);
 }
 
 void RttMeanDeviation::Reset ()
--- a/src/internet-node/rtt-estimator.h	Fri Apr 18 14:35:10 2008 -0700
+++ b/src/internet-node/rtt-estimator.h	Fri Apr 18 14:35:38 2008 -0700
@@ -51,7 +51,6 @@
   static TypeId GetTypeId (void);
 
   RttEstimator();
-  RttEstimator(Time e);
   RttEstimator(const RttEstimator&); // Copy constructor
   virtual ~RttEstimator();
 
@@ -71,7 +70,6 @@
   SequenceNumber        next;    // Next expected sequence to be sent
   RttHistory_t history; // List of sent packet
   double m_maxMultiplier;
-  Time m_initialEstimate;
 public:
   Time       est;     // Current estimate
   uint32_t      nSamples;// Number of samples