A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
application-container.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
10
11#include "ns3/log.h"
12#include "ns3/names.h"
13
14namespace ns3
15{
16
17NS_LOG_COMPONENT_DEFINE("ApplicationContainer");
18
22
27
33
36{
37 return m_applications.begin();
38}
39
42{
43 return m_applications.end();
44}
45
48{
49 return m_applications.size();
50}
51
54{
55 return m_applications[i];
56}
57
58void
60{
61 for (auto i = other.Begin(); i != other.End(); i++)
62 {
63 m_applications.push_back(*i);
64 }
65}
66
67void
69{
70 m_applications.push_back(application);
71}
72
73void
75{
77 m_applications.push_back(application);
78}
79
80void
82{
83 for (auto i = Begin(); i != End(); ++i)
84 {
85 Ptr<Application> app = *i;
86 app->SetStartTime(start);
87 }
88}
89
90void
92{
93 for (auto i = Begin(); i != End(); ++i)
94 {
95 Ptr<Application> app = *i;
96 double value = rv->GetValue();
97 NS_LOG_DEBUG("Start application at time " << start.GetSeconds() + value << "s");
98 app->SetStartTime(start + Seconds(value));
99 }
100}
101
102void
104{
105 for (auto i = Begin(); i != End(); ++i)
106 {
107 Ptr<Application> app = *i;
108 app->SetStopTime(stop);
109 }
110}
111
112} // namespace ns3
holds a vector of ns3::Application pointers.
std::vector< Ptr< Application > > m_applications
Applications smart pointers.
Iterator Begin() const
Get an iterator which refers to the first Application in the container.
Iterator End() const
Get an iterator which indicates past-the-last Application in the container.
std::vector< Ptr< Application > >::const_iterator Iterator
Application container iterator.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void StartWithJitter(Time start, Ptr< RandomVariableStream > rv) const
Start all of the Applications in this container at the start time given as a parameter,...
ApplicationContainer()
Create an empty ApplicationContainer.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
uint32_t GetN() const
Get the number of Ptr<Application> stored in this container.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
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:443
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.