A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Building Class Reference

a 3d building block More...

#include "building.h"

+ Inheritance diagram for ns3::Building:
+ Collaboration diagram for ns3::Building:

Public Types

enum  BuildingType_t { Residential , Office , Commercial }
 Building type enum. More...
 
enum  ExtWallsType_t { Wood , ConcreteWithWindows , ConcreteWithoutWindows , StoneBlocks }
 External building wall type enum. More...
 

Public Member Functions

 Building ()
 Create a zero-sized building located at coordinates (0.0,0.0,0.0) and with 1 floors and 1 room.
 
 Building (double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
 Construct a simple building with 1 room and 1 floor.
 
 ~Building () override
 Destructor.
 
void DoDispose () override
 Destructor implementation.
 
Box GetBoundaries () const
 
BuildingType_t GetBuildingType () const
 
ExtWallsType_t GetExtWallsType () const
 
uint16_t GetFloor (Vector position) const
 
uint32_t GetId () const
 
uint16_t GetNFloors () const
 
uint16_t GetNRoomsX () const
 
uint16_t GetNRoomsY () const
 
uint16_t GetRoomX (Vector position) const
 
uint16_t GetRoomY (Vector position) const
 
bool IsInside (Vector position) const
 
bool IsIntersect (const Vector &l1, const Vector &l2) const
 Checks if a line-segment between position l1 and position l2 intersects a building.
 
void SetBoundaries (Box box)
 Set the boundaries of the building.
 
void SetBuildingType (Building::BuildingType_t t)
 
void SetExtWallsType (Building::ExtWallsType_t t)
 
void SetNFloors (uint16_t nfloors)
 
void SetNRoomsX (uint16_t nroomx)
 
void SetNRoomsY (uint16_t nroomy)
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Private Attributes

Box m_buildingBounds
 Building boundaries.
 
uint32_t m_buildingId
 Building ID number.
 
BuildingType_t m_buildingType
 Building type.
 
ExtWallsType_t m_externalWalls
 External building wall type.
 
uint16_t m_floors
 number of floors, must be greater than 0, and 1 means only one floor (i.e., groundfloor)
 
uint16_t m_roomsX
 X Room coordinate.
 
uint16_t m_roomsY
 Y Room coordinate.
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Detailed Description

a 3d building block

Introspection did not find any typical Config paths.


Attributes

  • Boundaries: The boundaries of this Building as a value of type ns3::Box
    • Set with class: ns3::BoxValue
    • Underlying type: Box
    • Initial value: 0|0|0|0|0|0
    • Flags: constructwriteread
  • ExternalWallsType: The type of material of which the external walls are made
  • Id: The id (unique integer) of this Building.
  • NFloors: The number of floors of this building.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: constructwriteread
  • NRoomsX: The number of rooms in the X axis.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: constructwriteread
  • NRoomsY: The number of rooms in the Y axis.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: constructwriteread
  • Type: The type of building

No TraceSources are defined for this type.
Size of this type is 128 bytes (on a 64-bit architecture).

Definition at line 43 of file building.h.

Member Enumeration Documentation

◆ BuildingType_t

Building type enum.

Enumerator
Residential 
Office 
Commercial 

Definition at line 56 of file building.h.

◆ ExtWallsType_t

External building wall type enum.

Enumerator
Wood 
ConcreteWithWindows 
ConcreteWithoutWindows 
StoneBlocks 

Definition at line 66 of file building.h.

Constructor & Destructor Documentation

◆ Building() [1/2]

ns3::Building::Building ( double  xMin,
double  xMax,
double  yMin,
double  yMax,
double  zMin,
double  zMax 
)

Construct a simple building with 1 room and 1 floor.

Parameters
xMinx coordinates of left boundary.
xMaxx coordinates of right boundary.
yMiny coordinates of bottom boundary.
yMaxy coordinates of top boundary.
zMinz coordinates of down boundary.
zMaxz coordinates of up boundary.

Definition at line 100 of file building.cc.

References NS_FATAL_ERROR.

◆ Building() [2/2]

ns3::Building::Building ( )

Create a zero-sized building located at coordinates (0.0,0.0,0.0) and with 1 floors and 1 room.

Definition at line 118 of file building.cc.

References ns3::BuildingList::Add(), m_buildingId, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ ~Building()

ns3::Building::~Building ( )
override

Destructor.

Definition at line 124 of file building.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ DoDispose()

void ns3::Building::DoDispose ( )
overridevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 130 of file building.cc.

References NS_LOG_FUNCTION.

◆ GetBoundaries()

Box ns3::Building::GetBoundaries ( ) const
Returns
the boundaries of the building

Definition at line 185 of file building.cc.

References m_buildingBounds, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetBuildingType()

Building::BuildingType_t ns3::Building::GetBuildingType ( ) const
Returns
the type of building

Definition at line 192 of file building.cc.

References m_buildingType.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetExtWallsType()

Building::ExtWallsType_t ns3::Building::GetExtWallsType ( ) const
Returns
the type of external walls of the building

Definition at line 198 of file building.cc.

References m_externalWalls.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetFloor()

uint16_t ns3::Building::GetFloor ( Vector  position) const
Parameters
positiona position inside the building
Returns
the floor where the position falls

Definition at line 270 of file building.cc.

References IsInside(), m_buildingBounds, m_floors, NS_ASSERT, NS_LOG_LOGIC, ns3::Box::zMax, and ns3::Box::zMin.

+ Here is the call graph for this function:

◆ GetId()

uint32_t ns3::Building::GetId ( ) const
Returns
the unique id of this Building. This unique id happens to be also the index of the Building into the BuildingList.

Definition at line 136 of file building.cc.

References m_buildingId, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetNFloors()

uint16_t ns3::Building::GetNFloors ( ) const
Returns
the number of floors of the building

Definition at line 204 of file building.cc.

References m_floors.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetNRoomsX()

uint16_t ns3::Building::GetNRoomsX ( ) const
Returns
the number of rooms along the x-axis of the building

Definition at line 210 of file building.cc.

References m_roomsX.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetNRoomsY()

uint16_t ns3::Building::GetNRoomsY ( ) const
Returns
the number of rooms along the y-axis

Definition at line 216 of file building.cc.

References m_roomsY.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetRoomX()

uint16_t ns3::Building::GetRoomX ( Vector  position) const
Parameters
positiona position inside the building
Returns
the number of the room along the X axis where the position falls

Definition at line 228 of file building.cc.

References IsInside(), m_buildingBounds, m_roomsX, NS_ASSERT, NS_LOG_LOGIC, ns3::Box::xMax, and ns3::Box::xMin.

+ Here is the call graph for this function:

◆ GetRoomY()

uint16_t ns3::Building::GetRoomY ( Vector  position) const
Parameters
positiona position inside the building
Returns
the number of the room along the Y axis where the position falls

Definition at line 249 of file building.cc.

References IsInside(), m_buildingBounds, m_roomsY, NS_ASSERT, NS_LOG_LOGIC, ns3::Box::yMax, and ns3::Box::yMin.

+ Here is the call graph for this function:

◆ GetTypeId()

TypeId ns3::Building::GetTypeId ( )
static

Get the type ID.

Returns
The object TypeId.

Definition at line 41 of file building.cc.

References Commercial, ConcreteWithoutWindows, ConcreteWithWindows, GetBoundaries(), GetBuildingType(), GetExtWallsType(), GetId(), GetNFloors(), GetNRoomsX(), GetNRoomsY(), ns3::MakeBoxAccessor(), ns3::MakeBoxChecker(), ns3::MakeEnumChecker(), ns3::MakeUintegerAccessor(), Office, Residential, SetBoundaries(), SetBuildingType(), SetExtWallsType(), SetNFloors(), SetNRoomsX(), SetNRoomsY(), ns3::TypeId::SetParent(), StoneBlocks, and Wood.

+ Here is the call graph for this function:

◆ IsInside()

bool ns3::Building::IsInside ( Vector  position) const
Parameters
positionsome position
Returns
true if the position fall inside the building, false otherwise

Definition at line 222 of file building.cc.

References ns3::Box::IsInside(), and m_buildingBounds.

Referenced by GetFloor(), GetRoomX(), and GetRoomY().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsIntersect()

bool ns3::Building::IsIntersect ( const Vector &  l1,
const Vector &  l2 
) const

Checks if a line-segment between position l1 and position l2 intersects a building.

Parameters
l1position
l2position
Returns
true if there is a intersection, false otherwise

Definition at line 291 of file building.cc.

References ns3::Box::IsIntersect(), and m_buildingBounds.

+ Here is the call graph for this function:

◆ SetBoundaries()

void ns3::Building::SetBoundaries ( Box  box)

Set the boundaries of the building.

Parameters
boxthe Box defining the boundaries of the building

Definition at line 143 of file building.cc.

References m_buildingBounds, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetBuildingType()

void ns3::Building::SetBuildingType ( Building::BuildingType_t  t)
Parameters
tthe type of building (i.e., Residential, Office, Commercial)

This method allows to set building type (default is Residential)

Definition at line 150 of file building.cc.

References m_buildingType, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetExtWallsType()

void ns3::Building::SetExtWallsType ( Building::ExtWallsType_t  t)
Parameters
tthe type of external walls (i.e., Wood, ConcreteWithWindows, ConcreteWithoutWindows and StoneBlocks), used for evaluating the loss due to the penetration of external walls in outdoor <-> indoor comm.

This method allows to set external walls type (default is Residential)

Definition at line 157 of file building.cc.

References m_externalWalls, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetNFloors()

void ns3::Building::SetNFloors ( uint16_t  nfloors)
Parameters
nfloorsthe number of floors in the building

This method allows to set the number of floors in the building (default is 1)

Definition at line 164 of file building.cc.

References m_floors, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetNRoomsX()

void ns3::Building::SetNRoomsX ( uint16_t  nroomx)
Parameters
nroomxthe number of rooms along the x axis

This method allows to set the number of rooms along the x-axis

Definition at line 171 of file building.cc.

References m_roomsX, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetNRoomsY()

void ns3::Building::SetNRoomsY ( uint16_t  nroomy)
Parameters
nroomythe number of floors in the building

This method allows to set the number of rooms along the y-axis

Definition at line 178 of file building.cc.

References m_roomsY, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_buildingBounds

Box ns3::Building::m_buildingBounds
private

Building boundaries.

Definition at line 228 of file building.h.

Referenced by GetBoundaries(), GetFloor(), GetRoomX(), GetRoomY(), IsInside(), IsIntersect(), and SetBoundaries().

◆ m_buildingId

uint32_t ns3::Building::m_buildingId
private

Building ID number.

Definition at line 238 of file building.h.

Referenced by Building(), and GetId().

◆ m_buildingType

BuildingType_t ns3::Building::m_buildingType
private

Building type.

Definition at line 239 of file building.h.

Referenced by GetBuildingType(), and SetBuildingType().

◆ m_externalWalls

ExtWallsType_t ns3::Building::m_externalWalls
private

External building wall type.

Definition at line 240 of file building.h.

Referenced by GetExtWallsType(), and SetExtWallsType().

◆ m_floors

uint16_t ns3::Building::m_floors
private

number of floors, must be greater than 0, and 1 means only one floor (i.e., groundfloor)

Definition at line 234 of file building.h.

Referenced by GetFloor(), GetNFloors(), and SetNFloors().

◆ m_roomsX

uint16_t ns3::Building::m_roomsX
private

X Room coordinate.

Definition at line 235 of file building.h.

Referenced by GetNRoomsX(), GetRoomX(), and SetNRoomsX().

◆ m_roomsY

uint16_t ns3::Building::m_roomsY
private

Y Room coordinate.

Definition at line 236 of file building.h.

Referenced by GetNRoomsY(), GetRoomY(), and SetNRoomsY().


The documentation for this class was generated from the following files: