A Discrete-Event Network Simulator
API
building-allocator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 INRIA
4  * Copyright (C) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Nicola Baldo <nbaldo@cttc.es> (took position-allocator and turned it into building-allocator)
21  */
22 #ifndef BUILDING_ALLOCATOR_H
23 #define BUILDING_ALLOCATOR_H
24 
25 #include "ns3/object.h"
26 #include "ns3/object-factory.h"
27 #include "ns3/vector.h"
28 #include "ns3/building-container.h"
29 #include "ns3/position-allocator.h"
30 
31 namespace ns3 {
32 
33 class Building;
34 
35 
45 {
46 public:
48  virtual ~GridBuildingAllocator ();
49 
54  static TypeId GetTypeId (void);
55 
62  void SetBuildingAttribute (std::string n, const AttributeValue &v);
63 
71  BuildingContainer Create (uint32_t n) const;
72 
73 private:
77  void PushAttributes () const;
78 
79  mutable uint32_t m_current;
81  double m_xMin;
82  double m_yMin;
83  uint32_t m_n;
84  double m_lengthX;
85  double m_lengthY;
86  double m_deltaX;
87  double m_deltaY;
88  double m_height;
89 
93 
94 };
95 
96 } // namespace ns3
97 
98 #endif /* BUILDING_ALLOCATOR_H */
Hold a value for an Attribute.
Definition: attribute.h:69
keep track of a set of building pointers.
Allocate buildings on a rectangular 2d grid.
enum GridPositionAllocator::LayoutType m_layoutType
Layout type.
void SetBuildingAttribute(std::string n, const AttributeValue &v)
Set an attribute to be used for each new building to be created.
static TypeId GetTypeId(void)
Get the type ID.
double m_yMin
The y coordinate where the grid starts.
ObjectFactory m_buildingFactory
The building factory.
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.
LayoutType
Determine whether positions are allocated row first or column first.
Instantiate subclasses of ns3::Object.
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.