A Discrete-Event Network Simulator
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
19namespace ns3
20{
21
22NS_LOG_COMPONENT_DEFINE("BuildingsHelper");
23
24void
26{
27 for (auto i = c.Begin(); i != c.End(); ++i)
28 {
29 Install(*i);
30 }
31}
32
33void
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
42 model->AggregateObject(buildingInfo);
43}
44
45} // namespace ns3
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Keep track of the current position and velocity of an object.
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition abort.h:133
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Every class exported by the ns3 library is enclosed in the ns3 namespace.