A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
device-energy-model-container.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
21  */
22 
24 #include "ns3/names.h"
25 
26 namespace ns3 {
27 
29 {
30 }
31 
33 {
34  NS_ASSERT (model != NULL);
35  m_models.push_back (model);
36 }
37 
39 {
40  Ptr<DeviceEnergyModel> model = Names::Find<DeviceEnergyModel> (modelName);
41  NS_ASSERT (model != NULL);
42  m_models.push_back (model);
43 }
44 
47 {
48  *this = a;
49  Add (b);
50 }
51 
54 {
55  return m_models.begin ();
56 }
57 
60 {
61  return m_models.end ();
62 }
63 
64 uint32_t
66 {
67  return m_models.size ();
68 }
69 
72 {
73  return m_models[i];
74 }
75 
76 void
78 {
79  for (Iterator i = container.Begin (); i != container.End (); i++)
80  {
81  m_models.push_back (*i);
82  }
83 }
84 
85 void
87 {
88  NS_ASSERT (model != NULL);
89  m_models.push_back (model);
90 }
91 
92 void
93 DeviceEnergyModelContainer::Add (std::string modelName)
94 {
95  Ptr<DeviceEnergyModel> model = Names::Find<DeviceEnergyModel> (modelName);
96  NS_ASSERT (model != NULL);
97  m_models.push_back (model);
98 }
99 
100 void
102 {
103  m_models.clear ();
104 }
105 
106 } // namespace ns3