A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
building-container.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4
*
5
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> (original node-container.cc)
8
* Nicola Baldo (wrote building-container.cc based on node-container.cc)
9
*/
10
#include "
building-container.h
"
11
12
#include "ns3/building-list.h"
13
#include "ns3/names.h"
14
15
namespace
ns3
16
{
17
18
BuildingContainer::BuildingContainer
()
19
{
20
}
21
22
BuildingContainer::BuildingContainer
(
Ptr<Building>
building)
23
{
24
m_buildings
.push_back(building);
25
}
26
27
BuildingContainer::BuildingContainer
(std::string buildingName)
28
{
29
Ptr<Building>
building =
Names::Find<Building>
(buildingName);
30
m_buildings
.push_back(building);
31
}
32
33
BuildingContainer::Iterator
34
BuildingContainer::Begin
()
const
35
{
36
return
m_buildings
.begin();
37
}
38
39
BuildingContainer::Iterator
40
BuildingContainer::End
()
const
41
{
42
return
m_buildings
.end();
43
}
44
45
uint32_t
46
BuildingContainer::GetN
()
const
47
{
48
return
m_buildings
.size();
49
}
50
51
Ptr<Building>
52
BuildingContainer::Get
(
uint32_t
i)
const
53
{
54
return
m_buildings
[i];
55
}
56
57
void
58
BuildingContainer::Create
(
uint32_t
n)
59
{
60
for
(
uint32_t
i = 0; i < n; i++)
61
{
62
m_buildings
.push_back(
CreateObject<Building>
());
63
}
64
}
65
66
void
67
BuildingContainer::Add
(
BuildingContainer
other)
68
{
69
for
(
auto
i = other.
Begin
(); i != other.
End
(); i++)
70
{
71
m_buildings
.push_back(*i);
72
}
73
}
74
75
void
76
BuildingContainer::Add
(
Ptr<Building>
building)
77
{
78
m_buildings
.push_back(building);
79
}
80
81
void
82
BuildingContainer::Add
(std::string buildingName)
83
{
84
Ptr<Building>
building =
Names::Find<Building>
(buildingName);
85
m_buildings
.push_back(building);
86
}
87
88
BuildingContainer
89
BuildingContainer::GetGlobal
()
90
{
91
BuildingContainer
c;
92
for
(
auto
i =
BuildingList::Begin
(); i !=
BuildingList::End
(); ++i)
93
{
94
c.
Add
(*i);
95
}
96
return
c;
97
}
98
99
}
// namespace ns3
building-container.h
ns3::BuildingContainer
keep track of a set of building pointers.
Definition
building-container.h:33
ns3::BuildingContainer::End
Iterator End() const
Get an iterator which indicates past-the-last Building in the container.
Definition
building-container.cc:40
ns3::BuildingContainer::m_buildings
std::vector< Ptr< Building > > m_buildings
Building container.
Definition
building-container.h:196
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:58
ns3::BuildingContainer::Iterator
std::vector< Ptr< Building > >::const_iterator Iterator
Const iterator.
Definition
building-container.h:36
ns3::BuildingContainer::BuildingContainer
BuildingContainer()
Create an empty BuildingContainer.
Definition
building-container.cc:18
ns3::BuildingContainer::GetN
uint32_t GetN() const
Get the number of Ptr<Building> stored in this container.
Definition
building-container.cc:46
ns3::BuildingContainer::GetGlobal
static BuildingContainer GetGlobal()
Create a BuildingContainer that contains a list of all buildings stored in the ns3::BuildingList.
Definition
building-container.cc:89
ns3::BuildingContainer::Add
void Add(BuildingContainer other)
Append the contents of another BuildingContainer to the end of this container.
Definition
building-container.cc:67
ns3::BuildingContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first Building in the container.
Definition
building-container.cc:34
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:52
ns3::BuildingList::End
static Iterator End()
Definition
building-list.cc:219
ns3::BuildingList::Begin
static Iterator Begin()
Definition
building-list.cc:213
ns3::Names::Find
static Ptr< T > Find(std::string path)
Given a name path string, look to see if there's an object in the system with that associated to it.
Definition
names.h:443
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
uint32_t
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
buildings
helper
building-container.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0