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:
48  typedef std::vector< Ptr<EnergyHarvester> >::const_iterator Iterator;
49 
50 public:
51  static TypeId GetTypeId (void);
57 
65 
73  EnergyHarvesterContainer (std::string harvesterName);
74 
87  const EnergyHarvesterContainer &b);
88 
108  Iterator Begin (void) const;
109 
129  Iterator End (void) const;
130 
136  uint32_t GetN (void) const;
137 
144  Ptr<EnergyHarvester> Get (uint32_t i) const;
145 
152  void Add (EnergyHarvesterContainer container);
153 
159  void Add (Ptr<EnergyHarvester> harvester);
160 
167  void Add (std::string harvesterName);
168 
172  void Clear (void);
173 
174 private:
175  virtual void DoDispose (void);
176 
180  virtual void DoInitialize (void);
181 
182 private:
183  std::vector< Ptr<EnergyHarvester> > m_harvesters;
184 
185 };
186 
187 } // namespace ns3
188 
189 
190 #endif /* defined(ENERGY_HARVESTER_CONTAINER_H) */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Iterator Begin(void) const
Get an iterator which refers to the first EnergyHarvester pointer in the container.
virtual void DoInitialize(void)
Calls Object::Initialize () for all EnergySource objects.
void Add(EnergyHarvesterContainer container)
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Ptr< EnergyHarvester > Get(uint32_t i) const
Get the i-th Ptr stored in this container.
EnergyHarvesterContainer()
Creates an empty EnergyHarvesterContainer.
std::vector< Ptr< EnergyHarvester > >::const_iterator Iterator
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Holds a vector of ns3::EnergyHarvester pointers.
virtual void DoDispose(void)
Destructor implementation.
void Clear(void)
Removes all elements in the container.
std::vector< Ptr< EnergyHarvester > > m_harvesters
Iterator End(void) const
Get an iterator which refers to the last EnergyHarvester pointer in the container.
A base class which provides memory management and object aggregation.
Definition: object.h:87
a unique identifier for an interface.
Definition: type-id.h:58