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
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
18
*/
19
20
#ifndef APPLICATIONS_HELPER_H
21
#define APPLICATIONS_HELPER_H
22
23
#include "
application-container.h
"
24
#include "
node-container.h
"
25
26
#include <ns3/address.h>
27
#include <ns3/attribute.h>
28
#include <ns3/object-factory.h>
29
30
#include <string>
31
32
namespace
ns3
33
{
34
35
/**
36
* \brief A helper to make it easier to instantiate an application on a set of nodes.
37
*/
38
class
ApplicationHelper
39
{
40
public
:
41
/**
42
* Create an application of a given type ID
43
*
44
* @param typeId the type ID.
45
*/
46
explicit
ApplicationHelper
(
TypeId
typeId);
47
48
/**
49
* Create an application of a given type ID
50
*
51
* @param typeId the type ID expressed as a string.
52
*/
53
explicit
ApplicationHelper
(
const
std::string& typeId);
54
55
/**
56
* Allow the helper to be repurposed for another application type
57
*
58
* @param typeId the type ID.
59
*/
60
void
SetTypeId
(
TypeId
typeId);
61
62
/**
63
* Allow the helper to be repurposed for another application type
64
*
65
* @param typeId the type ID expressed as a string.
66
*/
67
void
SetTypeId
(
const
std::string& typeId);
68
69
/**
70
* Helper function used to set the underlying application attributes.
71
*
72
* @param name the name of the application attribute to set
73
* @param value the value of the application attribute to set
74
*/
75
void
SetAttribute
(
const
std::string& name,
const
AttributeValue
& value);
76
77
/**
78
* Install an application on each node of the input container
79
* configured with all the attributes set with SetAttribute.
80
*
81
* @param c NodeContainer of the set of nodes on which an application
82
* will be installed.
83
* @return Container of Ptr to the applications installed.
84
*/
85
ApplicationContainer
Install
(
NodeContainer
c);
86
87
/**
88
* Install an application on the node configured with all the
89
* attributes set with SetAttribute.
90
*
91
* @param node The node on which an application will be installed.
92
* @return Container of Ptr to the applications installed.
93
*/
94
ApplicationContainer
Install
(
Ptr<Node>
node);
95
96
/**
97
* Install an application on the node configured with all the
98
* attributes set with SetAttribute.
99
*
100
* @param nodeName The node on which an application will be installed.
101
* @return Container of Ptr to the applications installed.
102
*/
103
ApplicationContainer
Install
(
const
std::string& nodeName);
104
105
/**
106
* Assigns a unique (monotonically increasing) stream number to all applications that match the
107
* configured type of this application helper instance. Return the number of streams (possibly
108
* zero) that have been assigned. The Install() method should have previously been called by the
109
* user.
110
*
111
* @param stream first stream index to use
112
* @param c NodeContainer of the set of nodes for which the application should be modified to
113
* use a fixed stream
114
* @return the number of stream indices assigned by this helper
115
*/
116
int64_t
AssignStreams
(
NodeContainer
c, int64_t stream);
117
118
/**
119
* Assign a fixed random variable stream number to the random variables used by all the
120
* applications. Return the number of streams (possibly zero) that have been assigned. The
121
* Install() method should have previously been called by the user.
122
*
123
* @param stream first stream index to use
124
* @param c NodeContainer of the set of nodes for which their applications should be modified to
125
* use a fixed stream
126
* @return the number of stream indices assigned by this helper
127
*/
128
static
int64_t
AssignStreamsToAllApps
(
NodeContainer
c, int64_t stream);
129
130
protected
:
131
/**
132
* Install an application on the node configured with all the
133
* attributes set with SetAttribute.
134
*
135
* @param node The node on which an application will be installed.
136
* @return Ptr to the application installed.
137
*/
138
virtual
Ptr<Application>
DoInstall
(
Ptr<Node>
node);
139
140
ObjectFactory
m_factory
;
//!< Object factory.
141
};
142
143
}
// namespace ns3
144
145
#endif
/* APPLICATIONS_HELPER_H */
application-container.h
ns3::ApplicationContainer
holds a vector of ns3::Application pointers.
Definition:
application-container.h:44
ns3::ApplicationHelper
A helper to make it easier to instantiate an application on a set of nodes.
Definition:
application-helper.h:39
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:72
ns3::ApplicationHelper::m_factory
ObjectFactory m_factory
Object factory.
Definition:
application-helper.h:140
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:112
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:92
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:52
ns3::ApplicationHelper::SetTypeId
void SetTypeId(TypeId typeId)
Allow the helper to be repurposed for another application type.
Definition:
application-helper.cc:40
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:83
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:70
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition:
object-factory.h:48
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
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 Tue May 28 2024 23:38:27 for ns-3 by
1.9.6