A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
sink-helper.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
3
4
/*
5
* Copyright (c) 2020 DLTLT
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation;
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
* Corresponding author: Niki Hrovatin <niki.hrovatin@famnit.upr.si>
21
*/
22
23
24
#include "
sink-helper.h
"
25
26
namespace
ns3
{
27
28
//Zagotovi, da se registrira TypeId
29
NS_OBJECT_ENSURE_REGISTERED (SinkHelper);
30
31
TypeId
32
SinkHelper::GetTypeId
(
void
)
33
{
34
static
TypeId tid = TypeId (
"ns3::SinkHelper"
).SetParent<Object> ().AddConstructor<SinkHelper> ();
35
36
return
tid;
37
}
38
39
SinkHelper::SinkHelper
() : m_numnodes (0)
40
{
41
m_factory
.SetTypeId (
"ns3::Sink"
);
42
}
43
44
SinkHelper::SinkHelper
(uint16_t numnodes, Ptr<OutputManager> outputManager,
45
Ptr<OnionValidator> onionValidator, uint16_t *m_onionPathLengths)
46
: m_numnodes (numnodes), m_outputManager (outputManager), m_onionValidator (onionValidator)
47
{
48
m_factory
.SetTypeId (
"ns3::Sink"
);
49
m_factory
.Set (
"NumNodes"
, UintegerValue (
m_numnodes
));
50
m_factory
.Set (
"OutputManager"
, PointerValue (
m_outputManager
));
51
m_factory
.Set (
"OnionValidator"
, PointerValue (
m_onionValidator
));
52
}
53
54
SinkHelper::~SinkHelper
()
55
{
56
}
57
58
void
59
SinkHelper::SetAttribute
(std::string name,
const
AttributeValue &value)
60
{
61
m_factory
.Set (name, value);
62
}
63
64
ApplicationContainer
65
SinkHelper::Install
(NodeContainer c)
const
66
{
67
ApplicationContainer apps;
68
for
(NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
69
{
70
apps.Add (
InstallPriv
(*i));
71
}
72
73
return
apps;
74
}
75
76
Ptr<Application>
77
SinkHelper::InstallPriv
(Ptr<Node> node)
const
78
{
79
Ptr<Application> app =
m_factory
.Create<Application> ();
80
81
node->AddApplication (app);
82
83
return
app;
84
}
85
86
}
// namespace ns3
ns3
Definition:
sensornode-helper.cc:26
ns3::SinkHelper::InstallPriv
Ptr< Application > InstallPriv(Ptr< Node > node) const
Definition:
sink-helper.cc:77
ns3::SinkHelper::~SinkHelper
~SinkHelper()
Default constructor.
Definition:
sink-helper.cc:54
ns3::SinkHelper::SinkHelper
SinkHelper()
Default constructor.
Definition:
sink-helper.cc:39
ns3::SinkHelper::m_numnodes
uint16_t m_numnodes
Number of sensor nodes in the network.
Definition:
sink-helper.h:123
ns3::SinkHelper::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Setter of individual attributes.
Definition:
sink-helper.cc:59
ns3::SinkHelper::m_factory
ObjectFactory m_factory
factory object
Definition:
sink-helper.h:124
ns3::SinkHelper::m_outputManager
Ptr< OutputManager > m_outputManager
Manage the output of the simulation.
Definition:
sink-helper.h:125
ns3::SinkHelper::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
sink-helper.cc:32
sink-helper.h
ns3::SinkHelper::m_onionValidator
Ptr< OnionValidator > m_onionValidator
Manage onions and when to abort them.
Definition:
sink-helper.h:126
ns3::SinkHelper::Install
ApplicationContainer Install(NodeContainer c) const
Definition:
sink-helper.cc:65
src
onion_routing_wsn
helper
sink-helper.cc
Generated on Mon Feb 7 2022 13:31:58 for ns-3 by
1.8.17