Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
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 ···· | |
34 /** | |
35 * \ingroup energy | |
36 * \brief Holds a vector of ns3::EnergyHarvester pointers. | |
37 * | |
38 * EnergyHarvesterContainer returns a list of EnergyHarvester pointers | |
39 * installed on a node. Users can use this list to access EnergyHarvester | |
40 * objects to obtain the total energy harvested on a node easily. | |
41 * | |
42 * \see NetDeviceContainer | |
Tom Henderson
2014/07/30 21:44:50
why "see NetDeviceContainer"-- what does NetDevice
cristiano.tapparello
2014/09/04 00:36:31
I inherited this from the other containers of the
| |
43 * | |
44 */ | |
45 class EnergyHarvesterContainer : public Object | |
46 { | |
47 public: | |
48 typedef std::vector< Ptr<EnergyHarvester> >::const_iterator Iterator; | |
49 ········ | |
50 public: | |
51 static TypeId GetTypeId (void); | |
52 /** | |
53 * Creates an empty EnergyHarvesterContainer. | |
54 */ | |
55 EnergyHarvesterContainer (); | |
56 ~EnergyHarvesterContainer (); | |
57 ········ | |
58 /** | |
59 * \param harvester Pointer to an EnergyHarvester. | |
60 * | |
61 * Creates a EnergyHarvesterContainer with exactly one EnergyHarvester | |
62 * previously instantiated. | |
63 */ | |
64 EnergyHarvesterContainer (Ptr<EnergyHarvester> harvester); | |
65 ········ | |
66 /** | |
67 * \param harvesterName Name of EnergyHarvester. | |
68 * | |
69 * Creates an EnergyHarvesterContainer with exactly one EnergyHarvester | |
70 * previously instantiated and assigned a name using the Object name ser vice. | |
71 * This EnergyHarvester is specified by its assigned name. | |
72 */ | |
73 EnergyHarvesterContainer (std::string harvesterName); | |
74 ········ | |
75 /** | |
76 * \param a A EnergyHarvesterContainer. | |
77 * \param b Another EnergyHarvesterContainer. | |
78 * | |
79 * Creates a EnergyHarvesterContainer by concatenating EnergyHarvesterCo ntainer b | |
80 * to EnergyHarvesterContainer a. | |
81 * | |
82 * \note Can be used to concatenate 2 Ptr<EnergyHarvester> directly. C++ | |
83 * will be calling EnergyHarvesterContainer constructor with Ptr<EnergyH arvester> | |
84 * first. | |
85 */ | |
86 EnergyHarvesterContainer (const EnergyHarvesterContainer &a, | |
87 const EnergyHarvesterContainer &b); | |
88 ········ | |
89 /** | |
90 * \brief Get an iterator which refers to the first EnergyHarvester poin ter | |
91 * in the container. | |
92 * | |
93 * \returns An iterator which refers to the first EnergyHarvester in con tainer. | |
94 * | |
95 * EnergyHarvesters can be retrieved from the container in two ways. Fir st, | |
96 * directly by an index into the container, and second, using an iterato r. | |
97 * This method is used in the iterator method and is typically used in a | |
98 * for-loop to run through the EnergyHarvesters. | |
99 * | |
100 * \code | |
101 * EnergyHarvesterContainer::Iterator i; | |
102 * for (i = container.Begin (); i != container.End (); ++i) | |
103 * { | |
104 * (*i)->method (); // some EnergyHarvester method | |
105 * } | |
106 * \endcode | |
107 */ | |
108 Iterator Begin (void) const; | |
109 ········ | |
110 /** | |
111 * \brief Get an iterator which refers to the last EnergyHarvester point er | |
112 * in the container. | |
113 * | |
114 * \returns An iterator which refers to the last EnergyHarvester in cont ainer. | |
115 * | |
116 * EnergyHarvesters can be retrieved from the container in two ways. Fir st, | |
117 * directly by an index into the container, and second, using an iterato r. | |
118 * This method is used in the iterator method and is typically used in a | |
119 * for-loop to run through the EnergyHarvesters. | |
120 * | |
121 * \code | |
122 * EnergyHarvesterContainer::Iterator i; | |
123 * for (i = container.Begin (); i != container.End (); ++i) | |
124 * { | |
125 * (*i)->method (); // some EnergyHarvester method | |
126 * } | |
127 * \endcode | |
128 */ | |
129 Iterator End (void) const; | |
130 ········ | |
131 /** | |
132 * \brief Get the number of Ptr<EnergyHarvester> stored in this containe r. | |
133 * | |
134 * \returns The number of Ptr<EnergyHarvester> stored in this container. | |
135 */ | |
136 uint32_t GetN (void) const; | |
137 ········ | |
138 /** | |
139 * \brief Get the i-th Ptr<EnergyHarvester> stored in this container. | |
140 * | |
141 * \param i Index of the requested Ptr<EnergyHarvester>. | |
142 * \returns The requested Ptr<EnergyHarvester>. | |
143 */ | |
144 Ptr<EnergyHarvester> Get (uint32_t i) const; | |
145 ········ | |
146 /** | |
147 * \param container Another EnergyHarvesterContainer. | |
148 * | |
149 * Appends the contents of another EnergyHarvesterContainer to the end o f | |
150 * this EnergyHarvesterContainer. | |
151 */ | |
152 void Add (EnergyHarvesterContainer container); | |
153 ········ | |
154 /** | |
155 * \brief Append a single Ptr<EnergyHarvester> to the end of this contai ner. | |
156 * | |
157 * \param harvester Pointer to an EnergyHarvester. | |
158 */ | |
159 void Add (Ptr<EnergyHarvester> harvester); | |
160 ········ | |
161 /** | |
162 * \brief Append a single Ptr<EnergyHarvester> referred to by its object | |
163 * name to the end of this container. | |
164 * | |
165 * \param harvesterName Name of EnergyHarvester object. | |
166 */ | |
167 void Add (std::string harvesterName); | |
168 ········ | |
169 /** | |
170 * \brief Removes all elements in the container. | |
171 */ | |
172 void Clear (void); | |
173 ········ | |
174 private: | |
175 virtual void DoDispose (void); | |
176 ········ | |
177 /** | |
178 * \brief Calls Object::Initialize () for all EnergySource objects. | |
179 */ | |
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) */ | |
OLD | NEW |