network: Add NodeContainer::Contains()
This commit is contained in:
@@ -64,6 +64,8 @@ nodes to be placed outside of buildings defined in the scenario.</li>
|
||||
<li> Added a priority queue disc (PrioQueueDisc).</li>
|
||||
<li> Added a new trace source in StaWifiMac for tracing beacon arrivals</li>
|
||||
<li> Added a new helper method to ApplicationContainer to start applications with some jitter around the start time</li>
|
||||
<li> (network) Add a method to check whether a node with a given ID is within a NodeContainer.</li>
|
||||
|
||||
</ul>
|
||||
<h2>Changes to existing API:</h2>
|
||||
<ul>
|
||||
|
||||
@@ -32,6 +32,8 @@ New user-visible features
|
||||
- (wifi) Add a new trace source to StaWifiMac to trace beacon arrivals
|
||||
- (network) Add a method to allow random variable-based jitter to be added
|
||||
to the start times of applications in a container.
|
||||
- (network) Add a method to check whether a node with a given ID is within
|
||||
a NodeContainer.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
@@ -136,4 +136,17 @@ NodeContainer::GetGlobal (void)
|
||||
return c;
|
||||
}
|
||||
|
||||
bool
|
||||
NodeContainer::Contains (uint32_t id) const
|
||||
{
|
||||
for (uint32_t i = 0; i < m_nodes.size (); i++)
|
||||
{
|
||||
if (m_nodes[i]->GetId () == id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -288,6 +288,14 @@ public:
|
||||
*/
|
||||
static NodeContainer GetGlobal (void);
|
||||
|
||||
/**
|
||||
* \brief Return true if container contains a Node with index id
|
||||
*
|
||||
* \return whether the NodeContainer contains a node with index id
|
||||
* \param id Node Id
|
||||
*/
|
||||
bool Contains (uint32_t id) const;
|
||||
|
||||
private:
|
||||
std::vector<Ptr<Node> > m_nodes; //!< Nodes smart pointers
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user