A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
rocketfuel-topology-reader.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Hajime Tazaki
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Hajime Tazaki (tazaki@sfc.wide.ad.jp)
7
*/
8
9
#ifndef ROCKETFUEL_TOPOLOGY_READER_H
10
#define ROCKETFUEL_TOPOLOGY_READER_H
11
12
#include "
topology-reader.h
"
13
14
/**
15
* \file
16
* \ingroup topology
17
* ns3::RocketfuelTopologyReader declaration.
18
*/
19
20
namespace
ns3
21
{
22
23
// ------------------------------------------------------------
24
// --------------------------------------------
25
/**
26
* \ingroup topology
27
*
28
* \brief Topology file reader (Rocketfuel-format type).
29
*
30
* http://www.cs.washington.edu/research/networking/rocketfuel/
31
*
32
* May 2nd, 2010: Currently only support "weights" file and "cch" file.
33
* http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
34
* http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
35
*/
36
class
RocketfuelTopologyReader
:
public
TopologyReader
37
{
38
public
:
39
/**
40
* \brief Get the type ID.
41
* \return The object TypeId
42
*/
43
static
TypeId
GetTypeId
();
44
45
RocketfuelTopologyReader
();
46
~RocketfuelTopologyReader
()
override
;
47
48
// Delete copy constructor and assignment operator to avoid misuse
49
RocketfuelTopologyReader
(
const
RocketfuelTopologyReader
&) =
delete
;
50
RocketfuelTopologyReader
&
operator=
(
const
RocketfuelTopologyReader
&) =
delete
;
51
52
/**
53
* \brief Main topology reading function.
54
*
55
* This method opens an input stream and reads the Rocketfuel-format file.
56
* Every row represents a topology link (the ids of a couple of nodes),
57
* so the input file is read line by line to figure out how many links
58
* and nodes are in the topology.
59
*
60
* \return The container of the nodes created (or empty container if there was an error)
61
*/
62
NodeContainer
Read
()
override
;
63
64
private
:
65
/**
66
* \brief Topology read function from a file containing the nodes map.
67
*
68
* Parser for the *.cch file available at:
69
* http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
70
*
71
* \param [in] argv Argument vector.
72
* \return The container of the nodes created (or empty container if there was an error).
73
*/
74
NodeContainer
GenerateFromMapsFile
(
const
std::vector<std::string>& argv);
75
76
/**
77
* \brief Topology read function from a file containing the nodes weights.
78
*
79
* Parser for the weights.* file available at:
80
* http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
81
*
82
* \param [in] argv Argument vector.
83
* \return The container of the nodes created (or empty container if there was an error).
84
*/
85
NodeContainer
GenerateFromWeightsFile
(
const
std::vector<std::string>& argv);
86
87
/**
88
* \brief Enum of the possible file types.
89
*/
90
enum
RF_FileType
91
{
92
RF_MAPS
,
93
RF_WEIGHTS
,
94
RF_UNKNOWN
95
};
96
97
/**
98
* \brief Classifies the file type according to its content.
99
*
100
* \param buf the first line of the file being read
101
* \return The file type (RF_MAPS, RF_WEIGHTS, or RF_UNKNOWN)
102
*/
103
RF_FileType
GetFileType
(
const
std::string& buf);
104
105
int
m_linksNumber
;
//!< Number of links.
106
int
m_nodesNumber
;
//!< Number of nodes.
107
std::map<std::string, Ptr<Node>>
m_nodeMap
;
//!< Map of the nodes (name, node).
108
109
// end class RocketfuelTopologyReader
110
};
111
112
// end namespace ns3
113
};
// namespace ns3
114
115
#endif
/* ROCKETFUEL_TOPOLOGY_READER_H */
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::RocketfuelTopologyReader
Topology file reader (Rocketfuel-format type).
Definition
rocketfuel-topology-reader.h:37
ns3::RocketfuelTopologyReader::RF_FileType
RF_FileType
Enum of the possible file types.
Definition
rocketfuel-topology-reader.h:91
ns3::RocketfuelTopologyReader::RF_MAPS
@ RF_MAPS
Definition
rocketfuel-topology-reader.h:92
ns3::RocketfuelTopologyReader::RF_UNKNOWN
@ RF_UNKNOWN
Definition
rocketfuel-topology-reader.h:94
ns3::RocketfuelTopologyReader::RF_WEIGHTS
@ RF_WEIGHTS
Definition
rocketfuel-topology-reader.h:93
ns3::RocketfuelTopologyReader::operator=
RocketfuelTopologyReader & operator=(const RocketfuelTopologyReader &)=delete
ns3::RocketfuelTopologyReader::RocketfuelTopologyReader
RocketfuelTopologyReader()
Definition
rocketfuel-topology-reader.cc:44
ns3::RocketfuelTopologyReader::RocketfuelTopologyReader
RocketfuelTopologyReader(const RocketfuelTopologyReader &)=delete
ns3::RocketfuelTopologyReader::GenerateFromWeightsFile
NodeContainer GenerateFromWeightsFile(const std::vector< std::string > &argv)
Topology read function from a file containing the nodes weights.
Definition
rocketfuel-topology-reader.cc:243
ns3::RocketfuelTopologyReader::m_nodeMap
std::map< std::string, Ptr< Node > > m_nodeMap
Map of the nodes (name, node).
Definition
rocketfuel-topology-reader.h:107
ns3::RocketfuelTopologyReader::m_nodesNumber
int m_nodesNumber
Number of nodes.
Definition
rocketfuel-topology-reader.h:106
ns3::RocketfuelTopologyReader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
rocketfuel-topology-reader.cc:35
ns3::RocketfuelTopologyReader::GetFileType
RF_FileType GetFileType(const std::string &buf)
Classifies the file type according to its content.
Definition
rocketfuel-topology-reader.cc:312
ns3::RocketfuelTopologyReader::GenerateFromMapsFile
NodeContainer GenerateFromMapsFile(const std::vector< std::string > &argv)
Topology read function from a file containing the nodes map.
Definition
rocketfuel-topology-reader.cc:116
ns3::RocketfuelTopologyReader::~RocketfuelTopologyReader
~RocketfuelTopologyReader() override
Definition
rocketfuel-topology-reader.cc:51
ns3::RocketfuelTopologyReader::Read
NodeContainer Read() override
Main topology reading function.
Definition
rocketfuel-topology-reader.cc:331
ns3::RocketfuelTopologyReader::m_linksNumber
int m_linksNumber
Number of links.
Definition
rocketfuel-topology-reader.h:105
ns3::TopologyReader
Interface for input file readers management.
Definition
topology-reader.h:40
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
topology-reader.h
ns3::TopologyReader declaration.
src
topology-read
model
rocketfuel-topology-reader.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0