A Discrete-Event Network Simulator
API
energy-harvester-container.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
3  * University of Rochester, Rochester, NY, USA.
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: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
19  */
20 
21 #ifndef ENERGY_HARVESTER_CONTAINER_H
22 #define ENERGY_HARVESTER_CONTAINER_H
23 
24 #include "ns3/energy-harvester.h"
25 #include "ns3/object.h"
26 
27 #include <stdint.h>
28 #include <vector>
29 
30 namespace ns3
31 {
32 
33 class EnergyHarvester;
34 
47 {
48  public:
50  typedef std::vector<Ptr<EnergyHarvester>>::const_iterator Iterator;
51 
52  public:
57  static TypeId GetTypeId();
62  ~EnergyHarvesterContainer() override;
63 
71 
79  EnergyHarvesterContainer(std::string harvesterName);
80 
93 
113  Iterator Begin() const;
114 
134  Iterator End() const;
135 
141  uint32_t GetN() const;
142 
149  Ptr<EnergyHarvester> Get(uint32_t i) const;
150 
158 
164  void Add(Ptr<EnergyHarvester> harvester);
165 
172  void Add(std::string harvesterName);
173 
177  void Clear();
178 
179  private:
180  void DoDispose() override;
181 
185  void DoInitialize() override;
186 
187  private:
188  std::vector<Ptr<EnergyHarvester>> m_harvesters;
189 };
190 
191 } // namespace ns3
192 
193 #endif /* defined(ENERGY_HARVESTER_CONTAINER_H) */
Holds a vector of ns3::EnergyHarvester pointers.
void Clear()
Removes all elements in the container.
std::vector< Ptr< EnergyHarvester > >::const_iterator Iterator
Const iterator for EnergyHarvester container.
Iterator End() const
Get an iterator which refers to the last EnergyHarvester pointer in the container.
void DoDispose() override
Destructor implementation.
Iterator Begin() const
Get an iterator which refers to the first EnergyHarvester pointer in the container.
void DoInitialize() override
Calls Object::Initialize () for all EnergySource objects.
Ptr< EnergyHarvester > Get(uint32_t i) const
Get the i-th Ptr<EnergyHarvester> stored in this container.
void Add(EnergyHarvesterContainer container)
EnergyHarvesterContainer()
Creates an empty EnergyHarvesterContainer.
uint32_t GetN() const
Get the number of Ptr<EnergyHarvester> stored in this container.
static TypeId GetTypeId()
Get the type ID.
std::vector< Ptr< EnergyHarvester > > m_harvesters
Harvester 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.