A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
device-energy-model-container.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
* Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
4
*
5
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8
* Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
9
*/
10
11
#ifndef DEVICE_ENERGY_MODEL_CONTAINER_H
12
#define DEVICE_ENERGY_MODEL_CONTAINER_H
13
14
#include "
device-energy-model.h
"
15
16
#include <stdint.h>
17
#include <vector>
18
19
namespace
ns3
20
{
21
namespace
energy
22
{
23
24
/**
25
* \ingroup energy
26
* \brief Holds a vector of ns3::DeviceEnergyModel pointers.
27
*
28
* DeviceEnergyModelContainer returns a list of DeviceEnergyModel pointers
29
* installed on a node. Users can use this list to access DeviceEnergyModel
30
* objects to obtain total device energy consumption on a node easily.
31
*
32
* \see NetDeviceContainer
33
*
34
*/
35
class
DeviceEnergyModelContainer
36
{
37
public
:
38
/// Const iterator of DeviceEnergyModel container
39
typedef
std::vector<Ptr<DeviceEnergyModel>>::const_iterator
Iterator
;
40
41
public
:
42
/**
43
* Creates an empty DeviceEnergyModelContainer.
44
*/
45
DeviceEnergyModelContainer
();
46
47
/**
48
* \param model Pointer to a DeviceEnergyModel.
49
*
50
* Creates a DeviceEnergyModelContainer with exactly one DeviceEnergyModel
51
* previously instantiated.
52
*/
53
DeviceEnergyModelContainer
(
Ptr<DeviceEnergyModel>
model);
54
55
/**
56
* \param modelName Name of DeviceEnergyModel.
57
*
58
* Creates an DeviceEnergyModelContainer with exactly one DeviceEnergyModel
59
* previously instantiated and assigned a name using the Object name service.
60
* This DeviceEnergyModel is specified by its assigned name.
61
*/
62
DeviceEnergyModelContainer
(std::string modelName);
63
64
/**
65
* \param a A DeviceEnergyModelContainer.
66
* \param b Another DeviceEnergyModelContainer.
67
*
68
* Creates a DeviceEnergyModelContainer by concatenating DeviceEnergyModelContainer b
69
* to DeviceEnergyModelContainer a.
70
*
71
* \note Can be used to concatenate 2 Ptr<DeviceEnergyModel> directly. C++
72
* will be calling DeviceEnergyModelContainer constructor with Ptr<DeviceEnergyModel>
73
* first.
74
*/
75
DeviceEnergyModelContainer
(
const
DeviceEnergyModelContainer
& a,
76
const
DeviceEnergyModelContainer
& b);
77
78
/**
79
* \brief Get an iterator which refers to the first DeviceEnergyModel pointer
80
* in the container.
81
*
82
* \returns An iterator which refers to the first DeviceEnergyModel in container.
83
*
84
* DeviceEnergyModels can be retrieved from the container in two ways. First,
85
* directly by an index into the container, and second, using an iterator.
86
* This method is used in the iterator method and is typically used in a
87
* for-loop to run through the DeviceEnergyModels.
88
*
89
* \code
90
* DeviceEnergyModelContainer::Iterator i;
91
* for (i = container.Begin (); i != container.End (); ++i)
92
* {
93
* (*i)->method (); // some DeviceEnergyModel method
94
* }
95
* \endcode
96
*/
97
Iterator
Begin
()
const
;
98
99
/**
100
* \brief Get an iterator which refers to the last DeviceEnergyModel pointer
101
* in the container.
102
*
103
* \returns An iterator which refers to the last DeviceEnergyModel in container.
104
*
105
* DeviceEnergyModels can be retrieved from the container in two ways. First,
106
* directly by an index into the container, and second, using an iterator.
107
* This method is used in the iterator method and is typically used in a
108
* for-loop to run through the DeviceEnergyModels.
109
*
110
* \code
111
* DeviceEnergyModelContainer::Iterator i;
112
* for (i = container.Begin (); i != container.End (); ++i)
113
* {
114
* (*i)->method (); // some DeviceEnergyModel method
115
* }
116
* \endcode
117
*/
118
Iterator
End
()
const
;
119
120
/**
121
* \brief Get the number of Ptr<DeviceEnergyModel> stored in this container.
122
*
123
* \returns The number of Ptr<DeviceEnergyModel> stored in this container.
124
*/
125
uint32_t
GetN
()
const
;
126
127
/**
128
* \brief Get the i-th Ptr<DeviceEnergyModel> stored in this container.
129
*
130
* \param i Index of the requested Ptr<DeviceEnergyModel>.
131
* \returns The requested Ptr<DeviceEnergyModel>.
132
*/
133
Ptr<DeviceEnergyModel>
Get
(
uint32_t
i)
const
;
134
135
/**
136
* \param container Another DeviceEnergyModelContainer.
137
*
138
* Appends the contents of another DeviceEnergyModelContainer to the end of
139
* this DeviceEnergyModelContainer.
140
*/
141
void
Add
(
DeviceEnergyModelContainer
container);
142
143
/**
144
* \brief Append a single Ptr<DeviceEnergyModel> to the end of this container.
145
*
146
* \param model Pointer to an DeviceEnergyModel.
147
*/
148
void
Add
(
Ptr<DeviceEnergyModel>
model);
149
150
/**
151
* \brief Append a single Ptr<DeviceEnergyModel> referred to by its object
152
* name to the end of this container.
153
*
154
* \param modelName Name of DeviceEnergyModel object.
155
*/
156
void
Add
(std::string modelName);
157
158
/**
159
* \brief Removes all elements in the container.
160
*/
161
void
Clear
();
162
163
private
:
164
std::vector<Ptr<DeviceEnergyModel>>
m_models
;
//!< Container of Energy models
165
};
166
167
}
// namespace energy
168
}
// namespace ns3
169
170
#endif
/* DEVICE_ENERGY_MODEL_CONTAINER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::energy::DeviceEnergyModelContainer
Holds a vector of ns3::DeviceEnergyModel pointers.
Definition
device-energy-model-container.h:36
ns3::energy::DeviceEnergyModelContainer::Add
void Add(DeviceEnergyModelContainer container)
Definition
device-energy-model-container.cc:80
ns3::energy::DeviceEnergyModelContainer::Iterator
std::vector< Ptr< DeviceEnergyModel > >::const_iterator Iterator
Const iterator of DeviceEnergyModel container.
Definition
device-energy-model-container.h:39
ns3::energy::DeviceEnergyModelContainer::m_models
std::vector< Ptr< DeviceEnergyModel > > m_models
Container of Energy models.
Definition
device-energy-model-container.h:164
ns3::energy::DeviceEnergyModelContainer::Get
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
Definition
device-energy-model-container.cc:73
ns3::energy::DeviceEnergyModelContainer::DeviceEnergyModelContainer
DeviceEnergyModelContainer()
Creates an empty DeviceEnergyModelContainer.
Definition
device-energy-model-container.cc:23
ns3::energy::DeviceEnergyModelContainer::End
Iterator End() const
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
Definition
device-energy-model-container.cc:59
ns3::energy::DeviceEnergyModelContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
Definition
device-energy-model-container.cc:52
ns3::energy::DeviceEnergyModelContainer::Clear
void Clear()
Removes all elements in the container.
Definition
device-energy-model-container.cc:107
ns3::energy::DeviceEnergyModelContainer::GetN
uint32_t GetN() const
Get the number of Ptr<DeviceEnergyModel> stored in this container.
Definition
device-energy-model-container.cc:66
uint32_t
device-energy-model.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
energy
model
device-energy-model-container.h
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0