A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
device-energy-model-container.cc
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
12
13#include "ns3/log.h"
14#include "ns3/names.h"
15
16namespace ns3
17{
18namespace energy
19{
20
21NS_LOG_COMPONENT_DEFINE("DeviceEnergyModelContainer");
22
27
34
36{
37 NS_LOG_FUNCTION(this << modelName);
39 NS_ASSERT(model);
40 m_models.push_back(model);
41}
42
50
53{
54 NS_LOG_FUNCTION(this);
55 return m_models.begin();
56}
57
60{
61 NS_LOG_FUNCTION(this);
62 return m_models.end();
63}
64
67{
68 NS_LOG_FUNCTION(this);
69 return m_models.size();
70}
71
74{
75 NS_LOG_FUNCTION(this << i);
76 return m_models[i];
77}
78
79void
81{
82 NS_LOG_FUNCTION(this << &container);
83 for (auto i = container.Begin(); i != container.End(); i++)
84 {
85 m_models.push_back(*i);
86 }
87}
88
89void
91{
92 NS_LOG_FUNCTION(this << model);
93 NS_ASSERT(model);
94 m_models.push_back(model);
95}
96
97void
98DeviceEnergyModelContainer::Add(std::string modelName)
99{
100 NS_LOG_FUNCTION(this << modelName);
102 NS_ASSERT(model);
103 m_models.push_back(model);
104}
105
106void
112
113} // namespace energy
114} // namespace ns3
static Ptr< T > Find(std::string path)
Given a name path string, look to see if there's an object in the system with that associated to it.
Definition names.h:443
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::DeviceEnergyModel pointers.
void Add(DeviceEnergyModelContainer container)
std::vector< Ptr< DeviceEnergyModel > >::const_iterator Iterator
Const iterator of DeviceEnergyModel container.
std::vector< Ptr< DeviceEnergyModel > > m_models
Container of Energy models.
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
DeviceEnergyModelContainer()
Creates an empty DeviceEnergyModelContainer.
Iterator End() const
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
Iterator Begin() const
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
void Clear()
Removes all elements in the container.
uint32_t GetN() const
Get the number of Ptr<DeviceEnergyModel> stored in this container.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.