A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
topology-reader-helper.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 Universita' di Firenze, Italy
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: Tommaso Pecorella (tommaso.pecorella@unifi.it)
19
* Author: Valerio Sartini (valesar@gmail.com)
20
*/
21
22
#include "ns3/object.h"
23
#include "ns3/topology-reader-helper.h"
24
#include "ns3/inet-topology-reader.h"
25
#include "ns3/orbis-topology-reader.h"
26
#include "ns3/rocketfuel-topology-reader.h"
27
#include "ns3/log.h"
28
29
namespace
ns3 {
30
31
NS_LOG_COMPONENT_DEFINE
(
"TopologyReaderHelper"
);
32
33
TopologyReaderHelper::TopologyReaderHelper
()
34
{
35
m_inFile
= 0;
36
}
37
38
void
39
TopologyReaderHelper::SetFileName
(
const
std::string fileName)
40
{
41
m_fileName
= fileName;
42
}
43
44
void
45
TopologyReaderHelper::SetFileType
(
const
std::string fileType)
46
{
47
m_fileType
= fileType;
48
}
49
50
51
Ptr<TopologyReader>
52
TopologyReaderHelper::GetTopologyReader
()
53
{
54
if
(!
m_inFile
)
55
{
56
NS_ASSERT_MSG
(!
m_fileType
.empty (),
"Missing File Type"
);
57
NS_ASSERT_MSG
(!
m_fileName
.empty (),
"Missing File Name"
);
58
59
if
(
m_fileType
==
"Orbis"
)
60
{
61
NS_LOG_INFO
(
"Creating Orbis formatted data input."
);
62
m_inFile
= CreateObject<OrbisTopologyReader> ();
63
}
64
else
if
(
m_fileType
==
"Inet"
)
65
{
66
NS_LOG_INFO
(
"Creating Inet formatted data input."
);
67
m_inFile
= CreateObject<InetTopologyReader> ();
68
}
69
else
if
(
m_fileType
==
"Rocketfuel"
)
70
{
71
NS_LOG_INFO
(
"Creating Rocketfuel formatted data input."
);
72
m_inFile
= CreateObject<RocketfuelTopologyReader> ();
73
}
74
else
75
{
76
NS_ASSERT_MSG
(
false
,
"Wrong (unknown) File Type"
);
77
}
78
79
m_inFile
->
SetFileName
(
m_fileName
);
80
}
81
return
m_inFile
;
82
}
83
84
85
86
}
// namespace ns3
src
topology-read
helper
topology-reader-helper.cc
Generated on Fri Dec 21 2012 19:00:47 for ns-3 by
1.8.1.2