A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
building-position-allocator.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 * Michele Polese <michele.polese@gmail.com> for the OutdoorPositionAllocator class
19 */
20#ifndef BUILDING_POSITION_ALLOCATOR_H
21#define BUILDING_POSITION_ALLOCATOR_H
22
23#include "ns3/random-variable-stream.h"
24#include <ns3/node-container.h>
25#include <ns3/position-allocator.h>
26#include <ns3/ptr.h>
27
28namespace ns3
29{
30
31class Building;
32class UniformRandomVariable;
33
39{
40 public:
42
47 static TypeId GetTypeId();
48
49 // inherited from PositionAllocator
50 Vector GetNext() const override;
51
60 int64_t AssignStreams(int64_t stream) override;
61
62 private:
64 mutable std::vector<Ptr<Building>>
66
69};
70
86{
87 public:
89
94 static TypeId GetTypeId();
95
96 // inherited from PositionAllocator
97 Vector GetNext() const override;
98
114
123 int64_t AssignStreams(int64_t stream) override;
124
125 private:
129
131};
132
140{
141 public:
143
148 static TypeId GetTypeId();
149
150 // inherited from PositionAllocator
151 Vector GetNext() const override;
152
161 int64_t AssignStreams(int64_t stream) override;
162
163 private:
167 struct RoomInfo
168 {
173 };
174
175 mutable std::vector<RoomInfo> m_roomListWithoutReplacement;
176
179};
180
187{
188 public:
190
196
201 static TypeId GetTypeId();
202
203 // inherited from PositionAllocator
204 Vector GetNext() const override;
205
214 int64_t AssignStreams(int64_t) override;
215
216 private:
219
222};
223
229{
230 public:
245 static TypeId GetTypeId();
246 // inherited from PositionAllocator
247 Vector GetNext() const override;
248
257 int64_t AssignStreams(int64_t) override;
258
259 private:
263
265
268};
269
270} // namespace ns3
271
272#endif /* BUILDING_POSITION_ALLOCATOR_H */
Generate a random position uniformly distributed in the volume of a chosen room inside a chosen build...
uint32_t floor
Index of the room on the z-axis (i.e., floor number)
uint32_t roomx
Index of the room on the x-axis.
uint32_t roomy
Index of the room on the y-axis.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Ptr< Building > bptr
Pointer to the chosen building.
int64_t AssignStreams(int64_t) override
Assign a fixed random variable stream number to the random variables used by this model.
static TypeId GetTypeId()
Get the type ID.
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void SetY(Ptr< RandomVariableStream > y)
Set the random variable stream object that generates y-positions.
uint32_t m_maxAttempts
maximum number of attempts before giving up
static TypeId GetTypeId()
Get the type ID.
void SetX(Ptr< RandomVariableStream > x)
Set the random variable stream object that generates x-positions.
Ptr< RandomVariableStream > m_x
pointer to x's random variable stream
Ptr< RandomVariableStream > m_z
pointer to z's random variable stream
Ptr< RandomVariableStream > m_y
pointer to y's random variable stream
void SetZ(Ptr< RandomVariableStream > z)
Set the random variable stream object that generates z-positions.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Allocate a set of positions.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Allocate each position by randomly choosing a building from the list of all buildings,...
std::vector< Ptr< Building > > m_buildingListWithoutReplacement
List of building without replacement.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
bool m_withReplacement
If true, the building will be randomly selected with replacement.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Allocate each position by randomly choosing a room from the list of all buildings,...
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::vector< RoomInfo > m_roomListWithoutReplacement
Container of rooms.
static TypeId GetTypeId()
Get the type ID.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Walks a given NodeContainer sequentially, and for each node allocate a new position randomly in the s...
NodeContainer m_nodes
Nodes container.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
int64_t AssignStreams(int64_t) override
Assign a fixed random variable stream number to the random variables used by this model.
NodeContainer::Iterator m_nodeIt
Nodes iterator.
static TypeId GetTypeId()
Get the type ID.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.