NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
annotated-topology-reader.h
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 University of California, Los Angeles
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
19  */
20 
21 #ifndef __ANNOTATED_TOPOLOGY_READER_H__
22 #define __ANNOTATED_TOPOLOGY_READER_H__
23 
24 #include "ns3/topology-reader.h"
25 #include "ns3/random-variable.h"
26 #include "ns3/object-factory.h"
27 
28 namespace ns3
29 {
30 
35 class AnnotatedTopologyReader : public TopologyReader
36 {
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 ApplySettings ();
132 
133 protected:
134  std::string m_path;
135  NodeContainer m_nodes;
136 
137 private:
140 
141  UniformVariable m_randX;
142  UniformVariable m_randY;
143 
144  ObjectFactory m_mobilityFactory;
145  double m_scale;
146 
147  uint32_t m_requiredPartitions;
148 };
149 
150 }
151 
152 #endif
153 
154 
AnnotatedTopologyReader(const std::string &path="", double scale=1.0)
Constructor.
virtual void SaveGraphviz(const std::string &file)
Save topology in graphviz format (.dot file)
virtual NodeContainer GetNodes() const
Get nodes read by the reader.
virtual void SaveTopology(const std::string &file)
Save positions (e.g., after manual modification using visualizer)
virtual const std::list< Link > & GetLinks() const
Get links read by the reader.
virtual void ApplyOspfMetric()
Apply OSPF metric on Ipv4 (if exists) and Ccnx (if exists) stacks.
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 void AssignIpv4Addresses(Ipv4Address base)
Assign IPv4 addresses to all links.
virtual void SetMobilityModel(const std::string &model)
Set mobility model to be used on nodes.
This class reads annotated topology and apply settings to the corresponding nodes and links...