network, applications, internet-apps: Add AssignStreams method to application base class

This commit is contained in:
Sébastien Deronne
2024-01-24 12:52:44 +01:00
parent b942f54323
commit e90a8924f5
6 changed files with 20 additions and 31 deletions

View File

@@ -87,11 +87,7 @@ OnOffHelper::AssignStreams(NodeContainer c, int64_t stream)
node = (*i);
for (uint32_t j = 0; j < node->GetNApplications(); j++)
{
Ptr<OnOffApplication> onoff = DynamicCast<OnOffApplication>(node->GetApplication(j));
if (onoff)
{
currentStream += onoff->AssignStreams(currentStream);
}
currentStream += node->GetApplication(j)->AssignStreams(currentStream);
}
}
return (currentStream - stream);

View File

@@ -122,14 +122,7 @@ class OnOffApplication : public Application
*/
Ptr<Socket> GetSocket() const;
/**
* \brief Assign a fixed random variable stream number to the random variables
* used by this model.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams(int64_t stream);
int64_t AssignStreams(int64_t stream) override;
protected:
void DoDispose() override;

View File

@@ -80,15 +80,7 @@ class DhcpClient : public Application
*/
Ipv4Address GetDhcpServer();
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
* have been assigned.
*
* \param stream First stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams(int64_t stream);
int64_t AssignStreams(int64_t stream) override;
protected:
void DoDispose() override;

View File

@@ -85,15 +85,7 @@ class Radvd : public Application
*/
void AddConfiguration(Ptr<RadvdInterface> routerInterface);
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
* have been assigned.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams(int64_t stream);
int64_t AssignStreams(int64_t stream) override;
protected:
void DoDispose() override;

View File

@@ -132,4 +132,11 @@ Application::StopApplication()
NS_LOG_FUNCTION(this);
}
int64_t
Application::AssignStreams(int64_t stream)
{
NS_LOG_FUNCTION(this << stream);
return 0;
}
} // namespace ns3

View File

@@ -105,6 +105,15 @@ class Application : public Object
*/
void SetNode(Ptr<Node> node);
/**
* \brief Assign a fixed random variable stream number to the random variables
* used by this Application object.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this Application object
*/
virtual int64_t AssignStreams(int64_t stream);
/**
* \brief Common callback signature for packet delay and address.
*