author | Vedran Miletić <rivanvx@gmail.com> |
Tue, 02 Aug 2011 17:42:33 -0400 | |
changeset 7385 | 10beb0e53130 |
parent 6938 | 85d201f1c67f |
child 9281 | 6b83f7ad7fad |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
6938
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6535
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 "device-energy-model-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 |
DeviceEnergyModelContainer::DeviceEnergyModelContainer () |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
29 |
{ |
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 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
32 |
DeviceEnergyModelContainer::DeviceEnergyModelContainer (Ptr<DeviceEnergyModel> model) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
33 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
34 |
NS_ASSERT (model != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
35 |
m_models.push_back (model); |
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 |
DeviceEnergyModelContainer::DeviceEnergyModelContainer (std::string modelName) |
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 |
Ptr<DeviceEnergyModel> model = Names::Find<DeviceEnergyModel> (modelName); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
41 |
NS_ASSERT (model != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
42 |
m_models.push_back (model); |
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 |
DeviceEnergyModelContainer::DeviceEnergyModelContainer (const DeviceEnergyModelContainer &a, |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
46 |
const DeviceEnergyModelContainer &b) |
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 |
*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
|
49 |
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
|
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 |
DeviceEnergyModelContainer::Iterator |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
53 |
DeviceEnergyModelContainer::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
|
54 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
55 |
return m_models.begin (); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
56 |
} |
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 |
DeviceEnergyModelContainer::Iterator |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
59 |
DeviceEnergyModelContainer::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
|
60 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
61 |
return m_models.end (); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
62 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
63 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
64 |
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
|
65 |
DeviceEnergyModelContainer::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
|
66 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
67 |
return m_models.size (); |
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 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
70 |
Ptr<DeviceEnergyModel> |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
71 |
DeviceEnergyModelContainer::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
|
72 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
73 |
return m_models[i]; |
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 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
76 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
77 |
DeviceEnergyModelContainer::Add (DeviceEnergyModelContainer container) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
78 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
79 |
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
|
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 |
m_models.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
|
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 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
85 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
86 |
DeviceEnergyModelContainer::Add (Ptr<DeviceEnergyModel> model) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
87 |
{ |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
88 |
NS_ASSERT (model != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
89 |
m_models.push_back (model); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
90 |
} |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
91 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
92 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
93 |
DeviceEnergyModelContainer::Add (std::string modelName) |
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 |
Ptr<DeviceEnergyModel> model = Names::Find<DeviceEnergyModel> (modelName); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
96 |
NS_ASSERT (model != NULL); |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
97 |
m_models.push_back (model); |
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 |
|
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
100 |
void |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
101 |
DeviceEnergyModelContainer::Clear (void) |
0a90ef2b29a9
Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff
changeset
|
102 |
{ |
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_models.clear (); |
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 |
} // namespace ns3 |