25 #include <ns3/fatal-error.h>
31 NS_LOG_COMPONENT_DEFINE(
"SatChannelPair");
36 NS_OBJECT_ENSURE_REGISTERED(SatChannelPair);
42 TypeId(
"ns3::SatChannelPair").SetParent<Object>().AddConstructor<SatChannelPair>();
51 NS_LOG_FUNCTION(
this);
56 NS_LOG_FUNCTION(
this);
65 NS_LOG_FUNCTION(
this << beamId);
67 std::map<std::pair<uint32_t, uint32_t>, std::pair<uint32_t, uint32_t>>::const_iterator
68 frequencyIterator =
m_frequencies.find(std::make_pair(satId, beamId));
71 NS_FATAL_ERROR(
"No SatChannel stored for this beam");
74 std::pair<uint32_t, uint32_t> frequenciesIds = frequencyIterator->second;
83 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channelIterator =
87 NS_FATAL_ERROR(
"No SatChannel stored for the forward frequency "
88 << frequencyId <<
" and satellite " << satId);
91 return channelIterator->second;
97 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channelIterator =
101 NS_FATAL_ERROR(
"No SatChannel stored for the return frequency "
102 << frequencyId <<
" and satellite " << satId);
105 return channelIterator->second;
111 NS_LOG_FUNCTION(
this << frequencyId);
113 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channel =
121 NS_LOG_FUNCTION(
this << frequencyId);
123 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::const_iterator channel =
131 uint32_t fwdFrequencyId,
132 uint32_t rtnFrequencyId)
134 NS_LOG_FUNCTION(
this << satId << beamId << fwdFrequencyId << rtnFrequencyId);
136 std::pair<uint32_t, uint32_t> frequenciesIds = std::make_pair(fwdFrequencyId, rtnFrequencyId);
137 std::pair<std::pair<uint32_t, uint32_t>, std::pair<uint32_t, uint32_t>> frequencyKey =
138 std::make_pair(std::make_pair(satId, beamId), frequenciesIds);
139 std::pair<std::map<std::pair<uint32_t, uint32_t>, std::pair<uint32_t, uint32_t>>::iterator,
142 if (!frequencyCreated.second)
144 NS_FATAL_ERROR(
"SatChannel pair already created for this beam");
151 uint32_t fwdFrequencyId,
152 Ptr<SatChannel> fwdChannel,
153 uint32_t rtnFrequencyId,
154 Ptr<SatChannel> rtnChannel)
156 NS_LOG_FUNCTION(
this << satId << beamId << fwdFrequencyId << fwdChannel << rtnFrequencyId
159 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::iterator fwdChannelIterator =
161 if (fwdChannelIterator !=
m_fwdChannels.end() && fwdChannelIterator->second != fwdChannel)
163 NS_FATAL_ERROR(
"SatChannel already created for the forward frequency " << fwdFrequencyId);
166 std::map<std::pair<uint32_t, uint32_t>, Ptr<SatChannel>>::iterator rtnChannelIterator =
168 if (rtnChannelIterator !=
m_rtnChannels.end() && rtnChannelIterator->second != rtnChannel)
170 NS_FATAL_ERROR(
"SatChannel already created for the return frequency " << rtnFrequencyId);
173 m_fwdChannels.emplace(std::make_pair(satId, fwdFrequencyId), fwdChannel);
174 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.