A Discrete-Event Network Simulator
API
building-position-allocator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (C) 2012 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: Nicola Baldo <nbaldo@cttc.es>
19  * Michele Polese <michele.polese@gmail.com> for the OutdoorPositionAllocator class
20  */
21 #ifndef BUILDING_POSITION_ALLOCATOR_H
22 #define BUILDING_POSITION_ALLOCATOR_H
23 
24 #include <ns3/ptr.h>
25 #include <ns3/position-allocator.h>
26 #include <ns3/node-container.h>
27 #include "ns3/random-variable-stream.h"
28 
29 namespace ns3 {
30 
31 class Building;
32 class UniformRandomVariable;
33 
34 
41 {
42 public:
44 
45  // inherited from Object
46  static TypeId GetTypeId (void);
47 
48  // inherited from PositionAllocator
49  virtual Vector GetNext (void) const;
50 
59  int64_t AssignStreams (int64_t stream);
60 
61 private:
62 
64  mutable std::vector< Ptr<Building> > m_buildingListWithoutReplacement;
65 
68 };
69 
85 {
86 public:
88 
89  // inherited from Object
90  static TypeId GetTypeId (void);
91 
92  // inherited from PositionAllocator
93  virtual Vector GetNext (void) const;
94 
110 
119  int64_t AssignStreams (int64_t stream);
120 
121 private:
125 
126  uint32_t m_maxAttempts;
127 };
128 
136 {
137 public:
139 
140  // inherited from Object
141  static TypeId GetTypeId (void);
142 
143  // inherited from PositionAllocator
144  virtual Vector GetNext (void) const;
145 
154  int64_t AssignStreams (int64_t stream);
155 
156 private:
157 
158  struct RoomInfo
159  {
161  uint32_t roomx;
162  uint32_t roomy;
163  uint32_t floor;
164  };
165  mutable std::vector<RoomInfo> m_roomListWithoutReplacement;
166 
169 };
170 
171 
172 
179 {
180 public:
183 
184  // inherited from Object
185  static TypeId GetTypeId (void);
186 
187  // inherited from PositionAllocator
188  virtual Vector GetNext (void) const;
189 
198  int64_t AssignStreams (int64_t);
199 
200 private:
201 
204 
207 };
208 
214 {
215 public:
216 
226  FixedRoomPositionAllocator (uint32_t x,
227  uint32_t y,
228  uint32_t z,
229  Ptr<Building> b);
230  // inherited from Object
231  static TypeId GetTypeId (void);
232  // inherited from PositionAllocator
233  virtual Vector GetNext (void) const;
234 
243  int64_t AssignStreams (int64_t);
244 
245 private:
246 
247  uint32_t roomx;
248  uint32_t roomy;
249  uint32_t floor;
250 
252 
255 };
256 
257 
258 } // namespace ns3
259 
260 #endif /* BUILDING_POSITION_ALLOCATOR_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::RandomBuildingPositionAllocator
Allocate each position by randomly choosing a building from the list of all buildings,...
Definition: building-position-allocator.h:41
ns3::SameRoomPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:397
ns3::RandomBuildingPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:67
ns3::FixedRoomPositionAllocator
Generate a random position uniformly distributed in the volume of a chosen room inside a chosen build...
Definition: building-position-allocator.h:214
ns3::RandomBuildingPositionAllocator::m_buildingListWithoutReplacement
std::vector< Ptr< Building > > m_buildingListWithoutReplacement
Definition: building-position-allocator.h:64
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::SameRoomPositionAllocator
Walks a given NodeContainer sequentially, and for each node allocate a new position randomly in the s...
Definition: building-position-allocator.h:179
ns3::RandomBuildingPositionAllocator::RandomBuildingPositionAllocator
RandomBuildingPositionAllocator()
Definition: building-position-allocator.cc:46
ns3::OutdoorPositionAllocator::OutdoorPositionAllocator
OutdoorPositionAllocator()
Definition: building-position-allocator.cc:112
ns3::FixedRoomPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:254
ns3::RandomRoomPositionAllocator::RoomInfo::roomx
uint32_t roomx
Definition: building-position-allocator.h:161
ns3::OutdoorPositionAllocator::m_y
Ptr< RandomVariableStream > m_y
pointer to y's random variable stream
Definition: building-position-allocator.h:123
ns3::OutdoorPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:165
ns3::RandomRoomPositionAllocator::RoomInfo
Definition: building-position-allocator.h:159
ns3::SameRoomPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:206
ns3::RandomRoomPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:234
ns3::Ptr< UniformRandomVariable >
ns3::OutdoorPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:216
ns3::RandomRoomPositionAllocator::RandomRoomPositionAllocator
RandomRoomPositionAllocator()
Definition: building-position-allocator.cc:228
ns3::SameRoomPositionAllocator::m_nodes
NodeContainer m_nodes
Definition: building-position-allocator.h:202
ns3::OutdoorPositionAllocator
allocate outdoor positions
Definition: building-position-allocator.h:85
ns3::RandomBuildingPositionAllocator::m_withReplacement
bool m_withReplacement
Definition: building-position-allocator.h:63
ns3::OutdoorPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:117
ns3::RandomRoomPositionAllocator::RoomInfo::roomy
uint32_t roomy
Definition: building-position-allocator.h:162
ns3::RandomBuildingPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:103
ns3::OutdoorPositionAllocator::SetZ
void SetZ(Ptr< RandomVariableStream > z)
Set the random variable stream object that generates z-positions.
Definition: building-position-allocator.cc:159
ns3::RandomRoomPositionAllocator::m_roomListWithoutReplacement
std::vector< RoomInfo > m_roomListWithoutReplacement
Definition: building-position-allocator.h:165
ns3::FixedRoomPositionAllocator::roomy
uint32_t roomy
Definition: building-position-allocator.h:248
ns3::RandomRoomPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:244
ns3::SameRoomPositionAllocator::SameRoomPositionAllocator
SameRoomPositionAllocator()
Definition: building-position-allocator.cc:315
ns3::NodeContainer::Iterator
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-container.h:42
ns3::OutdoorPositionAllocator::m_z
Ptr< RandomVariableStream > m_z
pointer to z's random variable stream
Definition: building-position-allocator.h:124
ns3::FixedRoomPositionAllocator::bptr
Ptr< Building > bptr
Definition: building-position-allocator.h:251
ns3::OutdoorPositionAllocator::m_maxAttempts
uint32_t m_maxAttempts
maximum number of attempts before giving up
Definition: building-position-allocator.h:126
ns3::FixedRoomPositionAllocator::floor
uint32_t floor
Definition: building-position-allocator.h:249
ns3::RandomRoomPositionAllocator::RoomInfo::b
Ptr< Building > b
Definition: building-position-allocator.h:160
ns3::FixedRoomPositionAllocator::FixedRoomPositionAllocator
FixedRoomPositionAllocator(uint32_t x, uint32_t y, uint32_t z, Ptr< Building > b)
Definition: building-position-allocator.cc:406
ns3::RandomRoomPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:303
ns3::PositionAllocator
Allocate a set of positions.
Definition: position-allocator.h:36
sample-rng-plot.x
list x
Definition: sample-rng-plot.py:34
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::SameRoomPositionAllocator::m_nodeIt
NodeContainer::Iterator m_nodeIt
Definition: building-position-allocator.h:203
ns3::RandomBuildingPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:70
ns3::OutdoorPositionAllocator::m_x
Ptr< RandomVariableStream > m_x
pointer to x's random variable stream
Definition: building-position-allocator.h:122
ns3::SameRoomPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:348
ns3::RandomRoomPositionAllocator::RoomInfo::floor
uint32_t floor
Definition: building-position-allocator.h:163
ns3::FixedRoomPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:430
ns3::RandomRoomPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:168
ns3::RandomBuildingPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:52
ns3::OutdoorPositionAllocator::SetX
void SetX(Ptr< RandomVariableStream > x)
Set the random variable stream object that generates x-positions.
Definition: building-position-allocator.cc:149
ns3::RandomRoomPositionAllocator
Allocate each position by randomly choosing a room from the list of all buildings,...
Definition: building-position-allocator.h:136
ns3::FixedRoomPositionAllocator::roomx
uint32_t roomx
Definition: building-position-allocator.h:247
ns3::FixedRoomPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:460
ns3::SameRoomPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:338
ns3::FixedRoomPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:420
ns3::OutdoorPositionAllocator::SetY
void SetY(Ptr< RandomVariableStream > y)
Set the random variable stream object that generates y-positions.
Definition: building-position-allocator.cc:154