A Discrete-Event Network Simulator
API
building-container.h
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  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> (original node-container.h)
19  * Nicola Baldo (wrote building-container.h based on node-container.h)
20  */
21 #ifndef BUILDING_CONTAINER_H
22 #define BUILDING_CONTAINER_H
23 
24 #include <ns3/building.h>
25 
26 #include <stdint.h>
27 #include <vector>
28 
29 namespace ns3
30 {
31 
42 {
43  public:
45  typedef std::vector<Ptr<Building>>::const_iterator Iterator;
46 
51 
59 
67  BuildingContainer(std::string buildingName);
68 
88  Iterator Begin() const;
89 
109  Iterator End() const;
110 
131  uint32_t GetN() const;
132 
154  Ptr<Building> Get(uint32_t i) const;
155 
166  void Create(uint32_t n);
167 
174  void Add(BuildingContainer other);
175 
181  void Add(Ptr<Building> building);
182 
189  void Add(std::string buildingName);
190 
202  static BuildingContainer GetGlobal();
203 
204  private:
205  std::vector<Ptr<Building>> m_buildings;
206 };
207 
208 } // namespace ns3
209 
210 #endif /* BUILDING_CONTAINER_H */
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.
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.
std::vector< Ptr< Building > >::const_iterator Iterator
Const iterator.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.