blob: c99a6a3905167aa0bf6b6e86b0ee52b0f98b87a5 [file] [log] [blame]
Ilya Moiseenko1eff17d2011-08-17 10:55:53 -07001/* -*- 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 Moiseenko1eff17d2011-08-17 10:55:53 -070024#include "ns3/topology-reader.h"
Ilya Moiseenko7dd43be2011-08-18 18:57:12 -070025#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 Moiseenko1eff17d2011-08-17 10:55:53 -070039
40namespace ns3
41{
Ilya Moiseenko7dd43be2011-08-18 18:57:12 -070042
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*/
50class AnnotatedTopologyReader : public TopologyReader
51{
52public:
53 typedef std::list< Link >::iterator LinksIterator;
54 static TypeId GetTypeId (void);
55
56 AnnotatedTopologyReader ();
57 virtual ~AnnotatedTopologyReader ();
58
59
Ilya Moiseenko1eff17d2011-08-17 10:55:53 -070060 /**
Ilya Moiseenko7dd43be2011-08-18 18:57:12 -070061 * \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 Moiseenko1eff17d2011-08-17 10:55:53 -070073 */
Ilya Moiseenko7dd43be2011-08-18 18:57:12 -070074 void ApplySettings(NetDeviceContainer *ndc, NodeContainer* nc);
Ilya Moiseenko1eff17d2011-08-17 10:55:53 -070075
Ilya Moiseenko7dd43be2011-08-18 18:57:12 -070076private:
77 AnnotatedTopologyReader (const AnnotatedTopologyReader&);
78 AnnotatedTopologyReader& operator= (const AnnotatedTopologyReader&);
79};
Ilya Moiseenko1eff17d2011-08-17 10:55:53 -070080}
81
82
83#endif
84
85