|
25 |
|
25 |
|
26 |
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper() |
26 |
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper() |
27 |
{} |
27 |
{} |
|
|
28 |
|
29 |
Ipv4ListRoutingHelper::~Ipv4ListRoutingHelper() |
30 |
{ |
31 |
for (std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::iterator i = m_list.begin (); |
32 |
i != m_list.end (); ++i) |
33 |
{ |
34 |
delete i->first; |
35 |
} |
36 |
} |
37 |
|
38 |
Ipv4ListRoutingHelper::Ipv4ListRoutingHelper (const Ipv4ListRoutingHelper &o) |
39 |
{ |
40 |
std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i; |
41 |
for (i = o.m_list.begin (); i != o.m_list.end (); ++i) |
42 |
{ |
43 |
m_list.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (i->first->Copy ()), i->second)); |
44 |
} |
45 |
} |
46 |
|
47 |
Ipv4ListRoutingHelper & |
48 |
Ipv4ListRoutingHelper::operator = (const Ipv4ListRoutingHelper &o) |
49 |
{ |
50 |
if (this == &o) |
51 |
{ |
52 |
return *this; |
53 |
} |
54 |
std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i; |
55 |
for (i = o.m_list.begin (); i != o.m_list.end (); ++i) |
56 |
{ |
57 |
m_list.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (i->first->Copy ()), i->second)); |
58 |
} |
59 |
return *this; |
60 |
} |
61 |
|
62 |
Ipv4ListRoutingHelper* |
63 |
Ipv4ListRoutingHelper::Copy (void) const |
64 |
{ |
65 |
return new Ipv4ListRoutingHelper (*this); |
66 |
} |
67 |
|
28 |
void |
68 |
void |
29 |
Ipv4ListRoutingHelper::Add (const Ipv4RoutingHelper &routing, int16_t priority) |
69 |
Ipv4ListRoutingHelper::Add (const Ipv4RoutingHelper &routing, int16_t priority) |
30 |
{ |
70 |
{ |
31 |
m_list.push_back (std::make_pair(&routing,priority)); |
71 |
m_list.push_back (std::make_pair (const_cast<const Ipv4RoutingHelper *> (routing.Copy ()), priority)); |
32 |
} |
72 |
} |
|
|
73 |
|
33 |
Ptr<Ipv4RoutingProtocol> |
74 |
Ptr<Ipv4RoutingProtocol> |
34 |
Ipv4ListRoutingHelper::Create (Ptr<Node> node) const |
75 |
Ipv4ListRoutingHelper::Create (Ptr<Node> node) const |
35 |
{ |
76 |
{ |
36 |
Ptr<Ipv4ListRouting> list = CreateObject<Ipv4ListRouting> (); |
77 |
Ptr<Ipv4ListRouting> list = CreateObject<Ipv4ListRouting> (); |
37 |
for (std::list<std::pair<const Ipv4RoutingHelper *,int16_t> >::const_iterator i = m_list.begin (); |
78 |
for (std::list<std::pair<const Ipv4RoutingHelper *, int16_t> >::const_iterator i = m_list.begin (); |
38 |
i != m_list.end (); ++i) |
79 |
i != m_list.end (); ++i) |
39 |
{ |
80 |
{ |
40 |
Ptr<Ipv4RoutingProtocol> prot = i->first->Create (node); |
81 |
Ptr<Ipv4RoutingProtocol> prot = i->first->Create (node); |