A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
basic-energy-harvester-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
3 * University of Rochester, Rochester, NY, USA.
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Author: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
8 */
9
11
12#include "ns3/energy-harvester.h"
13
14namespace ns3
15{
16
21
25
26void
28{
30}
31
34{
35 NS_ASSERT(source);
36 Ptr<Node> node = source->GetNode();
37
38 // Create a new Basic Energy Harvester
41 NS_ASSERT(harvester);
42
43 // Connect the Basic Energy Harvester to the Energy Source
44 source->ConnectEnergyHarvester(harvester);
45 harvester->SetNode(node);
46 harvester->SetEnergySource(source);
47 return harvester;
48}
49
50} // namespace ns3
Hold a value for an Attribute.
Definition attribute.h:59
ObjectFactory m_basicEnergyHarvester
Energy source factory.
void Set(std::string name, const AttributeValue &v) override
Ptr< energy::EnergyHarvester > DoInstall(Ptr< energy::EnergySource > source) const override
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.
Smart pointer class similar to boost::intrusive_ptr.
Energy harvester base class.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
Every class exported by the ns3 library is enclosed in the ns3 namespace.