A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
building-container.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
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> (original node-container.cc)
20
* Nicola Baldo (wrote building-container.cc based on node-container.cc)
21
*/
22
#include "
building-container.h
"
23
#include "ns3/building-list.h"
24
#include "ns3/names.h"
25
26
namespace
ns3
{
27
28
BuildingContainer::BuildingContainer
()
29
{
30
}
31
32
BuildingContainer::BuildingContainer
(
Ptr<Building>
building)
33
{
34
m_buildings
.push_back (building);
35
}
36
BuildingContainer::BuildingContainer
(std::string buildingName)
37
{
38
Ptr<Building>
building = Names::Find<Building> (buildingName);
39
m_buildings
.push_back (building);
40
}
41
42
BuildingContainer::Iterator
43
BuildingContainer::Begin
(
void
)
const
44
{
45
return
m_buildings
.begin ();
46
}
47
BuildingContainer::Iterator
48
BuildingContainer::End
(
void
)
const
49
{
50
return
m_buildings
.end ();
51
}
52
53
uint32_t
54
BuildingContainer::GetN
(
void
)
const
55
{
56
return
m_buildings
.size ();
57
}
58
Ptr<Building>
59
BuildingContainer::Get
(uint32_t i)
const
60
{
61
return
m_buildings
[i];
62
}
63
void
64
BuildingContainer::Create
(uint32_t n)
65
{
66
for
(uint32_t i = 0; i < n; i++)
67
{
68
m_buildings
.push_back (CreateObject<Building> ());
69
}
70
}
71
void
72
BuildingContainer::Add
(
BuildingContainer
other)
73
{
74
for
(
Iterator
i = other.
Begin
(); i != other.
End
(); i++)
75
{
76
m_buildings
.push_back (*i);
77
}
78
}
79
void
80
BuildingContainer::Add
(
Ptr<Building>
building)
81
{
82
m_buildings
.push_back (building);
83
}
84
void
85
BuildingContainer::Add
(std::string buildingName)
86
{
87
Ptr<Building>
building = Names::Find<Building> (buildingName);
88
m_buildings
.push_back (building);
89
}
90
91
BuildingContainer
92
BuildingContainer::GetGlobal
(
void
)
93
{
94
BuildingContainer
c;
95
for
(
BuildingList::Iterator
i =
BuildingList::Begin
(); i !=
BuildingList::End
(); ++i)
96
{
97
c.
Add
(*i);
98
}
99
return
c;
100
}
101
102
}
// namespace ns3
building-container.h
ns3::BuildingContainer
keep track of a set of building pointers.
Definition:
building-container.h:41
ns3::BuildingContainer::m_buildings
std::vector< Ptr< Building > > m_buildings
Building container.
Definition:
building-container.h:204
ns3::BuildingContainer::Create
void Create(uint32_t n)
Create n buildings and append pointers to them to the end of this BuildingContainer.
Definition:
building-container.cc:64
ns3::BuildingContainer::BuildingContainer
BuildingContainer()
Create an empty BuildingContainer.
Definition:
building-container.cc:28
ns3::BuildingContainer::End
Iterator End(void) const
Get an iterator which indicates past-the-last Building in the container.
Definition:
building-container.cc:48
ns3::BuildingContainer::Add
void Add(BuildingContainer other)
Append the contents of another BuildingContainer to the end of this container.
Definition:
building-container.cc:72
ns3::BuildingContainer::Get
Ptr< Building > Get(uint32_t i) const
Get the Ptr<Building> stored in this container at a given index.
Definition:
building-container.cc:59
ns3::BuildingContainer::Begin
Iterator Begin(void) const
Get an iterator which refers to the first Building in the container.
Definition:
building-container.cc:43
ns3::BuildingContainer::GetGlobal
static BuildingContainer GetGlobal(void)
Create a BuildingContainer that contains a list of all buildings stored in the ns3::BuildingList.
Definition:
building-container.cc:92
ns3::BuildingContainer::GetN
uint32_t GetN(void) const
Get the number of Ptr<Building> stored in this container.
Definition:
building-container.cc:54
ns3::BuildingContainer::Iterator
std::vector< Ptr< Building > >::const_iterator Iterator
Const iterator.
Definition:
building-container.h:44
ns3::BuildingList::Iterator
std::vector< Ptr< Building > >::const_iterator Iterator
Const Iterator.
Definition:
building-list.h:40
ns3::BuildingList::End
static Iterator End(void)
Definition:
building-list.cc:221
ns3::BuildingList::Begin
static Iterator Begin(void)
Definition:
building-list.cc:216
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
buildings
helper
building-container.cc
Generated on Tue Feb 6 2024 19:21:16 for ns-3 by
1.9.1