A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
internet
helper
ipv4-list-routing-helper.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#include "
ipv4-list-routing-helper.h
"
21
#include "ns3/ipv4-list-routing.h"
22
#include "ns3/node.h"
23
24
namespace
ns3
{
25
26
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper
()
27
{
28
}
29
30
Ipv4ListRoutingHelper::~Ipv4ListRoutingHelper
()
31
{
32
for
(
std::list
<std::pair<const Ipv4RoutingHelper *, int16_t> >::iterator i =
m_list
.begin ();
33
i !=
m_list
.end (); ++i)
34
{
35
delete
i->first;
36
}
37
}
38
39
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper
(
const
Ipv4ListRoutingHelper
&o)
40
{
41
std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i;
42
for
(i = o.
m_list
.begin (); i != o.
m_list
.end (); ++i)
43
{
44
m_list
.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (i->first->Copy ()), i->second));
45
}
46
}
47
48
Ipv4ListRoutingHelper
*
49
Ipv4ListRoutingHelper::Copy
(
void
)
const
50
{
51
return
new
Ipv4ListRoutingHelper
(*
this
);
52
}
53
54
void
55
Ipv4ListRoutingHelper::Add
(
const
Ipv4RoutingHelper
&routing, int16_t priority)
56
{
57
m_list
.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (routing.
Copy
()), priority));
58
}
59
60
Ptr<Ipv4RoutingProtocol>
61
Ipv4ListRoutingHelper::Create
(
Ptr<Node>
node)
const
62
{
63
Ptr<Ipv4ListRouting>
list
= CreateObject<Ipv4ListRouting> ();
64
for
(
std::list
<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i =
m_list
.begin ();
65
i !=
m_list
.end (); ++i)
66
{
67
Ptr<Ipv4RoutingProtocol>
prot = i->first->Create (node);
68
list
->AddRoutingProtocol (prot,i->second);
69
}
70
return
list
;
71
}
72
73
}
// namespace ns3
ns3::Ipv4ListRoutingHelper::Ipv4ListRoutingHelper
Ipv4ListRoutingHelper()
Definition:
ipv4-list-routing-helper.cc:26
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
ns3::Ipv4RoutingHelper::Copy
virtual Ipv4RoutingHelper * Copy(void) const =0
virtual constructor
ns3::Ipv4ListRoutingHelper::Copy
Ipv4ListRoutingHelper * Copy(void) const
Definition:
ipv4-list-routing-helper.cc:49
ipv4-list-routing-helper.h
ns3::Ipv4RoutingHelper
a factory to create ns3::Ipv4RoutingProtocol objects
Definition:
ipv4-routing-helper.h:45
list
#define list
Definition:
openflow-interface.h:47
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ipv4ListRoutingHelper::m_list
std::list< std::pair< const Ipv4RoutingHelper *, int16_t > > m_list
Container for pairs of Ipv4RoutingHelper pointer / priority.
Definition:
ipv4-list-routing-helper.h:94
ns3::Ipv4ListRoutingHelper::Create
virtual Ptr< Ipv4RoutingProtocol > Create(Ptr< Node > node) const
Definition:
ipv4-list-routing-helper.cc:61
ns3::Ipv4ListRoutingHelper::Add
void Add(const Ipv4RoutingHelper &routing, int16_t priority)
Definition:
ipv4-list-routing-helper.cc:55
ns3::Ipv4ListRoutingHelper::~Ipv4ListRoutingHelper
virtual ~Ipv4ListRoutingHelper()
Definition:
ipv4-list-routing-helper.cc:30
ns3::Ipv4ListRoutingHelper
Helper class that adds ns3::Ipv4ListRouting objects.
Definition:
ipv4-list-routing-helper.h:37
Generated on Wed Nov 7 2018 10:01:53 for ns-3 by
1.8.14