A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
39
class
RandomBuildingPositionAllocator
:
public
PositionAllocator
40
{
41
public
:
42
RandomBuildingPositionAllocator
();
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
62
bool
m_withReplacement
;
63
mutable
std::vector< Ptr<Building> >
m_buildingListWithoutReplacement
;
64
66
Ptr<UniformRandomVariable>
m_rand
;
67
};
68
69
76
class
RandomRoomPositionAllocator
:
public
PositionAllocator
77
{
78
public
:
79
RandomRoomPositionAllocator
();
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
bool
m_withReplacement
;
100
struct
RoomInfo
101
{
102
Ptr<Building>
b
;
103
uint32_t
roomx
;
104
uint32_t
roomy
;
105
uint32_t
floor
;
106
};
107
mutable
std::vector<RoomInfo>
m_roomListWithoutReplacement
;
108
110
Ptr<UniformRandomVariable>
m_rand
;
111
};
112
113
119
class
SameRoomPositionAllocator
:
public
PositionAllocator
120
{
121
public
:
122
SameRoomPositionAllocator
();
123
SameRoomPositionAllocator
(
NodeContainer
c);
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
143
NodeContainer
m_nodes
;
144
mutable
NodeContainer::Iterator
m_nodeIt
;
145
147
Ptr<UniformRandomVariable>
m_rand
;
148
};
149
150
151
}
// namespace ns3
152
153
#endif
/* BUILDING_POSITION_ALLOCATOR_H */
src
buildings
helper
building-position-allocator.h
Generated on Tue Oct 9 2012 16:45:33 for ns-3 by
1.8.1.2