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
buildings-helper.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 CTTC
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
*/
8
9
#include "
buildings-helper.h
"
10
11
#include <ns3/abort.h>
12
#include <ns3/building-list.h>
13
#include <ns3/building.h>
14
#include <ns3/log.h>
15
#include <ns3/mobility-building-info.h>
16
#include <ns3/mobility-model.h>
17
#include <ns3/node-list.h>
18
19
namespace
ns3
20
{
21
22
NS_LOG_COMPONENT_DEFINE
(
"BuildingsHelper"
);
23
24
void
25
BuildingsHelper::Install
(
NodeContainer
c)
26
{
27
for
(
auto
i = c.
Begin
(); i != c.
End
(); ++i)
28
{
29
Install
(*i);
30
}
31
}
32
33
void
34
BuildingsHelper::Install
(
Ptr<Node>
node)
35
{
36
Ptr<Object>
object
= node;
37
Ptr<MobilityModel>
model =
object
->GetObject<
MobilityModel
>();
38
39
NS_ABORT_MSG_UNLESS
(model,
"node "
<< node->GetId() <<
" does not have a MobilityModel"
);
40
41
Ptr<MobilityBuildingInfo>
buildingInfo =
CreateObject<MobilityBuildingInfo>
();
42
model->AggregateObject(buildingInfo);
43
}
44
45
}
// namespace ns3
buildings-helper.h
ns3::BuildingsHelper::Install
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Definition
buildings-helper.cc:34
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition
mobility-model.h:29
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::NodeContainer::End
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Definition
node-container.cc:55
ns3::NodeContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Definition
node-container.cc:49
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
NS_ABORT_MSG_UNLESS
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition
abort.h:133
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
buildings
helper
buildings-helper.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0