NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
annotated-topology-reader.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 // Based on the code by Hajime Tazaki <tazaki@sfc.wide.ad.jp>
21 
22 #ifndef __ANNOTATED_TOPOLOGY_READER_H__
23 #define __ANNOTATED_TOPOLOGY_READER_H__
24 
25 #include "ns3/topology-reader.h"
26 #include "ns3/random-variable.h"
27 #include "ns3/object-factory.h"
28 
29 namespace ns3 {
30 
36 class AnnotatedTopologyReader : public TopologyReader {
37 public:
46  AnnotatedTopologyReader(const std::string& path = "", double scale = 1.0);
47  virtual ~AnnotatedTopologyReader();
48 
56  virtual NodeContainer
57  Read();
58 
62  virtual NodeContainer
63  GetNodes() const;
64 
68  virtual const std::list<Link>&
69  GetLinks() const;
70 
80  virtual void
81  AssignIpv4Addresses(Ipv4Address base);
82 
90  virtual void
91  SetBoundingBox(double ulx, double uly, double lrx, double lry);
92 
97  virtual void
98  SetMobilityModel(const std::string& model);
99 
103  virtual void
104  ApplyOspfMetric();
105 
109  virtual void
110  SaveTopology(const std::string& file);
111 
115  virtual void
116  SaveGraphviz(const std::string& file);
117 
118 protected:
119  Ptr<Node>
120  CreateNode(const std::string name, uint32_t systemId);
121 
122  Ptr<Node>
123  CreateNode(const std::string name, double posX, double posY, uint32_t systemId);
124 
125 protected:
131  void
132  ApplySettings();
133 
134 protected:
135  std::string m_path;
136  NodeContainer m_nodes;
137 
138 private:
141  operator=(const AnnotatedTopologyReader&);
142 
143  UniformVariable m_randX;
144  UniformVariable m_randY;
145 
146  ObjectFactory m_mobilityFactory;
147  double m_scale;
148 
149  uint32_t m_requiredPartitions;
150 };
151 }
152 
153 #endif
AnnotatedTopologyReader(const std::string &path="", double scale=1.0)
Constructor.
This class reads annotated topology and apply settings to the corresponding nodes and links...
virtual void ApplyOspfMetric()
Apply OSPF metric on Ipv4 (if exists) and Ccnx (if exists) stacks.
virtual void SetMobilityModel(const std::string &model)
Set mobility model to be used on nodes.
virtual const std::list< Link > & GetLinks() const
Get links read by the reader.
virtual void AssignIpv4Addresses(Ipv4Address base)
Assign IPv4 addresses to all links.
virtual void SaveTopology(const std::string &file)
Save positions (e.g., after manual modification using visualizer)
void ApplySettings()
This method applies setting to corresponding nodes and links NetDeviceContainer must be allocated Nod...
virtual void SetBoundingBox(double ulx, double uly, double lrx, double lry)
Set bounding box where nodes will be randomly places (if positions are unspecified) ...
virtual NodeContainer Read()
Main annotated topology reading function.
virtual NodeContainer GetNodes() const
Get nodes read by the reader.
virtual void SaveGraphviz(const std::string &file)
Save topology in graphviz format (.dot file)
Ptr< Node > CreateNode(const std::string name, uint32_t systemId)