A Discrete-Event Network Simulator
API
net-device-container.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef NET_DEVICE_CONTAINER_H
21 #define NET_DEVICE_CONTAINER_H
22 
23 #include <stdint.h>
24 #include <vector>
25 #include "ns3/net-device.h"
26 
27 namespace ns3 {
28 
42 {
43 public:
45  typedef std::vector<Ptr<NetDevice> >::const_iterator Iterator;
46 
51 
59 
69  NetDeviceContainer (std::string devName);
70 
87 
107  Iterator Begin (void) const;
108 
128  Iterator End (void) const;
129 
150  uint32_t GetN (void) const;
151 
173  Ptr<NetDevice> Get (uint32_t i) const;
174 
181  void Add (NetDeviceContainer other);
182 
188  void Add (Ptr<NetDevice> device);
189 
196  void Add (std::string deviceName);
197 
198 private:
199  std::vector<Ptr<NetDevice> > m_devices;
200 };
201 
202 } // namespace ns3
203 
204 #endif /* NET_DEVICE_CONTAINER_H */
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
NetDeviceContainer()
Create an empty NetDeviceContainer.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
holds a vector of ns3::NetDevice pointers
std::vector< Ptr< NetDevice > > m_devices
NetDevices smart pointers.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.