25 #include <ns3/fatal-error.h>
28 NS_LOG_COMPONENT_DEFINE(
"SatChannelPair");
33 NS_OBJECT_ENSURE_REGISTERED(SatChannelPair);
39 TypeId(
"ns3::SatChannelPair").SetParent<Object>().AddConstructor<SatChannelPair>();
48 NS_LOG_FUNCTION(
this);
53 NS_LOG_FUNCTION(
this);
62 NS_LOG_FUNCTION(
this << beamId);
64 std::map<std::pair<uint32_t, uint32_t>, std::pair<uint32_t, uint32_t>>::const_iterator
65 frequencyIterator =
m_frequencies.find(std::make_pair(satId, beamId));
68 NS_FATAL_ERROR(
"No SatChannel stored for this beam");
71 std::pair<uint32_t, uint32_t> frequenciesIds = frequencyIterator->second;
80 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channelIterator =
84 NS_FATAL_ERROR(
"No SatChannel stored for the forward frequency "
85 << frequencyId <<
" and satellite " << satId);
88 return channelIterator->second;
94 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channelIterator =
98 NS_FATAL_ERROR(
"No SatChannel stored for the return frequency "
99 << frequencyId <<
" and satellite " << satId);
102 return channelIterator->second;
108 NS_LOG_FUNCTION(
this << frequencyId);
110 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channel =
118 NS_LOG_FUNCTION(
this << frequencyId);
120 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channel =
128 uint32_t fwdFrequencyId,
129 uint32_t rtnFrequencyId)
131 NS_LOG_FUNCTION(
this << satId << beamId << fwdFrequencyId << rtnFrequencyId);
133 std::pair<uint32_t, uint32_t> frequenciesIds = std::make_pair(fwdFrequencyId, rtnFrequencyId);
134 std::pair<std::pair<uint32_t, uint32_t>, std::pair<uint32_t, uint32_t>> frequencyKey =
135 std::make_pair(std::make_pair(satId, beamId), frequenciesIds);
136 std::pair<std::map<std::pair<uint32_t, uint32_t>, std::pair<uint32_t, uint32_t>>::iterator,
139 if (!frequencyCreated.second)
141 NS_FATAL_ERROR(
"SatChannel pair already created for this beam");
148 uint32_t fwdFrequencyId,
149 Ptr<SatChannel> fwdChannel,
150 uint32_t rtnFrequencyId,
151 Ptr<SatChannel> rtnChannel)
153 NS_LOG_FUNCTION(
this << satId << beamId << fwdFrequencyId << fwdChannel << rtnFrequencyId
156 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::iterator fwdChannelIterator =
158 if (fwdChannelIterator !=
m_fwdChannels.end() && fwdChannelIterator->second != fwdChannel)
160 NS_FATAL_ERROR(
"SatChannel already created for the forward frequency " << fwdFrequencyId);
163 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::iterator rtnChannelIterator =
165 if (rtnChannelIterator !=
m_rtnChannels.end() && rtnChannelIterator->second != rtnChannel)
167 NS_FATAL_ERROR(
"SatChannel already created for the return frequency " << rtnFrequencyId);
170 m_fwdChannels.emplace(std::make_pair(satId, fwdFrequencyId), fwdChannel);
171 m_rtnChannels.emplace(std::make_pair(satId, rtnFrequencyId), rtnChannel);
virtual ~SatChannelPair()
Destructor for SatChannel.
Ptr< SatChannel > GetForwardChannel(uint32_t satId, uint32_t frequencyId) const
Ptr< SatChannel > GetReturnChannel(uint32_t satId, uint32_t frequencyId) const
bool HasFwdChannel(uint32_t satId, uint32_t frequencyId) const
Test if a channel pair has been stored for a given color.
void UpdateBeamsForFrequency(uint32_t satId, uint32_t beamdId, uint32_t fwdFrequencyId, uint32_t rtnFrequencyId)
Associate a new beam to a given color.
std::map< std::pair< uint32_t, uint32_t >, Ptr< SatChannel > > m_fwdChannels
static TypeId GetTypeId(void)
Get the type ID.
bool HasRtnChannel(uint32_t satId, uint32_t frequencyId) const
std::map< std::pair< uint32_t, uint32_t >, Ptr< SatChannel > > m_rtnChannels
std::pair< Ptr< SatChannel >, Ptr< SatChannel > > ChannelPair_t
ChannelPair_t GetChannelPair(uint32_t satId, uint32_t beamId) const
Retrieve the channel pair associated to a beam.
std::map< std::pair< uint32_t, uint32_t >, std::pair< uint32_t, uint32_t > > m_frequencies
void StoreChannelPair(uint32_t satId, uint32_t beamId, uint32_t fwdFrequencyId, Ptr< SatChannel > fwdChannel, uint32_t rtnFrequencyId, Ptr< SatChannel > rtnChannel)
Store a pair of SatChannel for the given color and associate the given beam to said color.
SatChannelPair()
Default constructor.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.