A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
one-shot-sender-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 University of Padova
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
10
11#include "ns3/double.h"
12#include "ns3/log.h"
13#include "ns3/one-shot-sender.h"
14#include "ns3/simulator.h"
15#include "ns3/string.h"
16#include "ns3/trace-source-accessor.h"
17
18namespace ns3
19{
20namespace lorawan
21{
22
23NS_LOG_COMPONENT_DEFINE("OneShotSenderHelper");
24
29
33
34void
36{
37 m_sendTime = sendTime;
38}
39
40void
42{
43 m_factory.Set(name, value);
44}
45
51
54{
56 for (auto i = c.Begin(); i != c.End(); ++i)
57 {
58 apps.Add(InstallPriv(*i));
59 }
60
61 return apps;
62}
63
66{
67 NS_LOG_FUNCTION(this << node->GetId());
68
70
71 app->SetSendTime(m_sendTime);
72
73 app->SetNode(node);
74 node->AddApplication(app);
75
76 return app;
77}
78} // namespace lorawan
79} // namespace ns3
holds a vector of ns3::Application pointers.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Hold a value for an Attribute.
Definition attribute.h:59
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
void SetSendTime(Time sendTime)
Set the send time of the applications.
ObjectFactory m_factory
The object factory.
Time m_sendTime
Time at which the OneShotSender applications will be configured to send the packet.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
ApplicationContainer Install(NodeContainer c) const
Install a OneShotSender application on each node of the input container configured with all the attri...
Ptr< Application > InstallPriv(Ptr< Node > node) const
Install a OneShotSender application on the input Node configured with all the attributes set with Set...
Packet sender application to send a single packet.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.