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
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
10
#include "
basic-energy-harvester-helper.h
"
11
12
#include "ns3/energy-harvester.h"
13
14
namespace
ns3
15
{
16
17
BasicEnergyHarvesterHelper::BasicEnergyHarvesterHelper
()
18
{
19
m_basicEnergyHarvester
.
SetTypeId
(
"ns3::energy::BasicEnergyHarvester"
);
20
}
21
22
BasicEnergyHarvesterHelper::~BasicEnergyHarvesterHelper
()
23
{
24
}
25
26
void
27
BasicEnergyHarvesterHelper::Set
(std::string name,
const
AttributeValue
& v)
28
{
29
m_basicEnergyHarvester
.
Set
(name, v);
30
}
31
32
Ptr<energy::EnergyHarvester>
33
BasicEnergyHarvesterHelper::DoInstall
(
Ptr<energy::EnergySource>
source)
const
34
{
35
NS_ASSERT
(source);
36
Ptr<Node>
node = source->GetNode();
37
38
// Create a new Basic Energy Harvester
39
Ptr<energy::EnergyHarvester>
harvester =
40
m_basicEnergyHarvester
.
Create
<
energy::EnergyHarvester
>();
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
basic-energy-harvester-helper.h
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::BasicEnergyHarvesterHelper::m_basicEnergyHarvester
ObjectFactory m_basicEnergyHarvester
Energy source factory.
Definition
basic-energy-harvester-helper.h:37
ns3::BasicEnergyHarvesterHelper::Set
void Set(std::string name, const AttributeValue &v) override
Definition
basic-energy-harvester-helper.cc:27
ns3::BasicEnergyHarvesterHelper::~BasicEnergyHarvesterHelper
~BasicEnergyHarvesterHelper() override
Definition
basic-energy-harvester-helper.cc:22
ns3::BasicEnergyHarvesterHelper::DoInstall
Ptr< energy::EnergyHarvester > DoInstall(Ptr< energy::EnergySource > source) const override
Definition
basic-energy-harvester-helper.cc:33
ns3::BasicEnergyHarvesterHelper::BasicEnergyHarvesterHelper
BasicEnergyHarvesterHelper()
Definition
basic-energy-harvester-helper.cc:17
ns3::ObjectFactory::Create
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
Definition
object-factory.cc:82
ns3::ObjectFactory::Set
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Definition
object-factory.h:213
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition
object-factory.cc:31
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::energy::EnergyHarvester
Energy harvester base class.
Definition
energy-harvester.h:36
NS_ASSERT
#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
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
helper
basic-energy-harvester-helper.cc
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0