A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
building-position-allocator.h
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 
62  bool m_withReplacement;
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  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 
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 
143  NodeContainer m_nodes;
144  mutable NodeContainer::Iterator m_nodeIt;
145 
148 };
149 
150 
151 } // namespace ns3
152 
153 #endif /* BUILDING_POSITION_ALLOCATOR_H */
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
a 3d vector
Definition: vector.h:31
keep track of a set of node pointers.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
a unique identifier for an interface.
Definition: type-id.h:44
Allocate a set of positions. The allocation strategy is implemented in subclasses.