diff --git a/src/node/ns2-mobility-file-topology.cc b/src/node/ns2-mobility-file-topology.cc index ee44355b9..9845d62f0 100644 --- a/src/node/ns2-mobility-file-topology.cc +++ b/src/node/ns2-mobility-file-topology.cc @@ -27,18 +27,18 @@ #include #include -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 -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 ()); } diff --git a/src/node/ns2-mobility-file-topology.h b/src/node/ns2-mobility-file-topology.h index 7d08bad26..1bcc1a5fe 100644 --- a/src/node/ns2-mobility-file-topology.h +++ b/src/node/ns2-mobility-file-topology.h @@ -18,8 +18,8 @@ * * Author: Mathieu Lacage */ -#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 #include @@ -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 void Layout (T begin, T end) const; private: @@ -56,7 +82,7 @@ namespace ns3 { template 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 */ diff --git a/utils/mobility-generator.cc b/utils/mobility-generator.cc index dc6815ed9..7c7a7159c 100644 --- a/utils/mobility-generator.cc +++ b/utils/mobility-generator.cc @@ -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--;