A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
remote-channel-bundle.h
Go to the documentation of this file.
1/*
2 * Copyright 2013. Lawrence Livermore National Security, LLC.
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: Steven Smith <smith84@llnl.gov>
18 *
19 */
20
21/**
22 * \file
23 * \ingroup mpi
24 * Declaration of class ns3::RemoteChannelBundle.
25 */
26
27#ifndef NS3_REMOTE_CHANNEL_BUNDLE
28#define NS3_REMOTE_CHANNEL_BUNDLE
29
31
32#include <ns3/channel.h>
33#include <ns3/pointer.h>
34#include <ns3/ptr.h>
35
36#include <unordered_map>
37
38namespace ns3
39{
40
41/**
42 * \ingroup mpi
43 *
44 * \brief Collection of ns-3 channels between local and remote nodes.
45 *
46 * An instance exists for each remote system that the local system is
47 * in communication with. These are created and managed by the
48 * RemoteChannelBundleManager class. Stores time information for each
49 * bundle.
50 */
52{
53 public:
54 /**
55 * Register this type.
56 * \return The object TypeId.
57 */
58 static TypeId GetTypeId();
59
60 /** Default constructor. */
62
63 /**
64 * Construct and assign system Id.
65 * \param [in] remoteSystemId The system id.
66 */
67 RemoteChannelBundle(const uint32_t remoteSystemId);
68
69 /** Destructor. */
71 {
72 }
73
74 /**
75 * Add a channel to this bundle.
76 * \param channel to add to the bundle
77 * \param delay time for the channel (usually the latency)
78 */
79 void AddChannel(Ptr<Channel> channel, Time delay);
80
81 /**
82 * Get the system Id for this side.
83 * \return SystemID for remote side of this bundle
84 */
85 uint32_t GetSystemId() const;
86
87 /**
88 * Get the current guarantee time for this bundle.
89 * \return guarantee time
90 */
91 Time GetGuaranteeTime() const;
92
93 /**
94 * Set the guarantee time for the bundle. This should be called
95 * after a packet or Null Message received.
96 *
97 * \param time The guarantee time.
98 */
99 void SetGuaranteeTime(Time time);
100
101 /**
102 * Get the minimum delay along any channel in this bundle
103 * \return The minimum delay.
104 */
105 Time GetDelay() const;
106
107 /**
108 * Set the event ID of the Null Message send event currently scheduled
109 * for this channel.
110 *
111 * \param [in] id The null message event id.
112 */
113 void SetEventId(EventId id);
114
115 /**
116 * Get the event ID of the Null Message send event for this bundle
117 * \return The null message event id.
118 */
119 EventId GetEventId() const;
120
121 /**
122 * Get the number of ns-3 channels in this bundle
123 * \return The number of channels.
124 */
125 std::size_t GetSize() const;
126
127 /**
128 * Send Null Message to the remote task associated with this bundle.
129 * Message will be delivered at current simulation time + the time
130 * passed in.
131 *
132 * \param time The delay from now when the null message should be received.
133 */
134 void Send(Time time);
135
136 /**
137 * Output for debugging purposes.
138 *
139 * \param [in,out] out The stream.
140 * \param [in] bundle The bundle to print.
141 * \return The stream.
142 */
143 friend std::ostream& operator<<(std::ostream& out, ns3::RemoteChannelBundle& bundle);
144
145 private:
146 /** Remote rank. */
148
149 /**
150 * Container of channels that are connected from nodes in this MPI task
151 * to nodes in a remote rank.
152 */
153 typedef std::unordered_map<uint32_t, Ptr<Channel>> ChannelMap;
154 ChannelMap m_channels; /**< ChannelId to Channel map */
155
156 /**
157 * Guarantee time for the incoming Channels from MPI task remote_rank.
158 * No PacketMessage will ever arrive on any incoming channel
159 * in this bundle with a ReceiveTime less than this.
160 * Initialized to StartTime.
161 */
163
164 /**
165 * Delay for this Channel bundle, which is
166 * the min link delay over all incoming channels;
167 */
169
170 /** Event scheduled to send Null Message for this bundle. */
172};
173
174} // namespace ns3
175
176#endif
An identifier for simulation events.
Definition: event-id.h:55
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Collection of ns-3 channels between local and remote nodes.
std::unordered_map< uint32_t, Ptr< Channel > > ChannelMap
Container of channels that are connected from nodes in this MPI task to nodes in a remote rank.
Time m_delay
Delay for this Channel bundle, which is the min link delay over all incoming channels;.
std::size_t GetSize() const
Get the number of ns-3 channels in this bundle.
Time GetDelay() const
Get the minimum delay along any channel in this bundle.
void SetGuaranteeTime(Time time)
Set the guarantee time for the bundle.
Time GetGuaranteeTime() const
Get the current guarantee time for this bundle.
~RemoteChannelBundle() override
Destructor.
RemoteChannelBundle()
Default constructor.
friend std::ostream & operator<<(std::ostream &out, ns3::RemoteChannelBundle &bundle)
Output for debugging purposes.
void SetEventId(EventId id)
Set the event ID of the Null Message send event currently scheduled for this channel.
void Send(Time time)
Send Null Message to the remote task associated with this bundle.
ChannelMap m_channels
ChannelId to Channel map.
Time m_guaranteeTime
Guarantee time for the incoming Channels from MPI task remote_rank.
uint32_t m_remoteSystemId
Remote rank.
void AddChannel(Ptr< Channel > channel, Time delay)
Add a channel to this bundle.
static TypeId GetTypeId()
Register this type.
EventId GetEventId() const
Get the event ID of the Null Message send event for this bundle.
EventId m_nullEventId
Event scheduled to send Null Message for this bundle.
uint32_t GetSystemId() const
Get the system Id for this side.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of class ns3::NullMessageSimulatorImpl.