blob: cf6a784dd244fceafe25ea5517c3855d16974226 [file] [log] [blame]
Ilya Moiseenko58d26672011-12-08 13:48:06 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2010 Hajime Tazaki
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: Hajime Tazaki (tazaki@sfc.wide.ad.jp)
19 * Ilya Moiseenko <iliamo@cs.ucla.edu>
20 */
21
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080022#ifndef ROCKETFUEL_TOPOLOGY_WEIGHTS_READER_H
23#define ROCKETFUEL_TOPOLOGY_WEIGHTS_READER_H
Ilya Moiseenko58d26672011-12-08 13:48:06 -080024
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080025#include "annotated-topology-reader.h"
Alexander Afanasyev07827182011-12-13 01:07:32 -080026#include "ns3/net-device-container.h"
Ilya Moiseenko58d26672011-12-08 13:48:06 -080027
28namespace ns3 {
29
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080030// ------------------------------------------------------------
31// --------------------------------------------
32/**
33 * \brief Topology file reader (extension of Rocketfuel-format type).
34 *
35 * http://www.cs.washington.edu/research/networking/rocketfuel/
36 *
37 * Only weights and latencies file is supported
38 */
39class RocketfuelWeightsReader : public AnnotatedTopologyReader
40{
41public:
Alexander Afanasyev7dbdcaf2011-12-13 21:40:37 -080042 RocketfuelWeightsReader (const std::string &path="");
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080043 virtual ~RocketfuelWeightsReader ();
44
45 void
46 SetFileType (uint8_t inputType);
47
48 /**
49 * \brief Main topology reading function.
50 *
51 * This method opens an input stream and reads the Rocketfuel-format file.
52 * Every row represents a topology link (the ids of a couple of nodes),
53 * so the input file is read line by line to figure out how many links
54 * and nodes are in the topology.
55 *
56 * \return the container of the nodes created (or empty container if there was an error)
57 */
Alexander Afanasyev7dbdcaf2011-12-13 21:40:37 -080058 virtual NodeContainer
59 Read (void);
60
61 void
62 Commit ();
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080063
64 enum
Ilya Moiseenko58d26672011-12-08 13:48:06 -080065 {
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080066 WEIGHTS,
Alexander Afanasyev5beb35a2011-12-21 16:45:13 -080067 LATENCIES,
68 POSITIONS
Ilya Moiseenko58d26672011-12-08 13:48:06 -080069 };
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080070
Alexander Afanasyev5beb35a2011-12-21 16:45:13 -080071 void
72 SavePositions (const std::string &file) const;
73
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080074private:
75 RocketfuelWeightsReader (const RocketfuelWeightsReader&);
76 RocketfuelWeightsReader& operator= (const RocketfuelWeightsReader&);
77
78private:
79 uint8_t m_inputType;
80
81}; // end class RocketfuelWeightsReader
82
83}; // end namespace ns3
Ilya Moiseenko58d26672011-12-08 13:48:06 -080084
85
Alexander Afanasyevae3b7c32011-12-13 13:20:06 -080086#endif /* ROCKETFUEL_TOPOLOGY_WEIGHTS_READER_H */