Ns2Mobile -> Ns2Mobility
This commit is contained in:
@@ -27,18 +27,18 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
NS_DEBUG_COMPONENT_DEFINE ("Ns2MobileFileTopology");
|
||||
NS_DEBUG_COMPONENT_DEFINE ("Ns2MobilityFileTopology");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
Ns2MobileFileTopology::Ns2MobileFileTopology (std::string filename)
|
||||
Ns2MobilityFileTopology::Ns2MobilityFileTopology (std::string filename)
|
||||
: m_filename (filename)
|
||||
{}
|
||||
|
||||
|
||||
Ptr<StaticSpeedMobilityModel>
|
||||
Ns2MobileFileTopology::GetMobilityModel (std::string idString, const ObjectStore &store) const
|
||||
Ns2MobilityFileTopology::GetMobilityModel (std::string idString, const ObjectStore &store) const
|
||||
{
|
||||
std::istringstream iss;
|
||||
iss.str (idString);
|
||||
@@ -60,7 +60,7 @@ Ns2MobileFileTopology::GetMobilityModel (std::string idString, const ObjectStore
|
||||
}
|
||||
|
||||
double
|
||||
Ns2MobileFileTopology::ReadDouble (std::string valueString) const
|
||||
Ns2MobilityFileTopology::ReadDouble (std::string valueString) const
|
||||
{
|
||||
std::istringstream iss;
|
||||
iss.str (valueString);
|
||||
@@ -70,7 +70,7 @@ Ns2MobileFileTopology::ReadDouble (std::string valueString) const
|
||||
}
|
||||
|
||||
void
|
||||
Ns2MobileFileTopology::LayoutObjectStore (const ObjectStore &store) const
|
||||
Ns2MobilityFileTopology::LayoutObjectStore (const ObjectStore &store) const
|
||||
{
|
||||
std::ifstream file (m_filename.c_str (), std::ios::in);
|
||||
if (file.is_open())
|
||||
@@ -137,7 +137,7 @@ Ns2MobileFileTopology::LayoutObjectStore (const ObjectStore &store) const
|
||||
}
|
||||
|
||||
void
|
||||
Ns2MobileFileTopology::Layout (void) const
|
||||
Ns2MobilityFileTopology::Layout (void) const
|
||||
{
|
||||
Layout (NodeList::Begin (), NodeList::End ());
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#ifndef NS2_MOBILE_FILE_TOPOLOGY_H
|
||||
#define NS2_MOBILE_FILE_TOPOLOGY_H
|
||||
#ifndef NS2_MOBILITY_FILE_TOPOLOGY_H
|
||||
#define NS2_MOBILITY_FILE_TOPOLOGY_H
|
||||
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
@@ -29,12 +29,38 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Ns2MobileFileTopology
|
||||
/**
|
||||
* \brief a topology object which can read ns2's movement files
|
||||
* generated by the CMU setdest tool.
|
||||
*/
|
||||
class Ns2MobilityFileTopology
|
||||
{
|
||||
public:
|
||||
Ns2MobileFileTopology (std::string filename);
|
||||
/**
|
||||
* \param filename filename of file which contains the
|
||||
* ns2 movement trace.
|
||||
*/
|
||||
Ns2MobilityFileTopology (std::string filename);
|
||||
|
||||
/**
|
||||
* Read the ns2 trace file and configure the movement
|
||||
* patterns of all nodes contained in the global ns3::NodeList
|
||||
* whose nodeId is matches the nodeId of the nodes in the trace
|
||||
* file.
|
||||
*/
|
||||
void Layout (void) const;
|
||||
|
||||
/**
|
||||
* \param begin an iterator which points to the start of the input
|
||||
* object array.
|
||||
* \param end an iterator which points to the end of the input
|
||||
* object array.
|
||||
*
|
||||
* Read the ns2 trace file and configure the movement
|
||||
* patterns of all input objects. Each input object
|
||||
* is identified by a unique node id which reflects
|
||||
* the index of the object in the input array.
|
||||
*/
|
||||
template <typename T>
|
||||
void Layout (T begin, T end) const;
|
||||
private:
|
||||
@@ -56,7 +82,7 @@ namespace ns3 {
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
Ns2MobileFileTopology::Layout (T begin, T end) const
|
||||
Ns2MobilityFileTopology::Layout (T begin, T end) const
|
||||
{
|
||||
class MyObjectStore : public ObjectStore
|
||||
{
|
||||
@@ -84,4 +110,4 @@ Ns2MobileFileTopology::Layout (T begin, T end) const
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* NS2_MOBILE_FILE_TOPOLOGY_H */
|
||||
#endif /* NS2_MOBILITY_FILE_TOPOLOGY_H */
|
||||
|
||||
@@ -54,7 +54,7 @@ int main (int argc, char *argv[])
|
||||
strlen ("--ns2-topology=")) == 0)
|
||||
{
|
||||
const char *filename = *argv + strlen ("--ns2-topology=");
|
||||
Ns2MobileFileTopology topology (filename);
|
||||
Ns2MobilityFileTopology topology (filename);
|
||||
topology.Layout (objects.begin (), objects.end ());
|
||||
}
|
||||
argc--;
|
||||
|
||||
Reference in New Issue
Block a user