A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
building-allocator.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 INRIA
3
* Copyright (C) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4
*
5
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8
* Author: Nicola Baldo <nbaldo@cttc.es> (took position-allocator and turned it into
9
* building-allocator)
10
*/
11
#ifndef BUILDING_ALLOCATOR_H
12
#define BUILDING_ALLOCATOR_H
13
14
#include "
building-container.h
"
15
16
#include "ns3/object-factory.h"
17
#include "ns3/object.h"
18
#include "ns3/position-allocator.h"
19
#include "ns3/vector.h"
20
21
namespace
ns3
22
{
23
24
class
Building;
25
26
/**
27
* \ingroup buildings
28
* \brief Allocate buildings on a rectangular 2d grid.
29
*
30
* This class allows to create a set of buildings positioned on a
31
* rectangular 2D grid. Under the hood, this class uses two instances
32
* of GridPositionAllocator.
33
*/
34
class
GridBuildingAllocator
:
public
Object
35
{
36
public
:
37
GridBuildingAllocator
();
38
~GridBuildingAllocator
()
override
;
39
40
/**
41
* \brief Get the type ID.
42
* \return The object TypeId.
43
*/
44
static
TypeId
GetTypeId
();
45
46
/**
47
* Set an attribute to be used for each new building to be created
48
*
49
* \param n attribute name
50
* \param v attribute value
51
*/
52
void
SetBuildingAttribute
(std::string n,
const
AttributeValue
& v);
53
54
/**
55
* Create a set of buildings allocated on a grid
56
*
57
* \param n the number of buildings to create
58
*
59
* \return the BuildingContainer that contains the newly created buildings
60
*/
61
BuildingContainer
Create
(
uint32_t
n)
const
;
62
63
private
:
64
/**
65
* Pushes the attributes into the relevant position allocators
66
*/
67
void
PushAttributes
()
const
;
68
69
mutable
uint32_t
m_current
;
//!< Current building number
70
GridPositionAllocator::LayoutType
m_layoutType
;
//!< Layout type
71
double
m_xMin
;
//!< The x coordinate where the grid starts
72
double
m_yMin
;
//!< The y coordinate where the grid starts
73
uint32_t
m_n
;
//!< The number of objects laid out on a line
74
double
m_lengthX
;
//!< The length of the wall of each building along the X axis.
75
double
m_lengthY
;
//!< The length of the wall of each building along the Y axis.
76
double
m_deltaX
;
//!< The x space between buildings
77
double
m_deltaY
;
//!< The y space between buildings
78
double
m_height
;
//!< The height of the building (roof level)
79
80
mutable
ObjectFactory
m_buildingFactory
;
//!< The building factory
81
Ptr<GridPositionAllocator>
m_lowerLeftPositionAllocator
;
//!< The upper left position allocator
82
Ptr<GridPositionAllocator>
83
m_upperRightPositionAllocator
;
//!< The upper right position allocator
84
};
85
86
}
// namespace ns3
87
88
#endif
/* BUILDING_ALLOCATOR_H */
building-container.h
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::BuildingContainer
keep track of a set of building pointers.
Definition
building-container.h:33
ns3::GridBuildingAllocator
Allocate buildings on a rectangular 2d grid.
Definition
building-allocator.h:35
ns3::GridBuildingAllocator::GridBuildingAllocator
GridBuildingAllocator()
Definition
building-allocator.cc:28
ns3::GridBuildingAllocator::SetBuildingAttribute
void SetBuildingAttribute(std::string n, const AttributeValue &v)
Set an attribute to be used for each new building to be created.
Definition
building-allocator.cc:101
ns3::GridBuildingAllocator::~GridBuildingAllocator
~GridBuildingAllocator() override
Definition
building-allocator.cc:36
ns3::GridBuildingAllocator::m_yMin
double m_yMin
The y coordinate where the grid starts.
Definition
building-allocator.h:72
ns3::GridBuildingAllocator::m_buildingFactory
ObjectFactory m_buildingFactory
The building factory.
Definition
building-allocator.h:80
ns3::GridBuildingAllocator::m_layoutType
GridPositionAllocator::LayoutType m_layoutType
Layout type.
Definition
building-allocator.h:70
ns3::GridBuildingAllocator::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
building-allocator.cc:41
ns3::GridBuildingAllocator::m_xMin
double m_xMin
The x coordinate where the grid starts.
Definition
building-allocator.h:71
ns3::GridBuildingAllocator::m_n
uint32_t m_n
The number of objects laid out on a line.
Definition
building-allocator.h:73
ns3::GridBuildingAllocator::Create
BuildingContainer Create(uint32_t n) const
Create a set of buildings allocated on a grid.
Definition
building-allocator.cc:108
ns3::GridBuildingAllocator::m_deltaX
double m_deltaX
The x space between buildings.
Definition
building-allocator.h:76
ns3::GridBuildingAllocator::m_lowerLeftPositionAllocator
Ptr< GridPositionAllocator > m_lowerLeftPositionAllocator
The upper left position allocator.
Definition
building-allocator.h:81
ns3::GridBuildingAllocator::m_lengthX
double m_lengthX
The length of the wall of each building along the X axis.
Definition
building-allocator.h:74
ns3::GridBuildingAllocator::PushAttributes
void PushAttributes() const
Pushes the attributes into the relevant position allocators.
Definition
building-allocator.cc:129
ns3::GridBuildingAllocator::m_current
uint32_t m_current
Current building number.
Definition
building-allocator.h:69
ns3::GridBuildingAllocator::m_deltaY
double m_deltaY
The y space between buildings.
Definition
building-allocator.h:77
ns3::GridBuildingAllocator::m_height
double m_height
The height of the building (roof level)
Definition
building-allocator.h:78
ns3::GridBuildingAllocator::m_lengthY
double m_lengthY
The length of the wall of each building along the Y axis.
Definition
building-allocator.h:75
ns3::GridBuildingAllocator::m_upperRightPositionAllocator
Ptr< GridPositionAllocator > m_upperRightPositionAllocator
The upper right position allocator.
Definition
building-allocator.h:83
ns3::GridPositionAllocator::LayoutType
LayoutType
Determine whether positions are allocated row first or column first.
Definition
position-allocator.h:125
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition
object-factory.h:37
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
buildings
helper
building-allocator.h
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0