From 839c58a7cd44e5c0779495ff98659eae53d4afe1 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 12 Jan 2024 12:24:29 -0800 Subject: [PATCH] spectrum: Add getter for propagation delay model --- src/spectrum/model/spectrum-channel.cc | 9 ++++++++- src/spectrum/model/spectrum-channel.h | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/spectrum/model/spectrum-channel.cc b/src/spectrum/model/spectrum-channel.cc index 068380c9a..6bb61689f 100644 --- a/src/spectrum/model/spectrum-channel.cc +++ b/src/spectrum/model/spectrum-channel.cc @@ -19,6 +19,7 @@ #include "spectrum-channel.h" +#include #include #include #include @@ -167,7 +168,7 @@ SpectrumChannel::GetSpectrumTransmitFilter() const void SpectrumChannel::SetPropagationDelayModel(Ptr delay) { - NS_ASSERT(!m_propagationDelay); + NS_ABORT_MSG_IF(m_propagationDelay, "Error, called SetPropagationDelayModel() twice"); m_propagationDelay = delay; } @@ -191,4 +192,10 @@ SpectrumChannel::GetPropagationLossModel() return m_propagationLoss; } +Ptr +SpectrumChannel::GetPropagationDelayModel() const +{ + return m_propagationDelay; +} + } // namespace ns3 diff --git a/src/spectrum/model/spectrum-channel.h b/src/spectrum/model/spectrum-channel.h index 311ef1cb5..ea9dbeabd 100644 --- a/src/spectrum/model/spectrum-channel.h +++ b/src/spectrum/model/spectrum-channel.h @@ -92,7 +92,10 @@ class SpectrumChannel : public Channel Ptr loss); /** - * Set the propagation delay model to be used + * Set the propagation delay model to be used. This method will abort + * the simulation if there exists a previously set propagation delay model + * (i.e., unlike propagation loss models, multiple of which can be chained + * together, there is only one propagation delay model). * \param delay Ptr to the propagation delay model to be used. */ void SetPropagationDelayModel(Ptr delay); @@ -116,6 +119,12 @@ class SpectrumChannel : public Channel */ Ptr GetPropagationLossModel(); + /** + * Get the propagation delay model that has been set on the channel. + * \returns a pointer to the propagation delay model. + */ + Ptr GetPropagationDelayModel() const; + /** * Add the transmit filter to be used to filter possible signal receptions * at the StartTx() time. This method may be called multiple