author | Mitch Watrous <watrous@u.washington.edu> |
Tue, 22 Mar 2011 16:40:32 -0700 | |
changeset 6938 | 85d201f1c67f |
parent 6699 | src/contrib/energy/helper/energy-source-container.cc@d8909a1fd0ff |
child 7385 | 10beb0e53130 |
permissions | -rw-r--r-- |
6535
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
2 |
/* |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
4 |
* Copyright (c) 2010 Network Security Lab, University of Washington, Seattle. |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
5 |
* |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation; |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
9 |
* |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
14 |
* |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
18 |
* |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
19 |
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
20 |
* Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu> |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
21 |
*/ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
22 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
23 |
#include "energy-source-container.h" |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
24 |
#include "ns3/names.h" |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
25 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
26 |
namespace ns3 { |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
27 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
28 |
TypeId |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
29 |
EnergySourceContainer::GetTypeId (void) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
30 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
31 |
static TypeId tid = TypeId ("ns3::EnergySourceContainer") |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
32 |
.SetParent<Object> () |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
33 |
.AddConstructor<EnergySourceContainer> () |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
34 |
; |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
35 |
return tid; |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
36 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
37 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
38 |
EnergySourceContainer::EnergySourceContainer () |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
39 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
40 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
41 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
42 |
EnergySourceContainer::~EnergySourceContainer () |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
43 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
44 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
45 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
46 |
EnergySourceContainer::EnergySourceContainer (Ptr<EnergySource> source) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
47 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
48 |
NS_ASSERT (source != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
49 |
m_sources.push_back (source); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
50 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
51 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
52 |
EnergySourceContainer::EnergySourceContainer (std::string sourceName) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
53 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
54 |
Ptr<EnergySource> source = Names::Find<EnergySource> (sourceName); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
55 |
NS_ASSERT (source != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
56 |
m_sources.push_back (source); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
57 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
58 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
59 |
EnergySourceContainer::EnergySourceContainer (const EnergySourceContainer &a, |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
60 |
const EnergySourceContainer &b) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
61 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
62 |
*this = a; |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
63 |
Add (b); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
64 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
65 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
66 |
EnergySourceContainer::Iterator |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
67 |
EnergySourceContainer::Begin (void) const |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
68 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
69 |
return m_sources.begin (); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
70 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
71 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
72 |
EnergySourceContainer::Iterator |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
73 |
EnergySourceContainer::End (void) const |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
74 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
75 |
return m_sources.end (); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
76 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
77 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
78 |
uint32_t |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
79 |
EnergySourceContainer::GetN (void) const |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
80 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
81 |
return m_sources.size (); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
82 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
83 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
84 |
Ptr<EnergySource> |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
85 |
EnergySourceContainer::Get (uint32_t i) const |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
86 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
87 |
return m_sources[i]; |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
88 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
89 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
90 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
91 |
EnergySourceContainer::Add (EnergySourceContainer container) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
92 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
93 |
for (Iterator i = container.Begin (); i != container.End (); i++) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
94 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
95 |
m_sources.push_back (*i); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
96 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
97 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
98 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
99 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
100 |
EnergySourceContainer::Add (Ptr<EnergySource> source) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
101 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
102 |
NS_ASSERT (source != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
103 |
m_sources.push_back (source); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
104 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
105 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
106 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
107 |
EnergySourceContainer::Add (std::string sourceName) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
108 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
109 |
Ptr<EnergySource> source = Names::Find<EnergySource> (sourceName); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
110 |
NS_ASSERT (source != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
111 |
m_sources.push_back (source); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
112 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
113 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
114 |
/* |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
115 |
* Private functions start here. |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
116 |
*/ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
117 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
118 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
119 |
EnergySourceContainer::DoDispose (void) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
120 |
{ |
6699
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
121 |
// call Object::Dispose for all EnergySource objects |
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
122 |
for (std::vector< Ptr<EnergySource> >::iterator i = m_sources.begin (); |
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
123 |
i != m_sources.end (); i++) |
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
124 |
{ |
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
125 |
(*i)->DisposeDeviceModels (); |
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
126 |
(*i)->Dispose (); |
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
127 |
} |
6535
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
128 |
m_sources.clear (); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
129 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
130 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
131 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
132 |
EnergySourceContainer::DoStart (void) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
133 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
134 |
// call Object::Start for all EnergySource objects |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
135 |
for (std::vector< Ptr<EnergySource> >::iterator i = m_sources.begin (); |
6699
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
136 |
i != m_sources.end (); i++) |
6535
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
137 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
138 |
(*i)->Start (); |
6699
d8909a1fd0ff
RV battery model and WiFi energy example
He Wu <mdzz@u.washington.edu>
parents:
6535
diff
changeset
|
139 |
(*i)->StartDeviceModels (); |
6535
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
140 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
141 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
142 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
143 |
} // namespace ns3 |