A Discrete-Event Network Simulator
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
15namespace ns3
16{
17
21
26
28{
29 Ptr<Building> building = Names::Find<Building>(buildingName);
30 m_buildings.push_back(building);
31}
32
35{
36 return m_buildings.begin();
37}
38
41{
42 return m_buildings.end();
43}
44
47{
48 return m_buildings.size();
49}
50
53{
54 return m_buildings[i];
55}
56
57void
59{
60 for (uint32_t i = 0; i < n; i++)
61 {
63 }
64}
65
66void
68{
69 for (auto i = other.Begin(); i != other.End(); i++)
70 {
71 m_buildings.push_back(*i);
72 }
73}
74
75void
80
81void
83{
84 Ptr<Building> building = Names::Find<Building>(buildingName);
85 m_buildings.push_back(building);
86}
87
90{
92 for (auto i = BuildingList::Begin(); i != BuildingList::End(); ++i)
93 {
94 c.Add(*i);
95 }
96 return c;
97}
98
99} // namespace ns3
keep track of a set of building pointers.
Iterator End() const
Get an iterator which indicates past-the-last Building in the container.
std::vector< Ptr< Building > > m_buildings
Building container.
void Create(uint32_t n)
Create n buildings and append pointers to them to the end of this BuildingContainer.
std::vector< Ptr< Building > >::const_iterator Iterator
Const iterator.
BuildingContainer()
Create an empty BuildingContainer.
uint32_t GetN() const
Get the number of Ptr<Building> stored in this container.
static BuildingContainer GetGlobal()
Create a BuildingContainer that contains a list of all buildings stored in the ns3::BuildingList.
void Add(BuildingContainer other)
Append the contents of another BuildingContainer to the end of this container.
Iterator Begin() const
Get an iterator which refers to the first Building in the container.
Ptr< Building > Get(uint32_t i) const
Get the Ptr<Building> stored in this container at a given index.
static Iterator End()
static Iterator Begin()
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.