Holds a vector of ns3::DeviceEnergyModel pointers. More...
#include "device-energy-model-container.h"
Public Types | |
typedef std::vector< Ptr< DeviceEnergyModel > >::const_iterator | Iterator |
Const iterator of DeviceEnergyModel container. | |
Public Member Functions | |
DeviceEnergyModelContainer () | |
Creates an empty DeviceEnergyModelContainer. | |
DeviceEnergyModelContainer (const DeviceEnergyModelContainer &a, const DeviceEnergyModelContainer &b) | |
DeviceEnergyModelContainer (Ptr< DeviceEnergyModel > model) | |
DeviceEnergyModelContainer (std::string modelName) | |
void | Add (DeviceEnergyModelContainer container) |
void | Add (Ptr< DeviceEnergyModel > model) |
Append a single Ptr<DeviceEnergyModel> to the end of this container. | |
void | Add (std::string modelName) |
Append a single Ptr<DeviceEnergyModel> referred to by its object name to the end of this 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. | |
Iterator | End () const |
Get an iterator which refers to the last DeviceEnergyModel pointer in the container. | |
Ptr< DeviceEnergyModel > | Get (uint32_t i) const |
Get the i-th Ptr<DeviceEnergyModel> stored in this container. | |
uint32_t | GetN () const |
Get the number of Ptr<DeviceEnergyModel> stored in this container. | |
Private Attributes | |
std::vector< Ptr< DeviceEnergyModel > > | m_models |
Container of Energy models. | |
Holds a vector of ns3::DeviceEnergyModel pointers.
DeviceEnergyModelContainer returns a list of DeviceEnergyModel pointers installed on a node. Users can use this list to access DeviceEnergyModel objects to obtain total device energy consumption on a node easily.
Definition at line 35 of file device-energy-model-container.h.
typedef std::vector<Ptr<DeviceEnergyModel>>::const_iterator ns3::energy::DeviceEnergyModelContainer::Iterator |
Const iterator of DeviceEnergyModel container.
Definition at line 39 of file device-energy-model-container.h.
ns3::energy::DeviceEnergyModelContainer::DeviceEnergyModelContainer | ( | ) |
Creates an empty DeviceEnergyModelContainer.
Definition at line 23 of file device-energy-model-container.cc.
References NS_LOG_FUNCTION.
ns3::energy::DeviceEnergyModelContainer::DeviceEnergyModelContainer | ( | Ptr< DeviceEnergyModel > | model | ) |
model | Pointer to a DeviceEnergyModel. |
Creates a DeviceEnergyModelContainer with exactly one DeviceEnergyModel previously instantiated.
Definition at line 28 of file device-energy-model-container.cc.
References m_models, NS_ASSERT, and NS_LOG_FUNCTION.
ns3::energy::DeviceEnergyModelContainer::DeviceEnergyModelContainer | ( | std::string | modelName | ) |
modelName | Name of DeviceEnergyModel. |
Creates an DeviceEnergyModelContainer with exactly one DeviceEnergyModel previously instantiated and assigned a name using the Object name service. This DeviceEnergyModel is specified by its assigned name.
Definition at line 35 of file device-energy-model-container.cc.
References ns3::Names::Find(), m_models, NS_ASSERT, and NS_LOG_FUNCTION.
ns3::energy::DeviceEnergyModelContainer::DeviceEnergyModelContainer | ( | const DeviceEnergyModelContainer & | a, |
const DeviceEnergyModelContainer & | b ) |
a | A DeviceEnergyModelContainer. |
b | Another DeviceEnergyModelContainer. |
Creates a DeviceEnergyModelContainer by concatenating DeviceEnergyModelContainer b to DeviceEnergyModelContainer a.
Definition at line 43 of file device-energy-model-container.cc.
References Add(), and NS_LOG_FUNCTION.
void ns3::energy::DeviceEnergyModelContainer::Add | ( | DeviceEnergyModelContainer | container | ) |
container | Another DeviceEnergyModelContainer. |
Appends the contents of another DeviceEnergyModelContainer to the end of this DeviceEnergyModelContainer.
Definition at line 80 of file device-energy-model-container.cc.
References m_models, and NS_LOG_FUNCTION.
Referenced by DeviceEnergyModelContainer(), and ns3::energy::EnergySource::AppendDeviceEnergyModel().
void ns3::energy::DeviceEnergyModelContainer::Add | ( | Ptr< DeviceEnergyModel > | model | ) |
Append a single Ptr<DeviceEnergyModel> to the end of this container.
model | Pointer to an DeviceEnergyModel. |
Definition at line 90 of file device-energy-model-container.cc.
References m_models, NS_ASSERT, and NS_LOG_FUNCTION.
void ns3::energy::DeviceEnergyModelContainer::Add | ( | std::string | modelName | ) |
Append a single Ptr<DeviceEnergyModel> referred to by its object name to the end of this container.
modelName | Name of DeviceEnergyModel object. |
Definition at line 98 of file device-energy-model-container.cc.
References ns3::Names::Find(), m_models, NS_ASSERT, and NS_LOG_FUNCTION.
DeviceEnergyModelContainer::Iterator ns3::energy::DeviceEnergyModelContainer::Begin | ( | ) | const |
Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
DeviceEnergyModels can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the DeviceEnergyModels.
Definition at line 52 of file device-energy-model-container.cc.
References m_models, and NS_LOG_FUNCTION.
Referenced by ns3::energy::EnergySource::CalculateTotalCurrent(), ns3::energy::EnergySource::DisposeDeviceModels(), ns3::energy::EnergySource::FindDeviceEnergyModels(), ns3::energy::EnergySource::FindDeviceEnergyModels(), ns3::energy::EnergySource::InitializeDeviceModels(), ns3::energy::EnergySource::NotifyEnergyChanged(), ns3::energy::EnergySource::NotifyEnergyDrained(), and ns3::energy::EnergySource::NotifyEnergyRecharged().
void ns3::energy::DeviceEnergyModelContainer::Clear | ( | ) |
Removes all elements in the container.
Definition at line 107 of file device-energy-model-container.cc.
References m_models, and NS_LOG_FUNCTION.
Referenced by ns3::energy::EnergySource::BreakDeviceEnergyModelRefCycle().
DeviceEnergyModelContainer::Iterator ns3::energy::DeviceEnergyModelContainer::End | ( | ) | const |
Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
DeviceEnergyModels can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the DeviceEnergyModels.
Definition at line 59 of file device-energy-model-container.cc.
References m_models, and NS_LOG_FUNCTION.
Referenced by ns3::energy::EnergySource::CalculateTotalCurrent(), ns3::energy::EnergySource::DisposeDeviceModels(), ns3::energy::EnergySource::FindDeviceEnergyModels(), ns3::energy::EnergySource::FindDeviceEnergyModels(), ns3::energy::EnergySource::InitializeDeviceModels(), ns3::energy::EnergySource::NotifyEnergyChanged(), ns3::energy::EnergySource::NotifyEnergyDrained(), and ns3::energy::EnergySource::NotifyEnergyRecharged().
Ptr< DeviceEnergyModel > ns3::energy::DeviceEnergyModelContainer::Get | ( | uint32_t | i | ) | const |
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
i | Index of the requested Ptr<DeviceEnergyModel>. |
Definition at line 73 of file device-energy-model-container.cc.
References m_models, and NS_LOG_FUNCTION.
Referenced by AcousticModemEnergyTestCase::DoRun(), BasicEnergyUpdateTest::StateSwitchTest(), and BatteryLifetimeTest::VariableLoadTest().
uint32_t ns3::energy::DeviceEnergyModelContainer::GetN | ( | ) | const |
Get the number of Ptr<DeviceEnergyModel> stored in this container.
Definition at line 66 of file device-energy-model-container.cc.
References m_models, and NS_LOG_FUNCTION.
Referenced by BasicEnergyUpdateTest::StateSwitchTest().
|
private |
Container of Energy models.
Definition at line 164 of file device-energy-model-container.h.
Referenced by DeviceEnergyModelContainer(), DeviceEnergyModelContainer(), Add(), Add(), Add(), Begin(), Clear(), End(), Get(), and GetN().