A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
23
#include "
device-energy-model-container.h
"
24
#include "ns3/names.h"
25
26
namespace
ns3 {
27
28
DeviceEnergyModelContainer::DeviceEnergyModelContainer
()
29
{
30
}
31
32
DeviceEnergyModelContainer::DeviceEnergyModelContainer
(
Ptr<DeviceEnergyModel>
model)
33
{
34
NS_ASSERT
(model != NULL);
35
m_models
.push_back (model);
36
}
37
38
DeviceEnergyModelContainer::DeviceEnergyModelContainer
(std::string modelName)
39
{
40
Ptr<DeviceEnergyModel>
model = Names::Find<DeviceEnergyModel> (modelName);
41
NS_ASSERT
(model != NULL);
42
m_models
.push_back (model);
43
}
44
45
DeviceEnergyModelContainer::DeviceEnergyModelContainer
(
const
DeviceEnergyModelContainer
&a,
46
const
DeviceEnergyModelContainer
&b)
47
{
48
*
this
= a;
49
Add
(b);
50
}
51
52
DeviceEnergyModelContainer::Iterator
53
DeviceEnergyModelContainer::Begin
(
void
)
const
54
{
55
return
m_models
.begin ();
56
}
57
58
DeviceEnergyModelContainer::Iterator
59
DeviceEnergyModelContainer::End
(
void
)
const
60
{
61
return
m_models
.end ();
62
}
63
64
uint32_t
65
DeviceEnergyModelContainer::GetN
(
void
)
const
66
{
67
return
m_models
.size ();
68
}
69
70
Ptr<DeviceEnergyModel>
71
DeviceEnergyModelContainer::Get
(uint32_t i)
const
72
{
73
return
m_models
[i];
74
}
75
76
void
77
DeviceEnergyModelContainer::Add
(
DeviceEnergyModelContainer
container)
78
{
79
for
(
Iterator
i = container.
Begin
(); i != container.
End
(); i++)
80
{
81
m_models
.push_back (*i);
82
}
83
}
84
85
void
86
DeviceEnergyModelContainer::Add
(
Ptr<DeviceEnergyModel>
model)
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
101
DeviceEnergyModelContainer::Clear
(
void
)
102
{
103
m_models
.clear ();
104
}
105
106
}
// namespace ns3
src
energy
model
device-energy-model-container.cc
Generated on Tue Oct 9 2012 16:45:37 for ns-3 by
1.8.1.2