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