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
23{
24 m_buildings.push_back(building);
25}
26
27BuildingContainer::BuildingContainer(std::string buildingName)
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
77{
78 m_buildings.push_back(building);
79}
80
81void
82BuildingContainer::Add(std::string buildingName)
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()
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
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.