network: Add NodeContainer::Contains()
This commit is contained in:
@@ -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