21 #include "energy-model-helper.h"
22 #include "ns3/config.h"
23 #include "ns3/names.h"
30 EnergySourceHelper::~EnergySourceHelper ()
44 for (NodeContainer::Iterator i = c.
Begin (); i != c.
End (); ++i)
54 if (EnergySourceContrainerOnNode == NULL)
57 fac.
SetTypeId (
"ns3::EnergySourceContainer");
59 EnergySourceContrainerOnNode->Add (src);
60 (*i)->AggregateObject (EnergySourceContrainerOnNode);
64 EnergySourceContrainerOnNode->Add (src);
73 Ptr<Node> node = Names::Find<Node> (nodeName);
86 DeviceEnergyModelHelper::~DeviceEnergyModelHelper ()
90 DeviceEnergyModelContainer
97 NS_ASSERT (device->GetNode () == source->GetNode ());
108 NetDeviceContainer::Iterator dev = deviceContainer.
Begin ();
109 EnergySourceContainer::Iterator src = sourceContainer.
Begin ();
110 while (dev != deviceContainer.
End ())
113 NS_ASSERT ((*dev)->GetNode () == (*src)->GetNode ());
115 container.Add (model);
DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< EnergySource > source) const
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Holds a vector of ns3::EnergySource pointers.
void Add(EnergySourceContainer container)
uint32_t GetN(void) const
Get the number of Ptr<EnergySource> stored in this container.
#define NS_ASSERT(condition)
void SetTypeId(TypeId tid)
virtual Ptr< EnergySource > DoInstall(Ptr< Node > node) const =0
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
EnergySourceContainer InstallAll(void) const
This function installs an EnergySource on all nodes in simulation.
Holds a vector of ns3::DeviceEnergyModel pointers.
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
Ptr< Object > Create(void) const
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
EnergySourceContainer Install(Ptr< Node > node) const
static NodeContainer GetGlobal(void)
Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and ...
instantiate subclasses of ns3::Object.
virtual Ptr< DeviceEnergyModel > DoInstall(Ptr< NetDevice > device, Ptr< EnergySource > source) const =0
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Iterator Begin(void) const
Get an iterator which refers to the first EnergySource pointer in the container.