24 #include "ns3/building.h"
25 #include "ns3/double.h"
28 #include "ns3/uinteger.h"
55 TypeId(
"ns3::GridBuildingAllocator")
57 .AddConstructor<GridBuildingAllocator>()
58 .SetGroupName(
"Buildings")
59 .AddAttribute(
"GridWidth",
60 "The number of objects laid out on a line.",
63 MakeUintegerChecker<uint32_t>())
65 "The x coordinate where the grid starts.",
68 MakeDoubleChecker<double>())
70 "The y coordinate where the grid starts.",
73 MakeDoubleChecker<double>())
74 .AddAttribute(
"LengthX",
75 "The length of the wall of each building along the X axis.",
78 MakeDoubleChecker<double>())
79 .AddAttribute(
"LengthY",
80 "The length of the wall of each building along the X axis.",
83 MakeDoubleChecker<double>())
84 .AddAttribute(
"DeltaX",
85 "The x space between buildings.",
88 MakeDoubleChecker<double>())
89 .AddAttribute(
"DeltaY",
90 "The y space between buildings.",
93 MakeDoubleChecker<double>())
94 .AddAttribute(
"Height",
95 "The height of the building (roof level)",
98 MakeDoubleChecker<double>())
99 .AddAttribute(
"LayoutType",
100 "The type of layout.",
102 MakeEnumAccessor<GridPositionAllocator::LayoutType>(
129 Box box(lowerLeft.x, upperRight.x, lowerLeft.y, upperRight.y, 0,
m_height);
131 BoxValue boxValue(box);
Hold a value for an Attribute.
keep track of a set of building pointers.
void Add(BuildingContainer other)
Append the contents of another BuildingContainer to the end of this container.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
void SetBuildingAttribute(std::string n, const AttributeValue &v)
Set an attribute to be used for each new building to be created.
~GridBuildingAllocator() override
double m_yMin
The y coordinate where the grid starts.
ObjectFactory m_buildingFactory
The building factory.
GridPositionAllocator::LayoutType m_layoutType
Layout type.
static TypeId GetTypeId()
Get the type ID.
double m_xMin
The x coordinate where the grid starts.
uint32_t m_n
The number of objects laid out on a line.
BuildingContainer Create(uint32_t n) const
Create a set of buildings allocated on a grid.
double m_deltaX
The x space between buildings.
Ptr< GridPositionAllocator > m_lowerLeftPositionAllocator
The upper left position allocator.
double m_lengthX
The length of the wall of each building along the X axis.
void PushAttributes() const
Pushes the attributes into the relevant position allocators.
uint32_t m_current
Current building number.
double m_deltaY
The y space between buildings.
double m_height
The height of the building (roof level)
double m_lengthY
The length of the wall of each building along the Y axis.
Ptr< GridPositionAllocator > m_upperRightPositionAllocator
The upper right position allocator.
@ COLUMN_FIRST
In column-first mode, positions are allocated on the first column until N positions have been allocat...
@ ROW_FIRST
In row-first mode, positions are allocated on the first row until N positions have been allocated.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)