Public Types | Public Member Functions

ns3::DeviceEnergyModelContainer Class Reference

Holds a vector of ns3::DeviceEnergyModel pointers. More...

#include <device-energy-model-container.h>

List of all members.

Public Types

typedef std::vector< Ptr
< DeviceEnergyModel >
>::const_iterator 
Iterator

Public Member Functions

 DeviceEnergyModelContainer ()
 DeviceEnergyModelContainer (Ptr< DeviceEnergyModel > model)
 DeviceEnergyModelContainer (std::string modelName)
 DeviceEnergyModelContainer (const DeviceEnergyModelContainer &a, const DeviceEnergyModelContainer &b)
Iterator Begin (void) const
 Get an iterator which refers to the first DeviceEnergyModel pointer in the container.
Iterator End (void) const
 Get an iterator which refers to the last DeviceEnergyModel pointer in the container.
uint32_t GetN (void) const
 Get the number of Ptr<DeviceEnergyModel> stored in this container.
Ptr< DeviceEnergyModelGet (uint32_t i) const
 Get the i-th Ptr<DeviceEnergyModel> stored in this container.
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.
void Clear (void)
 Removes all elements in the container.

Detailed Description

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.

See also:
NetDeviceContainer

Constructor & Destructor Documentation

ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer (  ) 

Creates an empty DeviceEnergyModelContainer.

ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer ( Ptr< DeviceEnergyModel model  ) 
Parameters:
model Pointer to a DeviceEnergyModel.

Creates a DeviceEnergyModelContainer with exactly one DeviceEnergyModel previously instantiated.

ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer ( std::string  modelName  ) 
Parameters:
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.

ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer ( const DeviceEnergyModelContainer a,
const DeviceEnergyModelContainer b 
)
Parameters:
a A DeviceEnergyModelContainer.
b Another DeviceEnergyModelContainer.

Creates a DeviceEnergyModelContainer by concatenating DeviceEnergyModelContainer b to DeviceEnergyModelContainer a.

Note:
Can be used to concatenate 2 Ptr<DeviceEnergyModel> directly. C++ will be calling DeviceEnergyModelContainer constructor with Ptr<DeviceEnergyModel> first.

Member Function Documentation

void ns3::DeviceEnergyModelContainer::Add ( DeviceEnergyModelContainer  container  ) 
Parameters:
container Another DeviceEnergyModelContainer.

Appends the contents of another DeviceEnergyModelContainer to the end of this DeviceEnergyModelContainer.

void ns3::DeviceEnergyModelContainer::Add ( Ptr< DeviceEnergyModel model  ) 

Append a single Ptr<DeviceEnergyModel> to the end of this container.

Parameters:
model Pointer to an DeviceEnergyModel.
void ns3::DeviceEnergyModelContainer::Add ( std::string  modelName  ) 

Append a single Ptr<DeviceEnergyModel> referred to by its object name to the end of this container.

Parameters:
modelName Name of DeviceEnergyModel object.
Iterator ns3::DeviceEnergyModelContainer::Begin ( void   )  const

Get an iterator which refers to the first DeviceEnergyModel pointer in the container.

Returns:
An iterator which refers to the first DeviceEnergyModel in 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.

   DeviceEnergyModelContainer::Iterator i;
   for (i = container.Begin (); i != container.End (); ++i)
     {
       (*i)->method ();  // some DeviceEnergyModel method
     }
Iterator ns3::DeviceEnergyModelContainer::End ( void   )  const

Get an iterator which refers to the last DeviceEnergyModel pointer in the container.

Returns:
An iterator which refers to the last DeviceEnergyModel in 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.

   DeviceEnergyModelContainer::Iterator i;
   for (i = container.Begin (); i != container.End (); ++i)
     {
       (*i)->method ();  // some DeviceEnergyModel method
     }
Ptr<DeviceEnergyModel> ns3::DeviceEnergyModelContainer::Get ( uint32_t  i  )  const

Get the i-th Ptr<DeviceEnergyModel> stored in this container.

Parameters:
i Index of the requested Ptr<DeviceEnergyModel>.
Returns:
The requested Ptr<DeviceEnergyModel>.
uint32_t ns3::DeviceEnergyModelContainer::GetN ( void   )  const

Get the number of Ptr<DeviceEnergyModel> stored in this container.

Returns:
The number of Ptr<DeviceEnergyModel> stored in this container.

The documentation for this class was generated from the following file: