A Discrete-Event Network Simulator
API
energy-harvester-container.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
4  * University of Rochester, Rochester, NY, USA.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
20  */
21 
22 #ifndef ENERGY_HARVESTER_CONTAINER_H
23 #define ENERGY_HARVESTER_CONTAINER_H
24 
25 #include "ns3/energy-harvester.h"
26 #include "ns3/object.h"
27 #include <vector>
28 #include <stdint.h>
29 
30 namespace ns3 {
31 
32 class EnergyHarvester;
33 
46 {
47 public:
49  typedef std::vector< Ptr<EnergyHarvester> >::const_iterator Iterator;
50 
51 public:
56  static TypeId GetTypeId (void);
62 
70 
78  EnergyHarvesterContainer (std::string harvesterName);
79 
92  const EnergyHarvesterContainer &b);
93 
113  Iterator Begin (void) const;
114 
134  Iterator End (void) const;
135 
141  uint32_t GetN (void) const;
142 
149  Ptr<EnergyHarvester> Get (uint32_t i) const;
150 
157  void Add (EnergyHarvesterContainer container);
158 
164  void Add (Ptr<EnergyHarvester> harvester);
165 
172  void Add (std::string harvesterName);
173 
177  void Clear (void);
178 
179 private:
180  virtual void DoDispose (void);
181 
185  virtual void DoInitialize (void);
186 
187 private:
188  std::vector< Ptr<EnergyHarvester> > m_harvesters;
189 
190 };
191 
192 } // namespace ns3
193 
194 
195 #endif /* defined(ENERGY_HARVESTER_CONTAINER_H) */
Holds a vector of ns3::EnergyHarvester pointers.
Iterator Begin(void) const
Get an iterator which refers to the first EnergyHarvester pointer in the container.
std::vector< Ptr< EnergyHarvester > >::const_iterator Iterator
Const iterator for EnergyHarvester container.
uint32_t GetN(void) const
Get the number of Ptr<EnergyHarvester> stored in this container.
std::vector< Ptr< EnergyHarvester > > m_harvesters
Harvester container.
Iterator End(void) const
Get an iterator which refers to the last EnergyHarvester pointer in the container.
static TypeId GetTypeId(void)
Get the type ID.
virtual void DoInitialize(void)
Calls Object::Initialize () for all EnergySource objects.
void Clear(void)
Removes all elements in the container.
virtual void DoDispose(void)
Destructor implementation.
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.
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.