A Discrete-Event Network Simulator
API
energy-source-container.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 INRIA
3  * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
20  */
21 
22 #ifndef ENERGY_SOURCE_CONTAINER_H
23 #define ENERGY_SOURCE_CONTAINER_H
24 
25 #include "ns3/energy-source.h"
26 #include "ns3/object.h"
27 
28 #include <stdint.h>
29 #include <vector>
30 
31 namespace ns3
32 {
33 
46 {
47  public:
49  typedef std::vector<Ptr<EnergySource>>::const_iterator Iterator;
50 
51  public:
56  static TypeId GetTypeId();
61  ~EnergySourceContainer() override;
62 
70 
78  EnergySourceContainer(std::string sourceName);
79 
91 
111  Iterator Begin() const;
112 
132  Iterator End() const;
133 
139  uint32_t GetN() const;
140 
147  Ptr<EnergySource> Get(uint32_t i) const;
148 
156 
162  void Add(Ptr<EnergySource> source);
163 
170  void Add(std::string sourceName);
171 
172  private:
173  void DoDispose() override;
174 
178  void DoInitialize() override;
179 
180  private:
181  std::vector<Ptr<EnergySource>> m_sources;
182 };
183 
184 } // namespace ns3
185 
186 #endif /* ENERGY_SOURCE_CONTAINER_H */
Holds a vector of ns3::EnergySource pointers.
Ptr< EnergySource > Get(uint32_t i) const
Get the i-th Ptr<EnergySource> stored in this container.
uint32_t GetN() const
Get the number of Ptr<EnergySource> stored in this container.
EnergySourceContainer()
Creates an empty EnergySourceContainer.
Iterator Begin() const
Get an iterator which refers to the first EnergySource pointer in the container.
void Add(EnergySourceContainer container)
void DoInitialize() override
Calls Object::Start () for all EnergySource objects.
std::vector< Ptr< EnergySource > >::const_iterator Iterator
Const iterator for EnergySource container.
static TypeId GetTypeId()
Get the type ID.
std::vector< Ptr< EnergySource > > m_sources
Energy source container.
void DoDispose() override
Destructor implementation.
Iterator End() const
Get an iterator which refers to the last EnergySource pointer in the container.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.