Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 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 | |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 24 | #include "ns3/topology-reader.h" |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 25 | #include "ns3/nstime.h" |
| 26 | #include "ns3/log.h" |
| 27 | #include "ns3/net-device-container.h" |
| 28 | #include "ns3/point-to-point-helper.h" |
| 29 | #include "ns3/point-to-point-net-device.h" |
| 30 | #include "ns3/drop-tail-queue.h" |
| 31 | #include "ns3/string.h" |
| 32 | #include "ns3/pointer.h" |
| 33 | #include "ns3/uinteger.h" |
| 34 | #include <string> |
| 35 | #include <fstream> |
| 36 | #include <cstdlib> |
| 37 | #include <iostream> |
| 38 | #include <sstream> |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 39 | |
| 40 | namespace ns3 |
| 41 | { |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * \brief This class reads annotated topology and apply settings to the corresponding nodes and links |
| 45 | * Input File Format |
| 46 | * 1st line is NumberOfNodes TAB NumberofLinks |
| 47 | * Nth line is NodeID1 TAB NodeID2 TAB DataRateKBPS TAB DelayMiliseconds TAB QueueSizeInPacketsNode1 TAB QueueSizeInPacketsNode2 |
| 48 | * |
| 49 | */ |
| 50 | class AnnotatedTopologyReader : public TopologyReader |
| 51 | { |
| 52 | public: |
| 53 | typedef std::list< Link >::iterator LinksIterator; |
| 54 | static TypeId GetTypeId (void); |
| 55 | |
| 56 | AnnotatedTopologyReader (); |
| 57 | virtual ~AnnotatedTopologyReader (); |
| 58 | |
| 59 | |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 60 | /** |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 61 | * \brief Main annotated topology reading function. |
| 62 | * |
| 63 | * This method opens an input stream and reads topology file with annotations. |
| 64 | * |
| 65 | * \return the container of the nodes created (or empty container if there was an error) |
| 66 | */ |
| 67 | virtual NodeContainer Read (void); |
| 68 | |
| 69 | /** |
| 70 | * \brief This method applies setting to corresponding nodes and links |
| 71 | * NetDeviceContainer must be allocated |
| 72 | * NodeContainer from Read method |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 73 | */ |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 74 | void ApplySettings(NetDeviceContainer *ndc, NodeContainer* nc); |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 75 | |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 76 | private: |
| 77 | AnnotatedTopologyReader (const AnnotatedTopologyReader&); |
| 78 | AnnotatedTopologyReader& operator= (const AnnotatedTopologyReader&); |
| 79 | }; |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | |
| 83 | #endif |
| 84 | |
| 85 | |