spectrum: Add AssignStreams() capability to SpectrumTransmitFilter
This commit is contained in:
@@ -87,4 +87,23 @@ SpectrumTransmitFilter::Filter(Ptr<const SpectrumSignalParameters> params,
|
||||
}
|
||||
}
|
||||
|
||||
int64_t
|
||||
SpectrumTransmitFilter::AssignStreams(int64_t stream)
|
||||
{
|
||||
auto currentStream = stream;
|
||||
currentStream += DoAssignStreams(stream);
|
||||
if (m_next)
|
||||
{
|
||||
currentStream += m_next->AssignStreams(currentStream);
|
||||
}
|
||||
NS_LOG_DEBUG("SpectrumTransmitFilter objects used " << currentStream - stream << " streams");
|
||||
return (currentStream - stream);
|
||||
}
|
||||
|
||||
int64_t
|
||||
SpectrumTransmitFilter::DoAssignStreams(int64_t stream)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -74,8 +74,30 @@ class SpectrumTransmitFilter : public Object
|
||||
*/
|
||||
bool Filter(Ptr<const SpectrumSignalParameters> params, Ptr<const SpectrumPhy> receiverPhy);
|
||||
|
||||
/**
|
||||
* If this loss model uses objects of type RandomVariableStream,
|
||||
* set the stream numbers to the integers starting with the offset
|
||||
* 'stream'. Return the number of streams (possibly zero) that
|
||||
* have been assigned. If there are SpectrumTransmitFilters chained
|
||||
* together, this method will also assign streams to the
|
||||
* downstream models.
|
||||
*
|
||||
* \param stream the stream index offset start
|
||||
* \return the number of stream indices assigned by this model
|
||||
*/
|
||||
int64_t AssignStreams(int64_t stream);
|
||||
|
||||
protected:
|
||||
void DoDispose() override;
|
||||
/**
|
||||
* Assign a fixed random variable stream number to the random variables used by this model.
|
||||
*
|
||||
* This should be overridden by subclasses that use random variables.
|
||||
*
|
||||
* \param stream first stream index to use
|
||||
* \return the number of stream indices assigned by this model
|
||||
*/
|
||||
virtual int64_t DoAssignStreams(int64_t stream);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user