24 #include "building-list.h"
27 #include <ns3/uinteger.h>
29 #include <ns3/assert.h>
37 NS_OBJECT_ENSURE_REGISTERED (Building);
40 Building::GetTypeId (
void)
42 static TypeId tid = TypeId (
"ns3::Building")
44 .AddConstructor<Building> ()
45 .AddAttribute (
"NRoomsX",
"The number of rooms in the X axis.",
48 MakeUintegerChecker<uint32_t> ())
49 .AddAttribute (
"NRoomsY",
"The number of rooms in the Y axis.",
52 MakeUintegerChecker<uint32_t> ())
53 .AddAttribute (
"NFloors",
"The number of floors of this building.",
56 MakeUintegerChecker<uint32_t> ())
57 .AddAttribute (
"Id",
"The id (unique integer) of this Building.",
60 MakeUintegerChecker<uint32_t> ())
61 .AddAttribute (
"Boundaries",
"The boundaries of this Building as a value of type ns3::Box",
65 .AddAttribute (
"Type",
66 "The type of building",
67 EnumValue (Building::Residential),
69 MakeEnumChecker (Building::Residential,
"Residential",
70 Building::Office,
"Office",
71 Building::Commercial,
"Commercial"))
72 .AddAttribute (
"ExternalWallsType",
73 "The type of material of which the external walls are made",
74 EnumValue (Building::ConcreteWithWindows),
76 MakeEnumChecker (Building::Wood,
"Wood",
77 Building::ConcreteWithWindows,
"ConcreteWithWindows",
78 Building::ConcreteWithoutWindows,
"ConcreteWithoutWindows",
79 Building::StoneBlocks,
"StoneBlocks"))
91 NS_FATAL_ERROR (std::endl <<
"this function is not supported any more:" << std::endl
92 <<
" Building::Building (double xMin, double xMax, double yMin, " << std::endl
93 <<
" double yMax, double zMin, double zMax)\n" << std::endl
94 <<
"so you can't do any more stuff like:" << std::endl
95 <<
"Ptr<Building> b = CreateObject<Building> ("
101 << zMax <<
")\n" << std::endl
102 <<
"Please use instead something like this:" << std::endl
103 <<
" Ptr<Building> b = CreateObject<Building> ();" << std::endl
104 <<
" b->SetBoundaries (Box ("
110 << zMax <<
"));" << std::endl <<std::endl);
142 m_buildingBounds = boundaries;
184 return m_buildingBounds;
187 Building::BuildingType_t
190 return (m_buildingType);
193 Building::ExtWallsType_t
196 return (m_externalWalls);
220 return m_buildingBounds.
IsInside (position);
230 if (position.
x == m_buildingBounds.xMax)
236 double xLength = m_buildingBounds.xMax - m_buildingBounds.xMin;
237 double x = position.
x - m_buildingBounds.xMin;
238 n = floor (m_roomsX * x/xLength) + 1;
239 NS_LOG_LOGIC (
"xLength=" << xLength <<
", x=" << x <<
", m_roomsX=" << m_roomsX);
251 if (position.
y == m_buildingBounds.yMax)
257 double yLength = m_buildingBounds.yMax - m_buildingBounds.yMin;
258 double y = position.
y - m_buildingBounds.yMin;
259 n = floor (m_roomsY * y/yLength) + 1;
260 NS_LOG_LOGIC (
"yLength=" << yLength <<
", y=" << y <<
", m_roomsY=" << m_roomsY);
272 if (position.
z == m_buildingBounds.zMax)
278 double zLength = m_buildingBounds.zMax - m_buildingBounds.zMin;
279 double z = position.
z - m_buildingBounds.zMin;
280 n = floor (
m_floors * z/zLength) + 1;
uint16_t GetNFloors() const
#define NS_LOG_FUNCTION(parameters)
void SetNRoomsY(uint16_t nroomy)
ExtWallsType_t GetExtWallsType() const
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
uint16_t GetRoomY(Vector position) const
bool IsInside(Vector position) const
#define NS_FATAL_ERROR(msg)
fatal error handling
uint16_t GetNRoomsX() const
void SetNFloors(uint16_t nfloors)
#define NS_LOG_LOGIC(msg)
void SetExtWallsType(Building::ExtWallsType_t t)
static uint32_t Add(Ptr< Building > building)
uint16_t GetRoomX(Vector position) const
Box GetBoundaries() const
uint16_t GetNRoomsY() const
void SetNRoomsX(uint16_t nroomx)
uint32_t GetId(void) const
uint16_t GetFloor(Vector position) const
bool IsInside(const Vector &position) const
void SetBoundaries(Box box)
BuildingType_t GetBuildingType() const
void SetBuildingType(Building::BuildingType_t t)