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
application-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 DERONNE SOFTWARE ENGINEERING
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
7
*/
8
9
#ifndef APPLICATIONS_HELPER_H
10
#define APPLICATIONS_HELPER_H
11
12
#include "
application-container.h
"
13
#include "
node-container.h
"
14
15
#include <ns3/address.h>
16
#include <ns3/attribute.h>
17
#include <ns3/object-factory.h>
18
19
#include <string>
20
21
namespace
ns3
22
{
23
24
/**
25
* @brief A helper to make it easier to instantiate an application on a set of nodes.
26
*/
27
class
ApplicationHelper
28
{
29
public
:
30
/**
31
* Create an application of a given type ID
32
*
33
* @param typeId the type ID.
34
*/
35
explicit
ApplicationHelper
(
TypeId
typeId);
36
37
/**
38
* Create an application of a given type ID
39
*
40
* @param typeId the type ID expressed as a string.
41
*/
42
explicit
ApplicationHelper
(
const
std::string& typeId);
43
44
/**
45
* Allow the helper to be repurposed for another application type
46
*
47
* @param typeId the type ID.
48
*/
49
void
SetTypeId
(
TypeId
typeId);
50
51
/**
52
* Allow the helper to be repurposed for another application type
53
*
54
* @param typeId the type ID expressed as a string.
55
*/
56
void
SetTypeId
(
const
std::string& typeId);
57
58
/**
59
* Helper function used to set the underlying application attributes.
60
*
61
* @param name the name of the application attribute to set
62
* @param value the value of the application attribute to set
63
*/
64
void
SetAttribute
(
const
std::string& name,
const
AttributeValue
& value);
65
66
/**
67
* Install an application on each node of the input container
68
* configured with all the attributes set with SetAttribute.
69
*
70
* @param c NodeContainer of the set of nodes on which an application
71
* will be installed.
72
* @return Container of Ptr to the applications installed.
73
*/
74
ApplicationContainer
Install
(
NodeContainer
c);
75
76
/**
77
* Install an application on the node configured with all the
78
* attributes set with SetAttribute.
79
*
80
* @param node The node on which an application will be installed.
81
* @return Container of Ptr to the applications installed.
82
*/
83
ApplicationContainer
Install
(
Ptr<Node>
node);
84
85
/**
86
* Install an application on the node configured with all the
87
* attributes set with SetAttribute.
88
*
89
* @param nodeName The node on which an application will be installed.
90
* @return Container of Ptr to the applications installed.
91
*/
92
ApplicationContainer
Install
(
const
std::string& nodeName);
93
94
/**
95
* Assigns a unique (monotonically increasing) stream number to all applications that match the
96
* configured type of this application helper instance. Return the number of streams (possibly
97
* zero) that have been assigned. The Install() method should have previously been called by the
98
* user.
99
*
100
* @param stream first stream index to use
101
* @param c NodeContainer of the set of nodes for which the application should be modified to
102
* use a fixed stream
103
* @return the number of stream indices assigned by this helper
104
*/
105
int64_t
AssignStreams
(
NodeContainer
c, int64_t stream);
106
107
/**
108
* Assign a fixed random variable stream number to the random variables used by all the
109
* applications. Return the number of streams (possibly zero) that have been assigned. The
110
* Install() method should have previously been called by the user.
111
*
112
* @param stream first stream index to use
113
* @param c NodeContainer of the set of nodes for which their applications should be modified to
114
* use a fixed stream
115
* @return the number of stream indices assigned by this helper
116
*/
117
static
int64_t
AssignStreamsToAllApps
(
NodeContainer
c, int64_t stream);
118
119
protected
:
120
/**
121
* Install an application on the node configured with all the
122
* attributes set with SetAttribute.
123
*
124
* @param node The node on which an application will be installed.
125
* @return Ptr to the application installed.
126
*/
127
virtual
Ptr<Application>
DoInstall
(
Ptr<Node>
node);
128
129
ObjectFactory
m_factory
;
//!< Object factory.
130
};
131
132
}
// namespace ns3
133
134
#endif
/* APPLICATIONS_HELPER_H */
application-container.h
ns3::ApplicationContainer
holds a vector of ns3::Application pointers.
Definition
application-container.h:33
ns3::ApplicationHelper
A helper to make it easier to instantiate an application on a set of nodes.
Definition
application-helper.h:28
ns3::ApplicationHelper::Install
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
Definition
application-helper.cc:61
ns3::ApplicationHelper::m_factory
ObjectFactory m_factory
Object factory.
Definition
application-helper.h:129
ns3::ApplicationHelper::AssignStreamsToAllApps
static int64_t AssignStreamsToAllApps(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by all the applications.
Definition
application-helper.cc:101
ns3::ApplicationHelper::ApplicationHelper
ApplicationHelper(TypeId typeId)
Create an application of a given type ID.
Definition
application-helper.cc:18
ns3::ApplicationHelper::AssignStreams
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assigns a unique (monotonically increasing) stream number to all applications that match the configur...
Definition
application-helper.cc:81
ns3::ApplicationHelper::SetAttribute
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Definition
application-helper.cc:41
ns3::ApplicationHelper::SetTypeId
void SetTypeId(TypeId typeId)
Allow the helper to be repurposed for another application type.
Definition
application-helper.cc:29
ns3::ApplicationHelper::DoInstall
virtual Ptr< Application > DoInstall(Ptr< Node > node)
Install an application on the node configured with all the attributes set with SetAttribute.
Definition
application-helper.cc:72
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition
object-factory.h:37
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
node-container.h
src
network
helper
application-helper.h
Generated on Fri Dec 13 2024 09:20:46 for ns-3 by
1.11.0