LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Marco Miozzo <marco.miozzo@cttc.es> | 18 * Author: Marco Miozzo <marco.miozzo@cttc.es> |
19 * | 19 * |
20 */ | 20 */ |
21 #ifndef BUILDING_H | 21 #ifndef BUILDING_H |
22 #define BUILDING_H | 22 #define BUILDING_H |
23 | 23 |
24 #include <ns3/attribute.h> | 24 #include <ns3/attribute.h> |
25 #include <ns3/attribute-helper.h> | 25 #include <ns3/attribute-helper.h> |
26 #include <ns3/vector.h> | 26 #include <ns3/vector.h> |
27 #include <ns3/box.h> | 27 #include <ns3/box.h> |
28 #include <ns3/simple-ref-count.h> | 28 #include <ns3/simple-ref-count.h> |
29 #include <ns3/object.h> | 29 #include <ns3/object.h> |
30 | 30 |
31 namespace ns3 { | 31 namespace ns3 { |
32 | 32 |
33 /** | 33 /** |
34 * \ingroup mobility | 34 * \ingroup mobility |
35 * \brief a 3d building block | 35 * \brief a 3d building block |
36 */ | 36 */ |
37 class Building : public Object | 37 class Building : public Object |
38 { | 38 { |
39 public: | 39 public: |
40 | |
41 /** | 40 /** |
42 * \brief Get the type ID. | 41 * \brief Get the type ID. |
43 * \return the object TypeId | 42 * \return the object TypeId |
44 */ | 43 */ |
45 static TypeId GetTypeId (void); | 44 static TypeId GetTypeId (void); |
46 virtual void DoDispose (); | 45 virtual void DoDispose (); |
47 | 46 |
48 | 47 |
49 /** | 48 /** |
50 * \enum BuildingType_t | 49 * \enum BuildingType_t |
51 * \brief building type enumeration | 50 * \brief building type enumeration |
52 */ | 51 */ |
53 enum BuildingType_t | 52 enum BuildingType_t |
54 { | 53 { |
55 Residential, Office, Commercial | 54 Residential, Office, Commercial |
56 }; | 55 }; |
57 /** | 56 /** |
58 * \enum ExtWallsType_t | 57 * \enum ExtWallsType_t |
59 * \brief building exterior wall enumeration | 58 * \brief building exterior wall enumeration |
60 */ | 59 */ |
61 enum ExtWallsType_t | 60 enum ExtWallsType_t |
62 { | 61 { |
63 Wood, ConcreteWithWindows, ConcreteWithoutWindows, StoneBlocks | 62 Wood, ConcreteWithWindows, ConcreteWithoutWindows, StoneBlocks |
64 }; | 63 }; |
65 | 64 |
66 /** | 65 /** |
67 * Construct a simple building with 1 room and 1 floor | 66 * Construct a simple building with 1 room and 1 floor |
68 * | 67 * |
69 * \param xMin x coordinates of left boundary. | 68 * \param xMin x coordinates of left boundary. |
70 * \param xMax x coordinates of right boundary. | 69 * \param xMax x coordinates of right boundary. |
71 * \param yMin y coordinates of bottom boundary. | 70 * \param yMin y coordinates of bottom boundary. |
72 * \param yMax y coordinates of top boundary. | 71 * \param yMax y coordinates of top boundary. |
73 * \param zMin z coordinates of down boundary. | 72 * \param zMin z coordinates of down boundary. |
74 * \param zMax z coordinates of up boundary. | 73 * \param zMax z coordinates of up boundary. |
75 * | 74 * |
76 */ | 75 */ |
77 Building (double xMin, | 76 Building (double xMin, |
78 double xMax, | 77 double xMax, |
79 double yMin, | 78 double yMin, |
80 double yMax, | 79 double yMax, |
81 double zMin, | 80 double zMin, |
82 double zMax); | 81 double zMax); |
83 | 82 |
84 /** | 83 /** |
85 * Create a zero-sized building located at coordinates (0.0,0.0,0.0) | 84 * Create a zero-sized building located at coordinates (0.0,0.0,0.0) |
86 * and with 1 floors and 1 room. | 85 * and with 1 floors and 1 room. |
87 */ | 86 */ |
88 Building (); | 87 Building (); |
89 | 88 |
90 /** | 89 /** |
91 * Destructor | 90 * Destructor |
92 * | 91 * |
93 */ | 92 */ |
94 virtual ~Building (); | 93 virtual ~Building (); |
95 | 94 |
96 /** | 95 /** |
97 * \return the unique id of this Building. This unique id happens to | 96 * \return the unique id of this Building. This unique id happens to |
98 * be also the index of the Building into the BuildingList. | 97 * be also the index of the Building into the BuildingList. |
99 */ | 98 */ |
100 uint32_t GetId (void) const; | 99 uint32_t GetId (void) const; |
101 | 100 |
102 /** | 101 /** |
103 * Set the boundaries of the building | 102 * Set the boundaries of the building |
104 * | 103 * |
105 * \param box the Box defining the boundaries of the building | 104 * \param box the Box defining the boundaries of the building |
106 */ | 105 */ |
107 void SetBoundaries (Box box); | 106 void SetBoundaries (Box box); |
108 | 107 |
109 /** | 108 /** |
110 * \param t the type of building (i.e., Residential, Office, Commercial) | 109 * \param t the type of building (i.e., Residential, Office, Commercial) |
111 * | 110 * |
112 * This method allows to set building type (default is Residential) | 111 * This method allows to set building type (default is Residential) |
113 */ | 112 */ |
114 void SetBuildingType (Building::BuildingType_t t); | 113 void SetBuildingType (Building::BuildingType_t t); |
(...skipping 22 matching lines...) Expand all Loading... |
137 */ | 136 */ |
138 void SetNRoomsX (uint16_t nroomx); | 137 void SetNRoomsX (uint16_t nroomx); |
139 | 138 |
140 /** | 139 /** |
141 * \param nroomy the number of floors in the building | 140 * \param nroomy the number of floors in the building |
142 * | 141 * |
143 * This method allows to set the number of rooms along the y-axis | 142 * This method allows to set the number of rooms along the y-axis |
144 */ | 143 */ |
145 void SetNRoomsY (uint16_t nroomy); | 144 void SetNRoomsY (uint16_t nroomy); |
146 | 145 |
147 /** | 146 /** |
148 * | 147 * |
149 * \return the boundaries of the building | 148 * \return the boundaries of the building |
150 */ | 149 */ |
151 Box GetBoundaries () const; | 150 Box GetBoundaries () const; |
152 | 151 |
153 /** | 152 /** |
154 * \return the type of building | 153 * \return the type of building |
155 */ | 154 */ |
156 BuildingType_t GetBuildingType () const; | 155 BuildingType_t GetBuildingType () const; |
157 | 156 |
158 /** | 157 /** |
159 * \return the type of external walls of the building | 158 * \return the type of external walls of the building |
160 */ | 159 */ |
161 ExtWallsType_t GetExtWallsType () const; | 160 ExtWallsType_t GetExtWallsType () const; |
162 | 161 |
163 /** | 162 /** |
164 * \return the number of floors of the building | 163 * \return the number of floors of the building |
165 */ | 164 */ |
166 uint16_t GetNFloors () const; | 165 uint16_t GetNFloors () const; |
167 | 166 |
168 /** | 167 /** |
169 * \return the number of rooms along the x-axis of the building | 168 * \return the number of rooms along the x-axis of the building |
170 */ | 169 */ |
171 uint16_t GetNRoomsX () const; | 170 uint16_t GetNRoomsX () const; |
172 | 171 |
173 /** | 172 /** |
174 * \return the number of rooms along the y-axis | 173 * \return the number of rooms along the y-axis |
175 */ | 174 */ |
176 uint16_t GetNRoomsY () const; | 175 uint16_t GetNRoomsY () const; |
177 | 176 |
178 /** | 177 /** |
179 * | 178 * |
180 * | 179 * |
181 * \param position some position | 180 * \param position some position |
182 * | 181 * |
183 * \return true if the position fall inside the building, false otherwise | 182 * \return true if the position fall inside the building, false otherwise |
184 */ | 183 */ |
185 bool IsInside (Vector position) const; | 184 bool IsInside (Vector position) const; |
186 | 185 |
187 /** | 186 /** |
188 * | 187 * |
189 * | 188 * |
190 * \param position a position inside the building | 189 * \param position a position inside the building |
191 * | 190 * |
192 * \return the number of the room along the X axis where the | 191 * \return the number of the room along the X axis where the |
193 * position falls | 192 * position falls |
194 */ | 193 */ |
195 uint16_t GetRoomX (Vector position) const; | 194 uint16_t GetRoomX (Vector position) const; |
196 | 195 |
197 /** | 196 /** |
198 * | 197 * |
199 * | 198 * |
200 * \param position a position inside the building | 199 * \param position a position inside the building |
201 * | 200 * |
202 * \return the number of the room along the Y axis where the | 201 * \return the number of the room along the Y axis where the |
203 * position falls | 202 * position falls |
204 */ | 203 */ |
205 uint16_t GetRoomY (Vector position) const; | 204 uint16_t GetRoomY (Vector position) const; |
206 | 205 |
207 /** | 206 /** |
208 * | 207 * |
209 * \param position a position inside the building | 208 * \param position a position inside the building |
210 * | 209 * |
211 * \return the floor where the position falls | 210 * \return the floor where the position falls |
212 */ | 211 */ |
213 uint16_t GetFloor (Vector position) const; | 212 uint16_t GetFloor (Vector position) const; |
214 | 213 |
215 | 214 |
216 | 215 |
217 | 216 |
218 private: | 217 private: |
219 | |
220 Box m_buildingBounds; ///<Building boundaries | 218 Box m_buildingBounds; ///<Building boundaries |
221 | 219 |
222 /** | 220 /** |
223 * number of floors, must be greater than 0, and 1 means only one floor | 221 * number of floors, must be greater than 0, and 1 means only one floor |
224 * (i.e., groundfloor) | 222 * (i.e., groundfloor) |
225 */ | 223 */ |
226 uint16_t m_floors; ///< Number of floors | 224 uint16_t m_floors; ///< Number of floors |
227 uint16_t m_roomsX; ///< Room X size | 225 uint16_t m_roomsX; ///< Room X size |
228 uint16_t m_roomsY; ///< Room y size | 226 uint16_t m_roomsY; ///< Room y size |
229 | 227 |
230 uint32_t m_buildingId; ///< Building ID | 228 uint32_t m_buildingId; ///< Building ID |
231 BuildingType_t m_buildingType; ///< Building type | 229 BuildingType_t m_buildingType; ///< Building type |
232 ExtWallsType_t m_externalWalls; ///< Extrior wall type | 230 ExtWallsType_t m_externalWalls; ///< Extrior wall type |
233 | 231 |
234 }; | 232 }; |
235 | 233 |
236 } // namespace ns3 | 234 } // namespace ns3 |
237 | 235 |
238 #endif /* BUILDING_H */ | 236 #endif /* BUILDING_H */ |
LEFT | RIGHT |