A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-list-routing-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
10
11#include "ns3/ipv6-list-routing.h"
12#include "ns3/node.h"
13
14namespace ns3
15{
16
20
22{
23 for (auto i = m_list.begin(); i != m_list.end(); ++i)
24 {
25 delete i->first;
26 }
27}
28
30{
31 for (auto i = o.m_list.begin(); i != o.m_list.end(); ++i)
32 {
33 m_list.emplace_back(const_cast<const Ipv6RoutingHelper*>(i->first->Copy()), i->second);
34 }
35}
36
39{
40 return new Ipv6ListRoutingHelper(*this);
41}
42
43void
44Ipv6ListRoutingHelper::Add(const Ipv6RoutingHelper& routing, int16_t priority)
45{
46 m_list.emplace_back(const_cast<const Ipv6RoutingHelper*>(routing.Copy()), priority);
47}
48
51{
53 for (auto i = m_list.begin(); i != m_list.end(); ++i)
54 {
55 Ptr<Ipv6RoutingProtocol> prot = i->first->Create(node);
56 list->AddRoutingProtocol(prot, i->second);
57 }
58 return list;
59}
60
61} // namespace ns3
Helper class that adds ns3::Ipv6ListRouting objects.
std::list< std::pair< const Ipv6RoutingHelper *, int16_t > > m_list
Container for pairs of Ipv6RoutingHelper pointer / priority.
Ipv6ListRoutingHelper * Copy() const override
void Add(const Ipv6RoutingHelper &routing, int16_t priority)
Ipv6ListRoutingHelper()
Construct an Ipv6 Ipv6ListRoutingHelper which is used to make life easier for people wanting to confi...
Ptr< Ipv6RoutingProtocol > Create(Ptr< Node > node) const override
~Ipv6ListRoutingHelper() override
Destroy an Ipv6 Ipv6ListRoutingHelper.
A factory to create ns3::Ipv6RoutingProtocol objects.
virtual Ipv6RoutingHelper * Copy() const =0
virtual constructor
Smart pointer class similar to boost::intrusive_ptr.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Every class exported by the ns3 library is enclosed in the ns3 namespace.
#define list