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
flent-helper.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
* Copyright (c) 2022 NITK Surathkal
4
*
5
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* This file is adapted from bulk-send-helper.cc.
8
*
9
* Author: Ameya Deshpande <ameyanrd@outlook.com>
10
*/
11
12
#include "
flent-helper.h
"
13
14
#include "ns3/names.h"
15
#include "ns3/string.h"
16
17
namespace
ns3
18
{
19
20
FlentHelper::FlentHelper
(std::string testname,
Address
address)
21
{
22
m_factory
.SetTypeId(
"ns3::FlentApplication"
);
23
m_factory
.Set(
"TestName"
,
StringValue
(testname));
24
m_factory
.Set(
"HostAddress"
,
AddressValue
(address));
25
}
26
27
void
28
FlentHelper::SetAttribute
(std::string name,
const
AttributeValue
& value)
29
{
30
m_factory
.Set(name, value);
31
}
32
33
void
34
FlentHelper::SetTestStartTime
(
Time
start)
35
{
36
m_startTime
= start;
37
38
m_factory
.Set(
"StartTime"
,
TimeValue
(
m_startTime
));
39
}
40
41
void
42
FlentHelper::SetTestLength
(
Time
length)
43
{
44
m_length
= length;
45
46
m_factory
.Set(
"Length"
,
TimeValue
(length));
47
}
48
49
Time
50
FlentHelper::GetStopTime
()
const
51
{
52
return
m_startTime
+
m_length
+
Seconds
(10);
53
}
54
55
ApplicationContainer
56
FlentHelper::Install
(
Ptr<Node>
node)
const
57
{
58
return
ApplicationContainer
(
InstallPriv
(node));
59
}
60
61
ApplicationContainer
62
FlentHelper::Install
(std::string nodeName)
const
63
{
64
Ptr<Node>
node =
Names::Find<Node>
(nodeName);
65
return
ApplicationContainer
(
InstallPriv
(node));
66
}
67
68
Ptr<Application>
69
FlentHelper::InstallPriv
(
Ptr<Node>
node)
const
70
{
71
Ptr<Application>
app =
m_factory
.Create<
Application
>();
72
node->AddApplication(app);
73
74
return
app;
75
}
76
77
}
// namespace ns3
ns3::Address
a polymophic address class
Definition
address.h:114
ns3::AddressValue
Definition
address.h:329
ns3::ApplicationContainer
holds a vector of ns3::Application pointers.
Definition
application-container.h:33
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::FlentHelper::InstallPriv
Ptr< Application > InstallPriv(Ptr< Node > node) const
Install an ns3::FlentApplication on the node configured with all the attributes set with SetAttribute...
Definition
flent-helper.cc:69
ns3::FlentHelper::SetTestLength
void SetTestLength(Time length)
Set the length of the Flent test.
Definition
flent-helper.cc:42
ns3::FlentHelper::m_length
Time m_length
The duration of the Flent test.
Definition
flent-helper.h:97
ns3::FlentHelper::m_startTime
Time m_startTime
The start time of the Flent test.
Definition
flent-helper.h:96
ns3::FlentHelper::SetTestStartTime
void SetTestStartTime(Time start)
Set the test start time.
Definition
flent-helper.cc:34
ns3::FlentHelper::FlentHelper
FlentHelper(std::string testname, Address address)
Create an FlentHelper to make it easier to work with FlentApplication.
Definition
flent-helper.cc:20
ns3::FlentHelper::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Definition
flent-helper.cc:28
ns3::FlentHelper::GetStopTime
Time GetStopTime() const
Get the overall stop time of the simulation.
Definition
flent-helper.cc:50
ns3::FlentHelper::m_factory
ObjectFactory m_factory
Object factory.
Definition
flent-helper.h:95
ns3::FlentHelper::Install
ApplicationContainer Install(Ptr< Node > node) const
Install an ns3::FlentApplication on the node configured with all the attributes set with SetAttribute...
Definition
flent-helper.cc:56
ns3::Names::Find
static Ptr< T > Find(std::string path)
Given a name path string, look to see if there's an object in the system with that associated to it.
Definition
names.h:445
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:70
ns3::StringValue
Hold variables of type string.
Definition
string.h:45
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:95
ns3::TimeValue
Definition
nstime.h:1415
flent-helper.h
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition
nstime.h:1313
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
applications
helper
flent-helper.cc
Generated on
for ns-3 by
1.16.1