A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  */
20 #ifndef BUILDING_POSITION_ALLOCATOR_H
21 #define BUILDING_POSITION_ALLOCATOR_H
22 
23 #include <ns3/ptr.h>
24 #include <ns3/position-allocator.h>
25 #include <ns3/node-container.h>
26 #include "ns3/random-variable-stream.h"
27 
28 namespace ns3 {
29 
30 class Building;
31 class UniformRandomVariable;
32 
33 
40 {
41 public:
43 
44  // inherited from Object
45  static TypeId GetTypeId (void);
46 
47  // inherited from PositionAllocator
48  virtual Vector GetNext (void) const;
49 
58  int64_t AssignStreams (int64_t stream);
59 
60 private:
61 
63  mutable std::vector< Ptr<Building> > m_buildingListWithoutReplacement;
64 
67 };
68 
69 
77 {
78 public:
80 
81  // inherited from Object
82  static TypeId GetTypeId (void);
83 
84  // inherited from PositionAllocator
85  virtual Vector GetNext (void) const;
86 
95  int64_t AssignStreams (int64_t stream);
96 
97 private:
98 
99  struct RoomInfo
100  {
102  uint32_t roomx;
103  uint32_t roomy;
104  uint32_t floor;
105  };
106  mutable std::vector<RoomInfo> m_roomListWithoutReplacement;
107 
110 };
111 
112 
113 
120 {
121 public:
124 
125  // inherited from Object
126  static TypeId GetTypeId (void);
127 
128  // inherited from PositionAllocator
129  virtual Vector GetNext (void) const;
130 
139  int64_t AssignStreams (int64_t);
140 
141 private:
142 
145 
148 };
149 
155 {
156 public:
157 
167  FixedRoomPositionAllocator (uint32_t x,
168  uint32_t y,
169  uint32_t z,
170  Ptr<Building> b);
171  // inherited from Object
172  static TypeId GetTypeId (void);
173  // inherited from PositionAllocator
174  virtual Vector GetNext (void) const;
175 
184  int64_t AssignStreams (int64_t);
185 
186 private:
187 
188  uint32_t roomx;
189  uint32_t roomy;
190  uint32_t floor;
191 
193 
196 };
197 
198 
199 } // namespace ns3
200 
201 #endif /* BUILDING_POSITION_ALLOCATOR_H */
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Walks a given NodeContainer sequentially, and for each node allocate a new position randomly in the s...
a 3d vector
Definition: vector.h:31
Generate a random position uniformly distributed in the volume of a chosen room inside a chosen build...
Allocate each position by randomly chosing a building from the list of all buildings, and then randomly chosing a position inside the building.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
keep track of a set of node pointers.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Allocate each position by randomly chosing a room from the list of all buildings, and then randomly c...
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
std::vector< Ptr< Building > > m_buildingListWithoutReplacement
int64_t AssignStreams(int64_t)
Assign a fixed random variable stream number to the random variables used by this model...
int64_t AssignStreams(int64_t)
Assign a fixed random variable stream number to the random variables used by this model...
FixedRoomPositionAllocator(uint32_t x, uint32_t y, uint32_t z, Ptr< Building > b)
a unique identifier for an interface.
Definition: type-id.h:49
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Allocate a set of positions.
std::vector< RoomInfo > m_roomListWithoutReplacement