plugin-mobility: Correcting implementation to work with the latest NS-3 version (3.15-dev)
diff --git a/plugins/mobility/highway-position-allocator.cc b/plugins/mobility/highway-position-allocator.cc
index 9ad52ba..03c9d27 100644
--- a/plugins/mobility/highway-position-allocator.cc
+++ b/plugins/mobility/highway-position-allocator.cc
@@ -55,13 +55,13 @@
return tid;
}
-HighwayPositionAllocator::HighwayPositionAllocator (){
- m_previous_position = Vector(0.0, 0.0, 0.0);
+HighwayPositionAllocator::HighwayPositionAllocator ()
+ : m_previous_position (Vector (0.0, 0.0, 0.0))
+{
}
Vector HighwayPositionAllocator::GetNext (void) const{
- UniformVariable random_gap_var (1.0, 10.0);
- double random_gap = random_gap_var.GetValue();
+ double random_gap = m_random_gap_var.GetValue (1.0, 10.0);
double delta_x = random_gap * cos(m_direction);
double delta_y = random_gap * sin(m_direction);
@@ -100,4 +100,12 @@
return m_length;
}
+
+int64_t
+HighwayPositionAllocator::AssignStreams (int64_t stream)
+{
+ m_random_gap_var.SetStream (stream);
+ return 1;
+}
+
}
diff --git a/plugins/mobility/highway-position-allocator.h b/plugins/mobility/highway-position-allocator.h
index 4028b4a..be0b219 100644
--- a/plugins/mobility/highway-position-allocator.h
+++ b/plugins/mobility/highway-position-allocator.h
@@ -42,11 +42,15 @@
void SetLength(double length);
double GetLength(void) const ;
+ virtual int64_t AssignStreams (int64_t stream);
+
private:
mutable Vector m_previous_position; // previously generated vehicle position
Vector m_start; // highway starting point
double m_direction; //highway direction
double m_length; // highway length
+
+ mutable UniformRandomVariable m_random_gap_var;
};
}